This commit is contained in:
Pepper0ni 2025-04-12 23:31:39 +01:00
commit 2c95403c0f
2 changed files with 25 additions and 19 deletions

View file

@ -210,20 +210,23 @@ bool Here(const RandomizerRegion region, ConditionFn condition) {
return areaTable[region].Here(condition); return areaTable[region].Here(condition);
} }
bool SpiritExplosiveLogic(){ bool SpiritExplosiveLogic() {
return logic->HasExplosives() ? 1 : ctx->GetOption(RSK_BOMBCHU_BAG) && logic->BombchuRefill() ? 2 : 3; return logic->HasExplosives() ? 1 : ctx->GetOption(RSK_BOMBCHU_BAG) && logic->BombchuRefill() ? 2 : 3;
} }
bool SpiritSharedStatueRoom(const RandomizerRegion region, ConditionFn condition, bool anyAge) { bool SpiritSharedStatueRoom(const RandomizerRegion region, ConditionFn condition, bool anyAge) {
return areaTable[region].SpiritShared(condition, []{return logic->HasExplosives();}, []{return true;}, 5, 3, SpiritExplosiveLogic(), anyAge); return areaTable[region].SpiritShared(
condition, [] { return logic->HasExplosives(); }, [] { return true; }, 5, 3, SpiritExplosiveLogic(), anyAge);
} }
bool MQSpiritSharedStatueRoom(const RandomizerRegion region, ConditionFn condition, bool anyAge) { bool MQSpiritSharedStatueRoom(const RandomizerRegion region, ConditionFn condition, bool anyAge) {
return areaTable[region].SpiritShared(condition, []{return true;}, []{return true;}, 7, 0, 0, anyAge); return areaTable[region].SpiritShared(
condition, [] { return true; }, [] { return true; }, 7, 0, 0, anyAge);
} }
bool MQSpiritSharedBrokenWallRoom(const RandomizerRegion region, ConditionFn condition, bool anyAge) { bool MQSpiritSharedBrokenWallRoom(const RandomizerRegion region, ConditionFn condition, bool anyAge) {
return areaTable[region].SpiritShared(condition, []{return true;}, []{return true;}, 7, 7, 6, anyAge); return areaTable[region].SpiritShared(
condition, [] { return true; }, [] { return true; }, 7, 7, 6, anyAge);
} }
bool BeanPlanted(const RandomizerRegion region) { bool BeanPlanted(const RandomizerRegion region) {

View file

@ -234,7 +234,8 @@ class Region {
/* /*
* This logic covers checks that exist in the shared areas of Spirit from a glitchless standpoint. * This logic covers checks that exist in the shared areas of Spirit from a glitchless standpoint.
* This code will fail if any glitch allows Adult to go in the Child spirit door first or vice versa as it relies on specific ages * This code will fail if any glitch allows Adult to go in the Child spirit door first or vice versa as it relies on
specific ages
* There are 4 possibilities for passing a check, but first I have to talk about parallel universes. * There are 4 possibilities for passing a check, but first I have to talk about parallel universes.
@ -254,20 +255,22 @@ class Region {
* technical reasons as otherwise the code will never run * technical reasons as otherwise the code will never run
*/ */
bool SpiritShared(ConditionFn condition, ConditionFn childAccess, ConditionFn adultAccess, uint8_t adultKeys, uint8_t childKeys, uint8_t eitherKeys, bool anyAge = false){ bool SpiritShared(ConditionFn condition, ConditionFn childAccess, ConditionFn adultAccess, uint8_t adultKeys,
//If we have all of the keys, we know that access is Certain Access uint8_t childKeys, uint8_t eitherKeys, bool anyAge = false) {
if (ctx->GetDungeon(Rando::SPIRIT_TEMPLE)->IsMQ() ? logic->SmallKeys(RR_SPIRIT_TEMPLE, 7) : logic->SmallKeys(RR_SPIRIT_TEMPLE, 5)) { // If we have all of the keys, we know that access is Certain Access
if (ctx->GetDungeon(Rando::SPIRIT_TEMPLE)->IsMQ() ? logic->SmallKeys(RR_SPIRIT_TEMPLE, 7)
: logic->SmallKeys(RR_SPIRIT_TEMPLE, 5)) {
if (anyAge) { if (anyAge) {
return Here(condition); return Here(condition);
} }
return condition(); return condition();
// otherwise, we have to check the current age and... // otherwise, we have to check the current age and...
} else if (Child() && logic->IsChild) { } else if (Child() && logic->IsChild) {
bool result = condition(); bool result = condition();
//if we have enough keys to have Certain Access, we just run the condition // if we have enough keys to have Certain Access, we just run the condition
if (logic->SmallKeys(RR_SPIRIT_TEMPLE, childKeys)){ if (logic->SmallKeys(RR_SPIRIT_TEMPLE, childKeys)) {
return result; return result;
//otherwise we need to check both ages if we have enough keys that either can get there // otherwise we need to check both ages if we have enough keys that either can get there
} else if (result && logic->SmallKeys(RR_SPIRIT_TEMPLE, eitherKeys) && adultAccess) { } else if (result && logic->SmallKeys(RR_SPIRIT_TEMPLE, eitherKeys) && adultAccess) {
// store current age variables // store current age variables
bool pastAdult = logic->IsAdult; bool pastAdult = logic->IsAdult;
@ -285,10 +288,10 @@ class Region {
} }
} else if (Adult() && logic->IsAdult) { } else if (Adult() && logic->IsAdult) {
bool result = condition(); bool result = condition();
//if we have enough keys to have Certain Access, we just run the condition // if we have enough keys to have Certain Access, we just run the condition
if (logic->SmallKeys(RR_SPIRIT_TEMPLE, adultKeys)){ if (logic->SmallKeys(RR_SPIRIT_TEMPLE, adultKeys)) {
return result; return result;
//otherwise we need to check both ages // otherwise we need to check both ages
} else if (result && logic->SmallKeys(RR_SPIRIT_TEMPLE, eitherKeys) && childAccess) { } else if (result && logic->SmallKeys(RR_SPIRIT_TEMPLE, eitherKeys) && childAccess) {
// store current age variables // store current age variables
bool pastAdult = logic->IsAdult; bool pastAdult = logic->IsAdult;