From 2f0b40416bf246e49e63e21ddae1f2f043fc50aa Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Mon, 25 Nov 2024 22:35:18 +0700 Subject: [PATCH] Use Sitrus Berry effect in battle The one that was committed earlier only applies when administering it using the party menu since it's a reg'o item effect and not a held item effect... it's handled differently, it turns out --- engine/battle/effect_commands.asm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 77fa151e2..ce80e4661 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -6526,6 +6526,9 @@ GetItemHeldEffect: and a ret z + cp SITRUS_BERRY + jr z, .SitrusBerry + push hl ld hl, ItemAttributes + ITEMATTR_EFFECT dec a @@ -6540,6 +6543,30 @@ GetItemHeldEffect: pop hl ret +.SitrusBerry: +; copy of GetMaxHP then GetQuarterMaxHP + push hl +; get which max HP is to be used +; at the point of healing, the battle turn +; has already switched, so use the opposite +; MaxHP variables... + ld hl, wEnemyMonMaxHP + ldh a, [hBattleTurn] + and a + jr z, .got_max_hp + ld hl, wBattleMonMaxHP +.got_max_hp + inc hl + ld a, [hl] + pop hl + ld c, a +; quarter result + srl c + srl c +; fixed effect + ld b, HELD_BERRY + ret + AnimateCurrentMoveEitherSide: push hl push de