From 8168dd7be9c283222c2311fe03eca27ce9876550 Mon Sep 17 00:00:00 2001 From: kleeenexfeu <94004034+kleeenexfeu@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:21:30 +0200 Subject: [PATCH] Shed tail rounds up, not down (#4913) * Shed tail rounds up, not down * Label --- src/battle_script_commands.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 29737bde1f..5d064c5f9c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12608,9 +12608,14 @@ static void Cmd_setsubstitute(void) CMD_ARGS(); u32 factor = gMovesInfo[gCurrentMove].effect == EFFECT_SHED_TAIL ? 2 : 4; - u32 hp = GetNonDynamaxMaxHP(gBattlerAttacker) / factor; + u32 hp; - if (GetNonDynamaxMaxHP(gBattlerAttacker) / factor == 0) + if (factor == 2) + hp = (GetNonDynamaxMaxHP(gBattlerAttacker)+1) / factor; // shed tail rounds up + else + hp = GetNonDynamaxMaxHP(gBattlerAttacker) / factor; // one bit value will only work for Pokémon which max hp can go to 1020(which is more than possible in games) + + if (hp == 0) hp = 1; if (gBattleMons[gBattlerAttacker].hp <= hp) @@ -12620,7 +12625,7 @@ static void Cmd_setsubstitute(void) } else { - gBattleMoveDamage = GetNonDynamaxMaxHP(gBattlerAttacker) / factor; // one bit value will only work for Pokémon which max hp can go to 1020(which is more than possible in games) + gBattleMoveDamage = hp; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1;