Fixes Shed Tail substitute health (#5826)

This commit is contained in:
Alex 2024-12-18 21:39:32 +01:00 committed by GitHub
parent 11bc9bd2f2
commit 8f59d9c94f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -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;
}

View file

@ -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!");
}
}