From 8f59d9c94fcd29163b5c03ebc2389aef4ea8de79 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:39:32 +0100 Subject: [PATCH] Fixes Shed Tail substitute health (#5826) --- src/battle_script_commands.c | 5 ++++- test/battle/move_effect/shed_tail.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1d03cf3f5612..7d342b0b733b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12638,7 +12638,10 @@ static void Cmd_setsubstitute(void) gBattleMons[gBattlerAttacker].status2 |= STATUS2_SUBSTITUTE; gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_WRAPPED; - gDisableStructs[gBattlerAttacker].substituteHP = gBattleMoveDamage; + if (factor == 2) + gDisableStructs[gBattlerAttacker].substituteHP = gBattleMoveDamage / 2; + else + gDisableStructs[gBattlerAttacker].substituteHP = gBattleMoveDamage; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SUBSTITUTE; gHitMarker |= HITMARKER_IGNORE_SUBSTITUTE; } diff --git a/test/battle/move_effect/shed_tail.c b/test/battle/move_effect/shed_tail.c index 51d7652460af..6e337f4fe71f 100644 --- a/test/battle/move_effect/shed_tail.c +++ b/test/battle/move_effect/shed_tail.c @@ -99,3 +99,26 @@ AI_SINGLE_BATTLE_TEST("AI will use Shed Tail to pivot to another mon while in da TURN { MOVE(player, MOVE_TACKLE); EXPECT_MOVE(opponent, MOVE_SHED_TAIL); } } } + +SINGLE_BATTLE_TEST("Shed Tail creates a Substitute with 1/4 of user maximum health") +{ + u32 hp; + PARAMETRIZE { hp = 160; } + PARAMETRIZE { hp = 164; } + + GIVEN { + ASSUME(gMovesInfo[MOVE_DRAGON_RAGE].argument == 40); + ASSUME(gMovesInfo[MOVE_DRAGON_RAGE].effect == EFFECT_FIXED_DAMAGE_ARG); + PLAYER(SPECIES_BULBASAUR) { MaxHP(hp); } + PLAYER(SPECIES_BULBASAUR); + OPPONENT(SPECIES_CHARMANDER); + } WHEN { + TURN { MOVE(player, MOVE_SHED_TAIL); MOVE(opponent, MOVE_DRAGON_RAGE); SEND_OUT(player, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SHED_TAIL, player); + if (hp == 160) + MESSAGE("Bulbasaur's substitute faded!"); + else + NOT MESSAGE("Bulbasaur's substitute faded!"); + } +}