From a1e64fce4f52f40a68d06f18e313e76450677009 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Mon, 1 Nov 2021 13:50:57 -0400 Subject: [PATCH] handle simple beam, gastro acid --- asm/macros/battle_script.inc | 4 ++++ data/battle_scripts_1.s | 2 ++ include/battle.h | 3 ++- include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 15 +++++++++++++++ src/battle_util.c | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 04f6e04dc..80c78a932 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1863,6 +1863,10 @@ .2byte \species .4byte \ptr .endm + + .macro tryendneutralizinggas battler:req + various \battler, VARIOUS_TRY_END_NEUTRALIZING_GAS + .endm @ helpful macros .macro setstatchanger stat:req, stages:req, down:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 9fdd54e71..2b07f49d9 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1993,6 +1993,7 @@ BattleScript_EffectSimpleBeam: printstring STRINGID_PKMNACQUIREDSIMPLE waitmessage B_WAIT_TIME_LONG trytoclearprimalweather + tryendneutralizinggas BS_TARGET printstring STRINGID_EMPTYSTRING3 waitmessage 1 goto BattleScript_MoveEnd @@ -2215,6 +2216,7 @@ BattleScript_EffectGastroAcid: printstring STRINGID_PKMNSABILITYSUPPRESSED waitmessage B_WAIT_TIME_LONG trytoclearprimalweather + tryendneutralizinggas BS_TARGET printstring STRINGID_EMPTYSTRING3 waitmessage 1 goto BattleScript_MoveEnd diff --git a/include/battle.h b/include/battle.h index 68a40c978..d50522083 100644 --- a/include/battle.h +++ b/include/battle.h @@ -182,7 +182,8 @@ struct SpecialStatus u8 damagedMons:4; // Mons that have been damaged directly by using a move, includes substitute. u8 dancerUsedMove:1; u8 dancerOriginalTarget:3; - u8 announceNeutralizingGas:1; + u8 announceNeutralizingGas:1; // See Cmd_switchineffects + u8 neutralizingGasRemoved:1; // See VARIOUS_TRY_END_NEUTRALIZING_GAS s32 dmg; s32 physicalDmg; s32 specialDmg; diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index f00695276..d05559bf4 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -194,6 +194,7 @@ #define VARIOUS_HANDLE_PRIMAL_REVERSION 121 #define VARIOUS_APPLY_PLASMA_FISTS 122 #define VARIOUS_JUMP_IF_SPECIES 123 +#define VARIOUS_TRY_END_NEUTRALIZING_GAS 124 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 79d9672af..802c151b4 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8002,6 +8002,9 @@ static void Cmd_various(void) } else { + if (gBattleMons[gBattlerTarget].ability == ABILITY_NEUTRALIZING_GAS) + gSpecialStatuses[gBattlerTarget].neutralizingGasRemoved = TRUE; + gBattleMons[gBattlerTarget].ability = ABILITY_SIMPLE; gBattlescriptCurrInstr += 7; } @@ -8899,6 +8902,15 @@ static void Cmd_various(void) } break; } + case VARIOUS_TRY_END_NEUTRALIZING_GAS: + if (gSpecialStatuses[gActiveBattler].neutralizingGasRemoved) + { + gSpecialStatuses[gActiveBattler].neutralizingGasRemoved = FALSE; + BattleScriptPush(gBattlescriptCurrInstr + 3); + gBattlescriptCurrInstr = BattleScript_NeutralizingGasExits; + return; + } + break; case VARIOUS_GET_ROTOTILLER_TARGETS: // Gets the battlers to be affected by rototiller. If there are none, print 'But it failed!' { @@ -12011,6 +12023,9 @@ static void Cmd_setgastroacid(void) } else { + if (gBattleMons[gBattlerTarget].ability == ABILITY_NEUTRALIZING_GAS) + gSpecialStatuses[gBattlerTarget].neutralizingGasRemoved = TRUE; + gStatuses3[gBattlerTarget] |= STATUS3_GASTRO_ACID; gBattlescriptCurrInstr += 5; } diff --git a/src/battle_util.c b/src/battle_util.c index 212f4216e..3ec6fc3d9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5489,7 +5489,7 @@ bool32 IsNeutralizingGasOnField(void) for (i = 0; i < gBattlersCount; i++) { - if (IsBattlerAlive(i) && gBattleMons[i].ability == ABILITY_NEUTRALIZING_GAS) + if (IsBattlerAlive(i) && gBattleMons[i].ability == ABILITY_NEUTRALIZING_GAS && !(gStatuses3[i] & STATUS3_GASTRO_ACID)) return TRUE; }