From 1b63f4ca1ac24422d7b77bea40f710353e4c4ee5 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Thu, 20 Apr 2023 21:00:00 -0400 Subject: [PATCH] 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. --- soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 011dbc1df..ea41a2e69 100644 --- a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -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) {