Skip to content

Commit

Permalink
Logic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto-Nessy committed Jan 25, 2024
1 parent c84df7f commit 5ca9558
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 26 deletions.
4 changes: 4 additions & 0 deletions source/dungeon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ std::vector<LocationKey> 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, {
Expand Down
11 changes: 6 additions & 5 deletions source/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ std::vector<LocationKey> GetAccessibleLocations(const std::vector<LocationKey>&

//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");
Expand All @@ -156,7 +156,7 @@ std::vector<LocationKey> GetAccessibleLocations(const std::vector<LocationKey>&
LocationKey loc = locPair.GetLocation();
ItemLocation* location = Location(loc);

if ((!location->IsAddedToPool()) && (locPair.ConditionsMet())) {
if ((!location->IsAddedToPool()) && (locPair.GetConditionsMet())) {

location->AddToPool();

Expand Down Expand Up @@ -195,7 +195,7 @@ std::vector<LocationKey> GetAccessibleLocations(const std::vector<LocationKey>&
}
}
//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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
7 changes: 6 additions & 1 deletion source/item_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ std::vector<LocationKey> GetLocations(const std::vector<LocationKey>& locationPo
}

void LocationReset() {
for (LocationKey il : allLocations) {
/*for (LocationKey il : allLocations) {
Location(il)->RemoveFromPool();
}
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions source/item_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ std::array<ItemKey, 7> zoraEggs = {
ZORA_EGG,
ZORA_EGG,
ZORA_EGG,
ZORA_EGG,
};

std::array<ItemKey, 6> tingleMaps = {
Expand Down
38 changes: 19 additions & 19 deletions source/location_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool Area::CheckAllAccess(const AreaKey exitKey) {

for(Entrance& exit: exits) {
if(exit.GetAreaKey() == exitKey) {
exit.ConditionsMet();
exit.GetConditionsMet();
}
}
return false;
Expand Down Expand Up @@ -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;}}),

},
Expand Down Expand Up @@ -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?
},
{
Expand Down Expand Up @@ -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;}}),
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;}}),
Expand Down Expand Up @@ -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;}}),
Expand Down Expand Up @@ -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
Expand All @@ -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;}}),
Expand All @@ -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;}}),
},
Expand Down Expand Up @@ -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;}}),
},
{
Expand Down
2 changes: 1 addition & 1 deletion source/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ namespace Logic {
}

bool TotalHeartContainers(u8 requiredAmount) {
return (HeartContainers + (PiecesOfHeart/4) >= requiredAmount);
return (HeartContainers + (PiecesOfHeart/4) + 3 >= requiredAmount);
}

u8 TotalMaskCount() {
Expand Down

0 comments on commit 5ca9558

Please sign in to comment.