Modified some logic functions to prepare for the LogicExpressions.

This commit is contained in:
Anthony Stewart 2025-06-13 19:42:44 -05:00 committed by xxAtrain223
commit 066cdbb1e6
5 changed files with 15 additions and 10 deletions

View file

@ -119,7 +119,7 @@ bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const {
return true; return true;
} }
bool CanBuyAnother(RandomizerCheck rc) { bool CanBuyCheck(RandomizerCheck rc) {
return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice()); return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice());
} }

View file

@ -12,7 +12,7 @@
#define TIME_PASSES true #define TIME_PASSES true
#define TIME_DOESNT_PASS false #define TIME_DOESNT_PASS false
typedef bool (*ConditionFn)(); using ConditionFn = std::function<bool()>;
// I hate this but every alternative I can think of right now is worse // I hate this but every alternative I can think of right now is worse
extern Rando::Context* ctx; extern Rando::Context* ctx;
@ -113,13 +113,20 @@ class LocationAccess {
}; };
bool CanBuyAnother(uint16_t price); bool CanBuyAnother(uint16_t price);
bool CanBuyAnother(RandomizerCheck rc); bool CanBuyCheck(RandomizerCheck rc);
namespace Rando { namespace Rando {
class Entrance; class Entrance;
enum class EntranceType; enum class EntranceType;
} // namespace Rando } // namespace Rando
enum class RegionAgeTime {
childDay,
childNight,
adultDay,
adultNight,
};
class Region { class Region {
public: public:
Region(); Region();

View file

@ -19,7 +19,7 @@ void RegionTable_Init_HauntedWasteland() {
//Events //Events
EVENT_ACCESS(FairyPot, true), EVENT_ACCESS(FairyPot, true),
EVENT_ACCESS(NutPot, 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 //Locations
LOCATION(RC_WASTELAND_CHEST, logic->HasFireSource()), LOCATION(RC_WASTELAND_CHEST, logic->HasFireSource()),

View file

@ -1366,14 +1366,13 @@ bool Logic::CanTriggerLACS() {
(ctx->LACSCondition() == RO_LACS_TOKENS && GetGSCount() >= ctx->GetOption(RSK_LACS_TOKEN_COUNT).Get()); (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) { bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless, uint8_t requiredAmountGlitched) {
if (HasItem(RG_SKELETON_KEY)) { if (HasItem(RG_SKELETON_KEY)) {
return true; return true;
} }
if (requiredAmountGlitched == 255) {
requiredAmountGlitched = requiredAmountGlitchless;
}
switch (dungeon) { switch (dungeon) {
case RR_FOREST_TEMPLE: case RR_FOREST_TEMPLE:
/*if (IsGlitched && (GetDifficultyValueFromString(GlitchHookshotJump_Boots) >= /*if (IsGlitched && (GetDifficultyValueFromString(GlitchHookshotJump_Boots) >=

View file

@ -194,8 +194,7 @@ class Logic {
bool HasItem(RandomizerGet itemName); bool HasItem(RandomizerGet itemName);
bool HasBossSoul(RandomizerGet itemName); bool HasBossSoul(RandomizerGet itemName);
bool CanOpenOverworldDoor(RandomizerGet itemName); bool CanOpenOverworldDoor(RandomizerGet itemName);
bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmount); bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless, uint8_t requiredAmountGlitched = 255);
bool SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless, uint8_t requiredAmountGlitched);
bool CanOpenUnderwaterChest(); bool CanOpenUnderwaterChest();
bool CanDoGlitch(GlitchType glitch); bool CanDoGlitch(GlitchType glitch);
bool CanEquipSwap(RandomizerGet itemName); bool CanEquipSwap(RandomizerGet itemName);