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);
}
bool SpiritExplosiveLogic(){
bool SpiritExplosiveLogic() {
return logic->HasExplosives() ? 1 : ctx->GetOption(RSK_BOMBCHU_BAG) && logic->BombchuRefill() ? 2 : 3;
}
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) {
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) {
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) {

View file

@ -234,40 +234,43 @@ class Region {
/*
* 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.
* In the first universe, the player enters spirit as child, and spends as many keys as they can to lock adult out
* In the second, they enter as adult and spend as many keys as they can to lock child out.
* When an Age can no longer be kept out by the other age, 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 both ages can collect the check independently
* If an age has Certain Access then that age can collect checks alone,
* and there is no reason to check the other age untile the universes converge.
* The universes converge when the player has all the keys, giving both ages Certain Access.
* We must check for these universes manually as we allow technical access with minimum keys for
* 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){
//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)) {
bool SpiritShared(ConditionFn condition, ConditionFn childAccess, ConditionFn adultAccess, uint8_t adultKeys,
uint8_t childKeys, uint8_t eitherKeys, bool anyAge = false) {
// 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) {
return Here(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) {
bool result = condition();
//if we have enough keys to have Certain Access, we just run the condition
if (logic->SmallKeys(RR_SPIRIT_TEMPLE, childKeys)){
// if we have enough keys to have Certain Access, we just run the condition
if (logic->SmallKeys(RR_SPIRIT_TEMPLE, childKeys)) {
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) {
// store current age variables
bool pastAdult = logic->IsAdult;
@ -285,10 +288,10 @@ class Region {
}
} else if (Adult() && logic->IsAdult) {
bool result = condition();
//if we have enough keys to have Certain Access, we just run the condition
if (logic->SmallKeys(RR_SPIRIT_TEMPLE, adultKeys)){
// if we have enough keys to have Certain Access, we just run the condition
if (logic->SmallKeys(RR_SPIRIT_TEMPLE, adultKeys)) {
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) {
// store current age variables
bool pastAdult = logic->IsAdult;