Skip to content

Commit

Permalink
Fixes Spiky Shield Counter interaction (#5402)
Browse files Browse the repository at this point in the history
* Fixes Spiky Shield Counter interaction

* Update test/battle/move_effect/protect.c

---------

Co-authored-by: Bassoonian <[email protected]>
  • Loading branch information
AlexOn1ine and Bassoonian authored Sep 19, 2024
1 parent 71dfd3e commit 68c51f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 19 additions & 0 deletions test/battle/move_effect/protect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 68c51f8

Please sign in to comment.