diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 6596f2591..7048d579f 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -119,7 +119,7 @@ bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const { return true; } -bool CanBuyAnother(RandomizerCheck rc) { +bool CanBuyCheck(RandomizerCheck rc) { return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice()); } diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 9fabde876..9fd59fe64 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -12,7 +12,7 @@ #define TIME_PASSES true #define TIME_DOESNT_PASS false -typedef bool (*ConditionFn)(); +using ConditionFn = std::function; // I hate this but every alternative I can think of right now is worse extern Rando::Context* ctx; @@ -113,13 +113,20 @@ class LocationAccess { }; bool CanBuyAnother(uint16_t price); -bool CanBuyAnother(RandomizerCheck rc); +bool CanBuyCheck(RandomizerCheck rc); namespace Rando { class Entrance; enum class EntranceType; } // namespace Rando +enum class RegionAgeTime { + childDay, + childNight, + adultDay, + adultNight, +}; + class Region { public: Region(); diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/haunted_wasteland.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/haunted_wasteland.cpp index 2583342ac..c3ccae4bb 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/haunted_wasteland.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/haunted_wasteland.cpp @@ -19,7 +19,7 @@ void RegionTable_Init_HauntedWasteland() { //Events EVENT_ACCESS(FairyPot, true), EVENT_ACCESS(NutPot, true), - EVENT_ACCESS(CarpetMerchant, logic->HasItem(RG_ADULT_WALLET) && CanBuyAnother(RC_WASTELAND_BOMBCHU_SALESMAN) && (logic->CanJumpslash() || logic->CanUse(RG_HOVER_BOOTS))), + EVENT_ACCESS(CarpetMerchant, logic->HasItem(RG_ADULT_WALLET) && CanBuyCheck(RC_WASTELAND_BOMBCHU_SALESMAN) && (logic->CanJumpslash() || logic->CanUse(RG_HOVER_BOOTS))), }, { //Locations LOCATION(RC_WASTELAND_CHEST, logic->HasFireSource()), diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index eea79e92d..767909466 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -1366,14 +1366,13 @@ bool Logic::CanTriggerLACS() { (ctx->LACSCondition() == RO_LACS_TOKENS && GetGSCount() >= ctx->GetOption(RSK_LACS_TOKEN_COUNT).Get()); } -bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmount) { - return SmallKeys(dungeon, requiredAmount, requiredAmount); -} - bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless, uint8_t requiredAmountGlitched) { if (HasItem(RG_SKELETON_KEY)) { return true; } + if (requiredAmountGlitched == 255) { + requiredAmountGlitched = requiredAmountGlitchless; + } switch (dungeon) { case RR_FOREST_TEMPLE: /*if (IsGlitched && (GetDifficultyValueFromString(GlitchHookshotJump_Boots) >= diff --git a/soh/soh/Enhancements/randomizer/logic.h b/soh/soh/Enhancements/randomizer/logic.h index 2bfea75e9..bf1aa2144 100644 --- a/soh/soh/Enhancements/randomizer/logic.h +++ b/soh/soh/Enhancements/randomizer/logic.h @@ -194,8 +194,7 @@ class Logic { bool HasItem(RandomizerGet itemName); bool HasBossSoul(RandomizerGet itemName); bool CanOpenOverworldDoor(RandomizerGet itemName); - bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmount); - bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless, uint8_t requiredAmountGlitched); + bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless, uint8_t requiredAmountGlitched = 255); bool CanOpenUnderwaterChest(); bool CanDoGlitch(GlitchType glitch); bool CanEquipSwap(RandomizerGet itemName);