Shell Trap tests and Fix for Encore interaction (#8268)

Co-authored-by: PhallenTree <168426989+PhallenTree@users.noreply.github.com>
This commit is contained in:
Alex 2025-11-18 15:29:19 +01:00 committed by GitHub
parent 7fd1404354
commit 0999ca8ff9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 72 additions and 9 deletions

View File

@ -11527,14 +11527,16 @@ static void Cmd_trysetencore(void)
}
if ((IsMoveEncoreBanned(gLastMoves[gBattlerTarget]))
|| i == MAX_MON_MOVES
|| gLastMoves[gBattlerTarget] == MOVE_NONE
|| gLastMoves[gBattlerTarget] == MOVE_UNAVAILABLE)
|| gLastMoves[gBattlerTarget] == MOVE_UNAVAILABLE
|| gBattleMons[gBattlerTarget].pp[i] == 0
|| gDisableStructs[gBattlerTarget].encoredMove != MOVE_NONE
|| GetMoveEffect(gChosenMoveByBattler[gBattlerTarget]) == EFFECT_SHELL_TRAP)
{
i = MAX_MON_MOVES;
gBattlescriptCurrInstr = cmd->failInstr;
}
if (gDisableStructs[gBattlerTarget].encoredMove == MOVE_NONE
&& i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0)
else
{
gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i];
gDisableStructs[gBattlerTarget].encoredMovePos = i;
@ -11552,10 +11554,6 @@ static void Cmd_trysetencore(void)
gDisableStructs[gBattlerTarget].encoreTimer = 3;
gBattlescriptCurrInstr = cmd->nextInstr;
}
else
{
gBattlescriptCurrInstr = cmd->failInstr;
}
}
static void Cmd_painsplitdmgcalc(void)

View File

@ -214,3 +214,68 @@ SINGLE_BATTLE_TEST("Shell Trap activates if user is hit with a physical move but
HP_BAR(opponent);
}
}
SINGLE_BATTLE_TEST("Encore fails if target has active Shell Trap waiting")
{
GIVEN {
ASSUME(GetMoveEffect(MOVE_ENCORE) == EFFECT_ENCORE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
TURN { MOVE(player, MOVE_SHELL_TRAP); MOVE(opponent, MOVE_ENCORE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
MESSAGE("Wobbuffet set a shell trap!");
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_ENCORE, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SHELL_TRAP, player);
}
}
}
SINGLE_BATTLE_TEST("Shell Trap fails if an other -3 or lower priority Move is used")
{
GIVEN {
ASSUME(GetMovePriority(MOVE_DRAGON_TAIL) <= -3);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
MOVE(player, MOVE_SHELL_TRAP);
MOVE(opponent, MOVE_DRAGON_TAIL);
}
} SCENE {
MESSAGE("Wobbuffet set a shell trap!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_TAIL, opponent);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SHELL_TRAP, player);
}
}
DOUBLE_BATTLE_TEST("Shell Trap does not trigger when hit into Substitute")
{
GIVEN {
ASSUME(GetMoveCategory(MOVE_DOUBLE_EDGE) == DAMAGE_CATEGORY_PHYSICAL);
PLAYER(SPECIES_WYNAUT);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SNORLAX);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(playerLeft, MOVE_SUBSTITUTE); }
TURN {
MOVE(playerLeft, MOVE_SHELL_TRAP);
MOVE(opponentLeft, MOVE_DOUBLE_EDGE, target: playerLeft);
MOVE(opponentRight, MOVE_SCRATCH, target: playerLeft);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, playerLeft);
MESSAGE("Wynaut set a shell trap!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_EDGE, opponentLeft);
MESSAGE("Wynaut's substitute faded!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SHELL_TRAP, playerLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SHELL_TRAP, playerLeft);
}
}