From 36aec5658c0db8c8cc28b2548e37f5c6fe2d5be4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 29 Jun 2020 13:45:27 +0200 Subject: [PATCH] Transform Imposter Illusion fix --- src/battle_gfx_sfx_util.c | 3 +++ src/battle_script_commands.c | 1 + src/battle_util.c | 1 + 3 files changed, 5 insertions(+) diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 1020d1f43..1ba934812 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -411,7 +411,10 @@ bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattler, u8 atkBattler, u8 de } if (tableId == B_ANIM_ILLUSION_OFF) + { gBattleStruct->illusion[activeBattler].broken = 1; + gBattleStruct->illusion[activeBattler].on = 0; + } gBattleAnimAttacker = atkBattler; gBattleAnimTarget = defBattler; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 291a8fb0a..bc5579bdd 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9404,6 +9404,7 @@ static void Cmd_transformdataexecution(void) gChosenMove = 0xFFFF; gBattlescriptCurrInstr++; if (gBattleMons[gBattlerTarget].status2 & STATUS2_TRANSFORMED + || gBattleStruct->illusion[gBattlerTarget].on || gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) { gMoveResultFlags |= MOVE_RESULT_FAILED; diff --git a/src/battle_util.c b/src/battle_util.c index f510f264e..0d84fdb52 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2943,6 +2943,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (IsBattlerAlive(BATTLE_OPPOSITE(battler)) && !(gBattleMons[BATTLE_OPPOSITE(battler)].status2 & (STATUS2_TRANSFORMED | STATUS2_SUBSTITUTE)) && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) + && !(gBattleStruct->illusion[BATTLE_OPPOSITE(battler)].on) && !(gStatuses3[BATTLE_OPPOSITE(battler)] & STATUS3_SEMI_INVULNERABLE)) { gBattlerTarget = BATTLE_OPPOSITE(battler);