From 738d92e39d13e1af167be3d242c14d4e8ecb3d4d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 23 Apr 2020 11:29:19 +0200 Subject: [PATCH] Infiltrator affects mist safeguard --- asm/macros/battle_script.inc | 6 ++++++ data/battle_scripts_1.s | 22 +++++++++++----------- src/battle_script_commands.c | 4 +++- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 34b3567019..20071fc36b 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1863,4 +1863,10 @@ jumpifability BS_TARGET, ABILITY_LEAF_GUARD, \jumpptr 1: .endm + + .macro jumpifsafeguard jumpptr:req + jumpifability BS_ATTACKER, ABILITY_INFILTRATOR, 1f + jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, \jumpptr + 1: + .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 46716c4aff..a2a523c830 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -907,7 +907,7 @@ BattleScript_EffectPsychoShift: goto BattleScript_ButItFailed BattleScript_EffectPsychoShiftCanWork: jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected trypsychoshift BattleScript_MoveEnd attackanimation waitanimation @@ -2132,7 +2132,7 @@ BattleScript_EffectSleep:: jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected attackanimation waitanimation setmoveeffect MOVE_EFFECT_SLEEP @@ -2653,7 +2653,7 @@ BattleScript_EffectToxic:: jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed trypoisontype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected attackanimation waitanimation setmoveeffect MOVE_EFFECT_TOXIC @@ -2856,7 +2856,7 @@ BattleScript_EffectConfuse: jumpifsubstituteblocks BattleScript_ButItFailed jumpifstatus2 BS_TARGET, STATUS2_CONFUSION, BattleScript_AlreadyConfused accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected attackanimation waitanimation setmoveeffect MOVE_EFFECT_CONFUSION @@ -2974,7 +2974,7 @@ BattleScript_EffectPoison:: trypoisontype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected attackanimation waitanimation setmoveeffect MOVE_EFFECT_POISON @@ -2999,7 +2999,7 @@ BattleScript_EffectParalyze: jumpiftype BS_TARGET, TYPE_ELECTRIC, BattleScript_NotAffected jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected bichalfword gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE attackanimation waitanimation @@ -3707,7 +3707,7 @@ BattleScript_EffectSwagger:: waitmessage 0x40 BattleScript_SwaggerTryConfuse: jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_OwnTempoPrevents - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected setmoveeffect MOVE_EFFECT_CONFUSION seteffectprimary goto BattleScript_MoveEnd @@ -4244,7 +4244,7 @@ BattleScript_EffectFlatter:: waitmessage 0x40 BattleScript_FlatterTryConfuse:: jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_OwnTempoPrevents - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected setmoveeffect MOVE_EFFECT_CONFUSION seteffectprimary goto BattleScript_MoveEnd @@ -4263,7 +4263,7 @@ BattleScript_EffectWillOWisp:: jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected attackanimation waitanimation setmoveeffect MOVE_EFFECT_BURN @@ -4536,7 +4536,7 @@ BattleScript_EffectYawn:: jumpifleafguard BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifsubstituteblocks BattleScript_ButItFailed - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected + jumpifsafeguard BattleScript_SafeguardProtected accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON jumpifcantmakeasleep BattleScript_ButItFailed setyawn BattleScript_ButItFailed @@ -4665,7 +4665,7 @@ BattleScript_TeeterDanceLoop:: jumpifstatus2 BS_TARGET, STATUS2_CONFUSION, BattleScript_TeeterDanceAlreadyConfused jumpifhasnohp BS_TARGET, BattleScript_TeeterDanceLoopIncrement accuracycheck BattleScript_TeeterDanceMissed, ACC_CURR_MOVE - jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_TeeterDanceSafeguardProtected + jumpifsafeguard BattleScript_TeeterDanceSafeguardProtected attackanimation waitanimation seteffectprimary diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f33ec552b9..1757454665 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8539,7 +8539,8 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr if (statValue <= -1) // Stat decrease. { if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer - && !certain && gCurrentMove != MOVE_CURSE) + && !certain && gCurrentMove != MOVE_CURSE + && !(gActiveBattler == gBattlerTarget && GetBattlerAbility(gBattlerAttacker) == ABILITY_INFILTRATOR)) { if (flags == STAT_BUFF_ALLOW_PTR) { @@ -8564,6 +8565,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr return STAT_CHANGE_DIDNT_WORK; } else if ((GetBattlerAbility(gActiveBattler) == ABILITY_CLEAR_BODY + || GetBattlerAbility(gActiveBattler) == ABILITY_FULL_METAL_BODY || GetBattlerAbility(gActiveBattler) == ABILITY_WHITE_SMOKE) && !certain && gCurrentMove != MOVE_CURSE) {