From b931e341728e4b4e70c24f4a33d9d1ab4b7c07f8 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 3 Nov 2021 21:04:34 -0300 Subject: [PATCH] Handled Mimicry's interaction with Steel Roller's effect --- asm/macros/battle_script.inc | 4 ++++ data/battle_scripts_1.s | 1 + include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b7a60dbbb..1625fe41c 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1883,6 +1883,10 @@ .4byte \ptr .endm + .macro trytorevertmimicry + various BS_ATTACKER, VARIOUS_TRY_TO_REVERT_MIMICRY + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ac2d9a1a6..88d89ec3f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -660,6 +660,7 @@ BattleScript_EffectRemoveTerrain: resultmessage waitmessage B_WAIT_TIME_LONG removeterrain + trytorevertmimicry jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 4, BattleScript_MoveEnd printfromtable gTerrainEndingStringIds waitmessage B_WAIT_TIME_LONG diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 50db28028..3d7dfbc2b 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -199,6 +199,7 @@ #define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126 #define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127 #define VARIOUS_TRY_TO_APPLY_MIMICRY 128 +#define VARIOUS_TRY_TO_REVERT_MIMICRY 129 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3bfa227bc..74d52dbb6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9039,6 +9039,13 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; return; } + case VARIOUS_TRY_TO_REVERT_MIMICRY: + for (i = 0; i < gBattlersCount; i++) + { + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); + } + break; } gBattlescriptCurrInstr += 3;