Fix Instruct failing improperly when the instructed move isn't in the target's moveset (#9113)
This commit is contained in:
parent
4bf88de669
commit
564cc3e73e
@ -17391,21 +17391,26 @@ void BS_TryInstruct(void)
|
||||
gSpecialStatuses[gBattlerTarget].instructedChosenTarget = gBattleStruct->moveTarget[gBattlerTarget] | 0x4;
|
||||
gCalledMove = move;
|
||||
u32 moveIndex;
|
||||
bool32 foundMove = FALSE;
|
||||
for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].moves[moveIndex] == gCalledMove)
|
||||
{
|
||||
gCurrMovePos = moveIndex;
|
||||
moveIndex = MAX_MON_MOVES;
|
||||
foundMove = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (moveIndex != MAX_MON_MOVES || gBattleMons[gBattlerTarget].pp[gCurrMovePos] == 0)
|
||||
if (!foundMove)
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
else if (gBattleMons[gBattlerTarget].pp[moveIndex] == 0)
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
gCurrMovePos = moveIndex;
|
||||
gBattleScripting.battler = gBattlerAttacker; // for message
|
||||
gEffectBattler = gBattleStruct->lastMoveTarget[gBattlerTarget];
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
||||
@ -97,7 +97,7 @@ DOUBLE_BATTLE_TEST("Instruct fails if target doesn't know the last move it used"
|
||||
GIVEN {
|
||||
ASSUME(IsDanceMove(MOVE_DRAGON_DANCE));
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_ORICORIO) { Moves(MOVE_SCRATCH, MOVE_POUND, MOVE_SCRATCH, MOVE_CELEBRATE); }
|
||||
PLAYER(SPECIES_ORICORIO) { Ability(ABILITY_DANCER); Moves(MOVE_SCRATCH, MOVE_POUND, MOVE_SCRATCH, MOVE_CELEBRATE); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
@ -113,6 +113,27 @@ DOUBLE_BATTLE_TEST("Instruct fails if target doesn't know the last move it used"
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Instruct fails if the instructed move's PP is depleted")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { Speed(20); Moves(MOVE_INSTRUCT, MOVE_CELEBRATE); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { Speed(30); MovesWithPP({MOVE_SCRATCH, 1}, {MOVE_CELEBRATE, 10}); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
|
||||
} WHEN {
|
||||
TURN { MOVE(playerRight, MOVE_SCRATCH, target: opponentLeft); }
|
||||
TURN { MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, playerRight);
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, playerRight);
|
||||
}
|
||||
} THEN {
|
||||
EXPECT_EQ(playerRight->pp[0], 0);
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Instruct-called move fails if it can only be used on the first turn but consumes PP")
|
||||
{
|
||||
GIVEN {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user