From 03e87a7d62162e94eb3b857315e9f83f42e7b951 Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Sun, 8 Sep 2024 10:38:52 +0200 Subject: [PATCH] Pledge fail into opponent pledge loop fix (#5339) * Pledge fail into opponent pledge loop fix * Fixed excessively aggressive canceller * Move the Pledge bit clear to its proper place --------- Co-authored-by: Hedara --- src/battle_script_commands.c | 2 ++ test/battle/move_effect/pledge.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fb6ec724e0..13795ee61c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6438,6 +6438,8 @@ static void Cmd_moveend(void) gBattleStruct->poisonPuppeteerConfusion = FALSE; gBattleStruct->fickleBeamBoosted = FALSE; gBattleStruct->distortedTypeMatchups = 0; + if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) + gBattleStruct->pledgeMove = FALSE; if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE) SetActiveGimmick(gBattlerAttacker, GIMMICK_NONE); if (B_CHARGE <= GEN_8 || moveType == TYPE_ELECTRIC) diff --git a/test/battle/move_effect/pledge.c b/test/battle/move_effect/pledge.c index f17e75dfd2..32e9e070b4 100644 --- a/test/battle/move_effect/pledge.c +++ b/test/battle/move_effect/pledge.c @@ -768,3 +768,26 @@ DOUBLE_BATTLE_TEST("Pledge move combo fails if ally fails to act - Flinch Both R } } } + +DOUBLE_BATTLE_TEST("Pledge move combo doesn't trigger on opponent's Pledge move") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Speed(4); } + PLAYER(SPECIES_WYNAUT) { Speed(3); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(8); } + OPPONENT(SPECIES_WYNAUT) { Speed(5); Status1(STATUS1_SLEEP_TURN(2)); } + } WHEN { + TURN { MOVE(opponentLeft, MOVE_FIRE_PLEDGE, target: playerLeft); + MOVE(opponentRight, MOVE_GRASS_PLEDGE, target: playerLeft); + MOVE(playerLeft, MOVE_GRASS_PLEDGE, target: opponentRight); } + } SCENE { + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, opponentRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, opponentRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerLeft); + } + ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASS_PLEDGE, playerLeft); + HP_BAR(opponentRight); + } +}