Fix Mimic trying to access MOVE_UNAVAILABLE in an incredibly small amount of possible scenarios (#8685)
This commit is contained in:
parent
6e12b35287
commit
22fb105f70
@ -11303,10 +11303,10 @@ static void Cmd_mimicattackcopy(void)
|
|||||||
{
|
{
|
||||||
CMD_ARGS(const u8 *failInstr);
|
CMD_ARGS(const u8 *failInstr);
|
||||||
|
|
||||||
if ((IsMoveMimicBanned(gLastMoves[gBattlerTarget]))
|
if (gLastMoves[gBattlerTarget] == MOVE_UNAVAILABLE
|
||||||
|| (gBattleMons[gBattlerAttacker].volatiles.transformed)
|
|| gLastMoves[gBattlerTarget] == MOVE_NONE
|
||||||
|| gLastMoves[gBattlerTarget] == MOVE_NONE
|
|| gBattleMons[gBattlerAttacker].volatiles.transformed
|
||||||
|| gLastMoves[gBattlerTarget] == MOVE_UNAVAILABLE)
|
|| IsMoveMimicBanned(gLastMoves[gBattlerTarget]))
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = cmd->failInstr;
|
gBattlescriptCurrInstr = cmd->failInstr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,20 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "test/battle.h"
|
#include "test/battle.h"
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Mimic doesn't error when the last move used by the target resolves to MOVE_UNAVAILABLE")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
OPPONENT(SPECIES_WYNAUT);
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN {MOVE(opponent, MOVE_TRANSFORM); MOVE(player, MOVE_MIMIC); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRANSFORM, opponent);
|
||||||
|
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_MIMIC, player);
|
||||||
|
} THEN {
|
||||||
|
EXPECT_EQ(gLastMoves[1], MOVE_UNAVAILABLE); // This test depends on the current implementation of Transform, if this changes, the test should be changed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TO_DO_BATTLE_TEST("TODO: Write Mimic (Move Effect) test titles")
|
TO_DO_BATTLE_TEST("TODO: Write Mimic (Move Effect) test titles")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user