Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Shed Tail substitute health #5826

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!");
}
}
Loading