Tweak: Shopsanity Heart Pieces and Containers now refill Link's health (#2724)

Heart Pieces and Heart Containers normally refill Links health when the text box with their respective textID is closed.
However, with shops and shopsanity, after receiving the heart piece, the textbox isn't actually closed. The shop keeper keeps it open to prompt the player if they want to continue shopping. This prevents the health refill logic from running.

This PR adds a check for these items in the BuyEvent for randomizer items and manually refills Links health.
This commit is contained in:
Adam Bird 2023-04-20 21:00:00 -04:00 committed by GitHub
parent 7d20509b5b
commit 1b63f4ca1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1071,6 +1071,14 @@ void EnGirlA_BuyEvent_Randomizer(PlayState* play, EnGirlA* this) {
gSaveContext.pendingSaleMod = getItemEntry.modIndex;
Flags_SetRandomizerInf(shopItemIdentity.randomizerInf);
Rupees_ChangeBy(-this->basePrice);
// Heart Pieces and Heart Containers refill Links health when the text box is closed on their text IDs.
// In Shopsanity the textbox does not close, as the shop keeper continues the text bos asking to buy more.
// So here we detect when a Heart Piece/Container is granted to refil Links health manually
if (getItemEntry.itemId == ITEM_HEART_PIECE || getItemEntry.itemId == ITEM_HEART_PIECE_2 ||
getItemEntry.itemId == ITEM_HEART_CONTAINER) {
gSaveContext.healthAccumulator = 0x140; // Refill 20 hearts
}
}
void EnGirlA_Noop(EnGirlA* this, PlayState* play) {