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;
}
bool CanBuyAnother(RandomizerCheck rc) {
bool CanBuyCheck(RandomizerCheck rc) {
return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice());
}

View file

@ -12,7 +12,7 @@
#define TIME_PASSES true
#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
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();

View file

@ -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()),

View file

@ -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) >=

View file

@ -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);