Fixes Spiky Shield Counter interaction (#5402)

* Fixes Spiky Shield Counter interaction

* Update test/battle/move_effect/protect.c

---------

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
Alex 2024-09-19 12:00:32 +02:00 committed by GitHub
parent 71dfd3e7c0
commit 68c51f8412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View file

@ -5448,7 +5448,9 @@ static void Cmd_moveend(void)
case MOVEEND_PROTECT_LIKE_EFFECT:
if (gProtectStructs[gBattlerAttacker].touchedProtectLike)
{
if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
if (gProtectStructs[gBattlerTarget].spikyShielded
&& gMovesInfo[gCurrentMove].effect != EFFECT_COUNTER
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
{
gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE;
gBattleMoveDamage = GetNonDynamaxMaxHP(gBattlerAttacker) / 8;

View file

@ -547,3 +547,22 @@ DOUBLE_BATTLE_TEST("Crafty Shield does not protect against moves that target all
MESSAGE("Foe Sunflora's Defense rose!");
}
}
SINGLE_BATTLE_TEST("Spiky Shield does not damage users on Counter or Mirror Coat")
{
u32 move;
PARAMETRIZE { move = MOVE_MIRROR_COAT; }
PARAMETRIZE { move = MOVE_COUNTER; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SPIKY_SHIELD); MOVE(opponent, move); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIKY_SHIELD, player);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
HP_BAR(opponent);
}
}
}