This commit is contained in:
Pepper0ni 2025-04-24 21:50:53 +01:00
commit 9b2d092a5b
4 changed files with 73 additions and 62 deletions

View file

@ -239,7 +239,8 @@ uint8_t SpiritExplosiveLogic() {
* As we do not know which universe we are in until the player chooses one in-game,
we must be able to collect the check in both universes
* When an Age can no longer be kept out by conflicting universes, that age is said to have Certain Access to a region
* When an Age can no longer be kept out by conflicting universes, that age is said to have Certain Access to a
region
* If both ages have access to a region with a certain number of keys, but there is no Certain Access,
* then a check is only in logic if all possible universes can collect the check independently
@ -294,9 +295,8 @@ std::map<RandomizerRegion, SpiritLogicData> Region::spiritLogicData = {
*anyAge is equivalent to a self referencing Here, used for events and any check where that is relevent.
*/
bool SpiritShared(RandomizerRegion region, ConditionFn condition, bool anyAge,
RandomizerRegion otherRegion, ConditionFn otherCondition,
RandomizerRegion thirdRegion, ConditionFn thirdCondition){
bool SpiritShared(RandomizerRegion region, ConditionFn condition, bool anyAge, RandomizerRegion otherRegion,
ConditionFn otherCondition, RandomizerRegion thirdRegion, ConditionFn thirdCondition) {
SpiritLogicData curRegionData = Region::spiritLogicData[region];
bool result = false;
@ -308,17 +308,21 @@ bool SpiritShared(RandomizerRegion region, ConditionFn condition, bool anyAge,
// without opening the Statue room to Broken Wall Room lock first
logic->IsChild = true;
logic->IsAdult = false;
uint8_t childKeys = (logic->ReverseSpiritChild && logic->CanHitSwitch()/* && CanClimbHigh()*/) ? curRegionData.childReverseKeys : curRegionData.childKeys;
uint8_t childKeys = (logic->ReverseSpiritChild && logic->CanHitSwitch() /* && CanClimbHigh()*/)
? curRegionData.childReverseKeys
: curRegionData.childKeys;
// If we have enough keys that an age cannot be kept out, we have Certain Access
// otherwise if we have entered in reverse and can reach from the face, we have Certain Access
bool ChildCertainAccess = (logic->ReverseSpiritChild && curRegionData.reverseAccess()) || logic->SmallKeys(RR_SPIRIT_TEMPLE, childKeys);
bool ChildCertainAccess =
(logic->ReverseSpiritChild && curRegionData.reverseAccess()) || logic->SmallKeys(RR_SPIRIT_TEMPLE, childKeys);
// Switch back to adult to check adult access
logic->IsChild = false;
logic->IsAdult = true;
bool AdultCertainAccess = (logic->ReverseSpiritAdult && curRegionData.reverseAccess()) || logic->SmallKeys(RR_SPIRIT_TEMPLE, curRegionData.adultKeys);
bool AdultCertainAccess = (logic->ReverseSpiritAdult && curRegionData.reverseAccess()) ||
logic->SmallKeys(RR_SPIRIT_TEMPLE, curRegionData.adultKeys);
// If we are AnyAge and have any CeratinAccess, then we can check those ages
// we don't need to check ambiguity here as if this fails, then 1 of the ages has failed
if (anyAge && (ChildCertainAccess || AdultCertainAccess)) {
@ -339,13 +343,15 @@ bool SpiritShared(RandomizerRegion region, ConditionFn condition, bool anyAge,
// If we have Certain Access, we just run the condition.
// Otherwise, if we have the keys to know either age can reach, we need to see if we could reach as Adult
// and if needed, in reverse
if (!ChildCertainAccess && result && (!logic->IsReverseAccessPossible() || Region::spiritLogicData[otherRegion].reverseAccess())) {
if (!ChildCertainAccess && result &&
(!logic->IsReverseAccessPossible() || Region::spiritLogicData[otherRegion].reverseAccess())) {
// Switch to Adult
logic->IsChild = false;
logic->IsAdult = true;
// If Adult can get there and get the check, we can get the check in logic
// If reverse spirit is also possible, we need to make sure Adult can get it via reverse entry too
result = (curRegionData.adultAccess() && (!logic->IsReverseAccessPossible() || curRegionData.reverseAccess) && condition()) ||
result = (curRegionData.adultAccess() &&
(!logic->IsReverseAccessPossible() || curRegionData.reverseAccess) && condition()) ||
(otherRegion != RR_NONE &&
(Region::spiritLogicData[otherRegion].adultAccess() &&
(!logic->IsReverseAccessPossible() || Region::spiritLogicData[otherRegion].reverseAccess()) &&
@ -361,14 +367,16 @@ bool SpiritShared(RandomizerRegion region, ConditionFn condition, bool anyAge,
// Alternatively, if we have entered in reverse and can reach from the face, we have Certain Access
// Otherwise, if we have the keys to know either age can reach, we need to see if we could reach as Child
// and if needed, in reverse
if (!AdultCertainAccess && result && (!logic->IsReverseAccessPossible() || Region::spiritLogicData[otherRegion].reverseAccess)){
if (!AdultCertainAccess && result &&
(!logic->IsReverseAccessPossible() || Region::spiritLogicData[otherRegion].reverseAccess)) {
// Switch to Child
logic->IsChild = true;
logic->IsAdult = false;
// If Child can get there and get the check, we can get the check in logic
// If reverse spirit is also possible, we need to make sure Child can get it via reverse entry too
result = (curRegionData.childAccess() && (!logic->IsReverseAccessPossible() || curRegionData.reverseAccess()) && condition()) ||
result = (curRegionData.childAccess() &&
(!logic->IsReverseAccessPossible() || curRegionData.reverseAccess()) && condition()) ||
(otherRegion != RR_NONE &&
(Region::spiritLogicData[otherRegion].childAccess() &&
(!logic->IsReverseAccessPossible() || Region::spiritLogicData[otherRegion].reverseAccess()) &&

View file

@ -260,9 +260,10 @@ extern std::vector<EventAccess> grottoEvents;
bool Here(const RandomizerRegion region,
ConditionFn
condition); // RANDOTODO make a less stupid way to check own at either age than self referencing with this
bool SpiritShared(RandomizerRegion region, ConditionFn condition, bool anyAge = false,
RandomizerRegion otherRegion = RR_NONE, ConditionFn otherCondition = []{return false;},
RandomizerRegion thirdRegion = RR_NONE, ConditionFn thirdCondition = []{return false;});
bool SpiritShared(
RandomizerRegion region, ConditionFn condition, bool anyAge = false, RandomizerRegion otherRegion = RR_NONE,
ConditionFn otherCondition = [] { return false; }, RandomizerRegion thirdRegion = RR_NONE,
ConditionFn thirdCondition = [] { return false; });
bool CanPlantBean(const RandomizerRegion region);
bool BothAges(const RandomizerRegion region);
bool ChildCanAccess(const RandomizerRegion region);

View file

@ -2364,8 +2364,7 @@ void Logic::SetInLogic(LogicVal logicVal, bool value) {
bool Logic::IsReverseAccessPossible() {
return ctx->GetOption(RSK_SHUFFLE_BOSS_ENTRANCES) &&
(ctx->GetOption(RSK_DECOUPLED_ENTRANCES) ||
ctx->GetOption(RSK_MIX_BOSS_ENTRANCES));
(ctx->GetOption(RSK_DECOUPLED_ENTRANCES) || ctx->GetOption(RSK_MIX_BOSS_ENTRANCES));
}
bool Logic::SpiritBrokenWallToStatue() {
@ -2373,7 +2372,8 @@ bool Logic::SpiritBrokenWallToStatue() {
}
bool Logic::SpiritEastToSwitch() {
return (IsAdult && ctx->GetTrickOption(RT_SPIRIT_LOBBY_JUMP)) || CanUse(RG_HOVER_BOOTS) || (CanUse(RG_ZELDAS_LULLABY) && CanUse(RG_HOOKSHOT));
return (IsAdult && ctx->GetTrickOption(RT_SPIRIT_LOBBY_JUMP)) || CanUse(RG_HOVER_BOOTS) ||
(CanUse(RG_ZELDAS_LULLABY) && CanUse(RG_HOOKSHOT));
}
bool Logic::SpiritWestToSkull() {
@ -2383,7 +2383,9 @@ bool Logic::SpiritWestToSkull() {
bool Logic::SpiritSunBlockSouthLedge() {
return true /*str0 || IsAdult || CanKillEnemy(RE_BEAMOS) || BunnyHovers() ||
(CanUse(RG_HOOKSHOT) && (HasFireSource() ||
(SpiritSunBlockTorch && (logic->CanUse(STICKS) || (ctx->GetTrickOption(RT_SPIRIT_SUN_CHEST) && logic->CanUse(RG_FAIRY_BOW))))))*/;
(SpiritSunBlockTorch && (logic->CanUse(STICKS) ||
(ctx->GetTrickOption(RT_SPIRIT_SUN_CHEST) && logic->CanUse(RG_FAIRY_BOW))))))*/
;
}
// Combines crossing the ledge directly and the jump from the hand
@ -2396,7 +2398,8 @@ bool Logic::MQSpiritStatueToSunBlock() {
}
bool Logic::MQSpiritStatueSouthDoor() {
return HasFireSource() || (ctx->GetTrickOption(RT_SPIRIT_MQ_FROZEN_EYE) && CanUse(RG_FAIRY_BOW) && CanUse(RG_SONG_OF_TIME)/* && CanClimb()*/);
return HasFireSource() || (ctx->GetTrickOption(RT_SPIRIT_MQ_FROZEN_EYE) && CanUse(RG_FAIRY_BOW) &&
CanUse(RG_SONG_OF_TIME) /* && CanClimb()*/);
}
void Logic::Reset() {

View file

@ -26,7 +26,6 @@ enum class GlitchDifficulty {
HERO,
};
class Logic {
public:
bool noVariable = false;