Skip to content

Commit

Permalink
Fix big poe bottle logic (HarbourMasters#4837)
Browse files Browse the repository at this point in the history
* fix big poe logic

* oops
  • Loading branch information
Pepper0ni authored Jan 15, 2025
1 parent d3c619e commit 95a4e1c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/3drando/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static void ApplyAllAdvancmentItems(){
static void ValidateSphereZero(GetAccessibleLocationsStruct& gals){
auto ctx = Rando::Context::GetInstance();
// Condition for verifying everything required for sphere 0, expanding search to all locations
if (logic->CanEmptyBigPoes && gals.validatedStartingRegion && gals.foundTempleOfTime && gals.haveTimeAccess) {
if (logic->CouldEmptyBigPoes && gals.validatedStartingRegion && gals.foundTempleOfTime && gals.haveTimeAccess) {
// Apply all items that are necessary for checking all location access
ApplyAllAdvancmentItems();
// Reset access as the non-starting age
Expand Down Expand Up @@ -565,7 +565,7 @@ void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAcce

ctx->allLocationsReachable = false;
if (checkPoeCollectorAccess){
logic->CanEmptyBigPoes = false;
logic->CouldEmptyBigPoes = false;
}

if (checkOtherEntranceAccess){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ void RegionTable_Init_Market() {

areaTable[RR_MARKET_GUARD_HOUSE] = Region("Market Guard House", "Market Guard House", {}, NO_DAY_NIGHT_CYCLE, {
//Events
EventAccess(&logic->CanEmptyBigPoes, []{return logic->IsAdult;}),
EventAccess(&logic->CouldEmptyBigPoes, []{return logic->IsAdult;}),
EventAccess(&logic->CanEmptyBigPoes, []{return logic->IsAdult;}),
}, {
//Locations
LOCATION(RC_MARKET_10_BIG_POES, logic->IsAdult && logic->BigPoeKill),
Expand Down
27 changes: 20 additions & 7 deletions soh/soh/Enhancements/randomizer/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,13 +880,26 @@ namespace Rando {

uint8_t Logic::BottleCount() {
uint8_t count = 0;
if (!CanEmptyBigPoes){
return 0;
}
for (int i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_4; i++) {
uint8_t item = GetSaveContext()->inventory.items[i];
if (item != ITEM_NONE && (item != ITEM_LETTER_RUTO || (item == ITEM_LETTER_RUTO && DeliverLetter))) {
count++;
if (CouldEmptyBigPoes){
for (int i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_4; i++) {
uint8_t item = GetSaveContext()->inventory.items[i];
switch (item) {
case ITEM_LETTER_RUTO:
if (DeliverLetter) {
count++;
}
break;
case ITEM_BIG_POE:
if (CanEmptyBigPoes) {
count++;
}
break;
case ITEM_NONE:
break;
default:
count++;
break;
}
}
}
return count;
Expand Down
5 changes: 4 additions & 1 deletion soh/soh/Enhancements/randomizer/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ class Logic {
// Bottle Count
uint8_t Bottles = 0;
uint8_t NumBottles = 0;
bool CanEmptyBigPoes = true;
//this event covers if the player can currently empty big poes in logic
bool CanEmptyBigPoes = false;
//this check covers if the generation has confirmed that it's possible to empty big poes if needed as adult
bool CouldEmptyBigPoes = true;

// Drops and Bottle Contents Access
bool NutPot = false;
Expand Down

0 comments on commit 95a4e1c

Please sign in to comment.