Skip to content

Commit

Permalink
Fixes Shed Tail substitute health (#5826)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine authored Dec 18, 2024
1 parent 11bc9bd commit 8f59d9c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
23 changes: 23 additions & 0 deletions test/battle/move_effect/shed_tail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
}

0 comments on commit 8f59d9c

Please sign in to comment.