fix granny not checking for bottle properly (#3068)

This commit is contained in:
Adam Bird 2023-07-23 18:13:51 -04:00 committed by GitHub
parent 93ab9f0072
commit 855e7442ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 14 deletions

View File

@ -3973,7 +3973,10 @@ void RandomizerSettingsWindow::DrawElement() {
"A Giant's Knife and a pack of Bombchus will be added to the item pool, and "
"one of the bottles will contain a Blue Potion.\n\n"
"On (no hints) - Salesmen will be included but won't tell you what you'll get.\n"
"On (with hints) - Salesmen will be included and you'll know what you're buying."
"On (with hints) - Salesmen will be included and you'll know what you're buying.\n"
"\n"
"Granny's item will only be offered after you have traded in the Odd Mushroom when Shuffle Adult Trade is on. "
"Otherwise when off, you will need to have found the Claim Check to buy her item (simulating the trade quest is complete)."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleMerchants", randoShuffleMerchants, RO_SHUFFLE_MERCHANTS_OFF);

View File

@ -174,11 +174,20 @@ void EnDs_OfferOddPotion(EnDs* this, PlayState* play) {
}
}
u8 EnDs_RandoCanGetGrannyItem() {
return gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF &&
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP) &&
// Traded odd mushroom when adult trade is on
((Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) && (gSaveContext.itemGetInf[3] & 1)) ||
// Found claim check when adult trade is off
(!Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) &&
INV_CONTENT(ITEM_CLAIM_CHECK) == ITEM_CLAIM_CHECK));
}
s32 EnDs_CheckRupeesAndBottle() {
if (gSaveContext.rupees < 100) {
return 0;
} else if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF &&
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP)) {
} else if (EnDs_RandoCanGetGrannyItem()) { // Allow buying the rando item regardless of having a bottle
return 2;
} else if (Inventory_HasEmptyBottle() == 0) {
return 1;
@ -189,18 +198,14 @@ s32 EnDs_CheckRupeesAndBottle() {
void EnDs_GiveBluePotion(EnDs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF &&
(Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) || INV_CONTENT(ITEM_CLAIM_CHECK) == ITEM_CLAIM_CHECK) &&
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP)) {
if (EnDs_RandoCanGetGrannyItem()) {
Flags_SetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP);
}
this->actor.parent = NULL;
this->actionFunc = EnDs_Talk;
} else {
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF &&
(Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) || INV_CONTENT(ITEM_CLAIM_CHECK) == ITEM_CLAIM_CHECK) &&
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP)) {
if (EnDs_RandoCanGetGrannyItem()) {
GetItemEntry entry = Randomizer_GetItemFromKnownCheck(RC_KAK_GRANNYS_SHOP, GI_POTION_BLUE);
GiveItemEntryFromActor(&this->actor, play, entry, 10000.0f, 50.0f);
} else {
@ -226,9 +231,7 @@ void EnDs_OfferBluePotion(EnDs* this, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_WILL_TALK;
GetItemEntry itemEntry;
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF &&
(Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) || INV_CONTENT(ITEM_CLAIM_CHECK) == ITEM_CLAIM_CHECK) &&
!Flags_GetRandomizerInf(RAND_INF_MERCHANTS_GRANNYS_SHOP)) {
if (EnDs_RandoCanGetGrannyItem()) {
itemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_GRANNYS_SHOP, GI_POTION_BLUE);
GiveItemEntryFromActor(&this->actor, play, itemEntry, 10000.0f, 50.0f);
} else {
@ -258,8 +261,10 @@ void EnDs_Wait(EnDs* this, PlayState* play) {
Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
player->actor.textId = 0x504A;
this->actionFunc = EnDs_OfferOddPotion;
} else if ((gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) == RO_GENERIC_OFF) ||
gSaveContext.itemGetInf[3] & 1) {
} else if (
// Always offer blue potion when adult trade is off
(gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) == RO_GENERIC_OFF) ||
gSaveContext.itemGetInf[3] & 1) { // Traded odd mushroom
player->actor.textId = 0x500C;
this->actionFunc = EnDs_OfferBluePotion;
} else {