From 469fdde69be3fe2e2e5883b9c8de29e8eb3c2f87 Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Sun, 10 Nov 2024 20:49:45 +0700 Subject: [PATCH] Use Gen 4 effect for Sitrus Berry --- data/items/descriptions.asm | 2 +- data/items/heal_hp.asm | 1 - engine/items/item_effects.asm | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/data/items/descriptions.asm b/data/items/descriptions.asm index fcd44ee30..43716e146 100644 --- a/data/items/descriptions.asm +++ b/data/items/descriptions.asm @@ -927,7 +927,7 @@ OranBerryDesc: SitrusBerryDesc: db "A self-restore" - next "item. (30HP, HOLD)@" + next "item. (HOLD)@" SquirtBottleDesc: db "A bottle used for" diff --git a/data/items/heal_hp.asm b/data/items/heal_hp.asm index 71c08e426..eeac6c281 100644 --- a/data/items/heal_hp.asm +++ b/data/items/heal_hp.asm @@ -9,7 +9,6 @@ HealingHPAmounts: dbw FULL_RESTORE, MAX_STAT_VALUE dbw MOOMOO_MILK, 100 dbw ORAN_BERRY, 10 - dbw SITRUS_BERRY, 30 dbw ENERGYPOWDER, 50 dbw ENERGY_ROOT, 200 dbw RAGECANDYBAR, 20 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index f9291dde2..18832f172 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1966,6 +1966,25 @@ LoadHPFromBuffer1: ld e, a ret +GetOneFourthMaxHP: + push bc + ld a, MON_MAXHP + call GetPartyParamLocation + ld a, [hli] + ldh [hDividend + 0], a + ld a, [hl] + ldh [hDividend + 1], a + ld a, 4 + ldh [hDivisor], a + ld b, 2 + call Divide + ldh a, [hQuotient + 2] + ld d, a + ldh a, [hQuotient + 3] + ld e, a + pop bc + ret + GetOneFifthMaxHP: push bc ld a, MON_MAXHP @@ -1988,6 +2007,8 @@ GetOneFifthMaxHP: GetHealingItemAmount: push hl ld a, [wCurItem] + cp SITRUS_BERRY + jr z, .SitrusBerry ld hl, HealingHPAmounts ld d, a .next @@ -2009,6 +2030,12 @@ GetHealingItemAmount: pop hl ret +.SitrusBerry: +; use Gen 4 effect (25% max HP) + call GetOneFourthMaxHP + pop hl + ret + INCLUDE "data/items/heal_hp.asm" Softboiled_MilkDrinkFunction: