From 5ca9558dbf5bcc1e41c7aa23c82b19f6ebb34313 Mon Sep 17 00:00:00 2001 From: Nessy Date: Thu, 25 Jan 2024 22:16:23 +0000 Subject: [PATCH] Logic fixes --- source/dungeon.cpp | 4 ++++ source/fill.cpp | 11 ++++++----- source/item_location.cpp | 7 ++++++- source/item_pool.cpp | 1 + source/location_access.cpp | 38 +++++++++++++++++++------------------- source/logic.cpp | 2 +- 6 files changed, 37 insertions(+), 26 deletions(-) diff --git a/source/dungeon.cpp b/source/dungeon.cpp index 001e593..dcf09e7 100644 --- a/source/dungeon.cpp +++ b/source/dungeon.cpp @@ -352,6 +352,10 @@ std::vector DungeonInfo::GetEveryLocation() const { PF_INT_UPPER_CHEST, PF_INT_TANK_CHEST, PF_INT_INVISIBLE_SOLDIER, + PF_INT_HOOKSHOT_ROOM_ZORA_EGG, + PF_INT_GUARD_ROOM_ZORA_EGG, + PF_INT_BARREL_MAZE_ZORA_EGG, + PF_INT_LAVA_ROOM_ZORA_EGG, },{} ); DungeonInfo BeneathTheWell = DungeonInfo("Beneath The Well", NONE, NONE, NONE, NONE, 0, { diff --git a/source/fill.cpp b/source/fill.cpp index b50b254..5fcc221 100644 --- a/source/fill.cpp +++ b/source/fill.cpp @@ -132,7 +132,7 @@ std::vector GetAccessibleLocations(const std::vector& //if the exit is accessable and hasn't been added yet, add it to pool Area* exitArea = exit.GetConnectedRegion(); - if (!exitArea->addedToPool && exit.ConditionsMet()) { + if (!exitArea->addedToPool && exit.GetConditionsMet()) { exitArea->addedToPool = true; areaPool.push_back(exit.GetAreaKey()); //PlacementLog_Msg("Added :" + exitArea->regionName + " to the pool \n"); @@ -156,7 +156,7 @@ std::vector GetAccessibleLocations(const std::vector& LocationKey loc = locPair.GetLocation(); ItemLocation* location = Location(loc); - if ((!location->IsAddedToPool()) && (locPair.ConditionsMet())) { + if ((!location->IsAddedToPool()) && (locPair.GetConditionsMet())) { location->AddToPool(); @@ -195,7 +195,7 @@ std::vector GetAccessibleLocations(const std::vector& } } //MAJORA'S_MASK has been found, seed is beatable, nothing else in this or future spheres matters - else if (location->GetPlacedItemKey() == MAJORAS_MASK) { + if (location->GetPlacedItemKey() == MAJORAS_MASK) { CitraPrint("Majoras Mask has been found!"); itemSphere.clear(); itemSphere.push_back(loc); @@ -878,7 +878,7 @@ int Fill() { GeneratePlaythrough(); //TODO::FIX PLAYTHROUGH //Successful placement, produced beatable result - if (!placementFailure ) {//&& playthroughBeatable + if (!placementFailure && playthroughBeatable ) { printf("Done"); printf("\x1b[9;10HCalculating Playthrough..."); PareDownPlaythrough(); @@ -902,7 +902,8 @@ int Fill() { } //Unsuccessful placement if (retries < 4) { - GetAccessibleLocations(allLocations, SearchMode::AllLocationsReachable); + //LogicReset(); + //GetAccessibleLocations(allLocations, SearchMode::AllLocationsReachable); printf("\x1b[9;10HFailed. Retrying... %d", retries + 2); CitraPrint("Failed. Retrying..."); Areas::ResetAllLocations(); diff --git a/source/item_location.cpp b/source/item_location.cpp index 95ba12e..2b3f3c7 100644 --- a/source/item_location.cpp +++ b/source/item_location.cpp @@ -1111,7 +1111,7 @@ std::vector GetLocations(const std::vector& locationPo } void LocationReset() { - for (LocationKey il : allLocations) { +/*for (LocationKey il : allLocations) { Location(il)->RemoveFromPool(); } @@ -1121,6 +1121,11 @@ void LocationReset() { for (LocationKey il : gossipStoneLocations) { Location(il)->RemoveFromPool(); + }*/ + + // Something's still missing from allLocations, IDK what though and this fixes it + for (LocationKey il = LINKS_POCKET; il <= OSH_COLORED_SKULLS_POT; il++) { + Location(il)->RemoveFromPool(); } //Location(GANONDORF_HINT)->RemoveFromPool(); diff --git a/source/item_pool.cpp b/source/item_pool.cpp index 755b863..9091a42 100644 --- a/source/item_pool.cpp +++ b/source/item_pool.cpp @@ -491,6 +491,7 @@ std::array zoraEggs = { ZORA_EGG, ZORA_EGG, ZORA_EGG, + ZORA_EGG, }; std::array tingleMaps = { diff --git a/source/location_access.cpp b/source/location_access.cpp index 495fa0e..0f2d023 100644 --- a/source/location_access.cpp +++ b/source/location_access.cpp @@ -166,7 +166,7 @@ bool Area::CheckAllAccess(const AreaKey exitKey) { for(Entrance& exit: exits) { if(exit.GetAreaKey() == exitKey) { - exit.ConditionsMet(); + exit.GetConditionsMet(); } } return false; @@ -229,8 +229,8 @@ void AreaTable_Init() { LocationAccess(N_CLOCK_TOWN_KEATON_QUIZ, {[] {return KeatonMask;}}), LocationAccess(N_CLOCK_TOWN_TREE, {[] {return true;}}), LocationAccess(N_CLOCK_TOWN_OLD_LADY, {[] {return Fighting || Bow;}}), - LocationAccess(TINGLE_N_CLOCK_TOWN_CT, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_N_CLOCK_TOWN_WF, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), + LocationAccess(TINGLE_N_CLOCK_TOWN_CT, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_N_CLOCK_TOWN_WF, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), LocationAccess(N_CLOCK_TOWN_POSTBOX, {[]{return PostmansHat;}}), }, @@ -328,7 +328,7 @@ void AreaTable_Init() { { //Locations LocationAccess(STOCKPOTINN_MIDNIGHT_MEETING, {[] {return KafeisMask && (DekuMask || RoomKey);}}), - LocationAccess(STOCKPOTINN_ANJU_AND_KAFEI, {[] {return KafeisMask && LetterKafei && PendantOfMemories && SunMask;}}), + LocationAccess(STOCKPOTINN_ANJU_AND_KAFEI, {[] {return KafeisMask && LetterKafei && PendantAccess && SunMask;}}), LocationAccess(STOCKPOTINN_STAFF_ROOM_CHEST, {[] {return true;}}),//Day 3? }, { @@ -769,8 +769,8 @@ void AreaTable_Init() { { //Locations LocationAccess(ROAD_TO_SS_TREE, {[] {return DekuMask && (MagicMeter || Bow || Hookshot || ZoraMask);}}),//something to kill the dragonfly - LocationAccess(TINGLE_ROAD_TO_SS_WF, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_ROAD_TO_SS_SH, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), + LocationAccess(TINGLE_ROAD_TO_SS_WF, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_ROAD_TO_SS_SH, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), //Gossip Stones LocationAccess(ROAD_TO_SS_GOSSIP, {[] {return true;}}), }, @@ -1086,10 +1086,10 @@ void AreaTable_Init() { //Locations LocationAccess(TWIN_ISLANDS_UNDERWATER_RAMP_CHEST, {[] {return SnowheadClear && ZoraMask;}}), LocationAccess(TWIN_ISLANDS_CAVE_CHEST, {[] {return SnowheadClear && ZoraMask;}}), - LocationAccess(TINGLE_TWIN_ISLANDS_SH, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_TWIN_ISLANDS_RR, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_TWIN_ISLANDS_SH_SPRING, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_TWIN_ISLANDS_RR_SPRING, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), + LocationAccess(TINGLE_TWIN_ISLANDS_SH, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_TWIN_ISLANDS_RR, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_TWIN_ISLANDS_SH_SPRING, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_TWIN_ISLANDS_RR_SPRING, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), }, { //Exits @@ -1257,8 +1257,8 @@ void AreaTable_Init() { }, { //Locations - LocationAccess(TINGLE_MILK_ROAD_RR, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_MILK_ROAD_GB, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), + LocationAccess(TINGLE_MILK_ROAD_RR, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_MILK_ROAD_GB, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), LocationAccess(MILK_ROAD_KEATON_QUIZ, {[] {return KeatonMask;}}), //Gossip Stones LocationAccess(MR_GOSSIP, {[] {return true;}}), @@ -1369,8 +1369,8 @@ void AreaTable_Init() { LocationAccess(GBC_FISHERMAN_GAME, {[] {return GreatBayClear && Hookshot;}}), LocationAccess(GBC_LEDGE, {[] {return Hookshot && MagicBean && AnyBottle;}}), LocationAccess(GBC_MIKAU, {[] {return CanPlay(SongOfHealing);}}), - LocationAccess(TINGLE_GBC_GB, {[]{ return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_GBC_ST, {[]{ return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), + LocationAccess(TINGLE_GBC_GB, {[]{ return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_GBC_ST, {[]{ return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), //Gossip Stones LocationAccess(GBC_BENEATH_COW_GROTTO_GOSSIP, {[] {return true;}}), LocationAccess(GBC_OUTSIDE_FORTRESS_GOSSIP, {[] {return true;}}), @@ -1758,7 +1758,7 @@ void AreaTable_Init() { areaTable[IKANA_CANYON] = Area("Lower Ikana Canyon", "Lower Ikana Canyon", IKANA_CANYON, { //Events - EventAccess(&EnterSakonHideout, {[]{return LetterKafei && PendantOfMemories && KafeisMask;}}),//probably missing a req + EventAccess(&EnterSakonHideout, {[]{return LetterKafei && PendantAccess && KafeisMask;}}),//probably missing a req }, { //Locations @@ -1773,7 +1773,7 @@ void AreaTable_Init() { //Exits Entrance(ROAD_TO_IKANA, {[]{return true;}}), Entrance(SAKONS_HIDEOUT, {[]{return EnterSakonHideout;}}), - Entrance(SECRET_SHRINE, {[]{return true;}}), //slow swim but don't NEED zora mask + Entrance(SECRET_SHRINE_ENTRANCE, {[]{return true;}}), //slow swim but don't NEED zora mask Entrance(IKANA_CANYON_SECRET_SHRINE_GROTTO, {[]{return true;}}), Entrance(SOUTHERN_SWAMP, {[]{return true;}}),//end of river Entrance(IKANA_CANYON_UPPER, {[]{return IceArrows && MagicMeter && Bow && Hookshot;}}), @@ -1784,8 +1784,8 @@ void AreaTable_Init() { }, { //Locations - LocationAccess(TINGLE_IKANA_CANYON_ST, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), - LocationAccess(TINGLE_IKANA_CANYON_CT, {[]{return (ProgressiveMagic = 0) || ( (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask );}}), + LocationAccess(TINGLE_IKANA_CANYON_ST, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), + LocationAccess(TINGLE_IKANA_CANYON_CT, {[]{return (DekuMask && MagicMeter) || Bow || Hookshot || ZoraMask;}}), //Gossip Stones LocationAccess(IC_SPIRIT_HOUSE_GOSSIP, {[] {return true;}}), }, @@ -2628,7 +2628,7 @@ void AreaTable_Init() { }, { //Locations - LocationAccess(GBT_SF_WATERWHEEL_ROOM_LOWER, {[] {return Hookshot && ZoraMask && GBTReverseWaterDirection;}}), + LocationAccess(GBT_SF_WATERWHEEL_ROOM_LOWER, {[] {return Hookshot && ZoraMask && ReverseWaterFlow;}}), LocationAccess(GBT_SF_WATERWHEEL_ROOM_UPPER, {[] {return ZoraMask && Hookshot && Bow && MagicMeter && IceArrows;}}), }, { diff --git a/source/logic.cpp b/source/logic.cpp index bec57e3..f86f36e 100644 --- a/source/logic.cpp +++ b/source/logic.cpp @@ -428,7 +428,7 @@ namespace Logic { } bool TotalHeartContainers(u8 requiredAmount) { - return (HeartContainers + (PiecesOfHeart/4) >= requiredAmount); + return (HeartContainers + (PiecesOfHeart/4) + 3 >= requiredAmount); } u8 TotalMaskCount() {