diff --git a/include/constants/battle.h b/include/constants/battle.h index 658f9ad6f..53a9c1bba 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -150,7 +150,7 @@ #define HITMARKER_ATTACKSTRING_PRINTED 0x00000400 #define HITMARKER_NO_PPDEDUCT 0x00000800 #define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000 -#define HITMARKER_IGNORE_SAFEGUARD 0x00002000 +#define HITMARKER_STATUS_ABILITY_EFFECT 0x00002000 #define HITMARKER_SYNCHRONISE_EFFECT 0x00004000 #define HITMARKER_RUN 0x00008000 #define HITMARKER_IGNORE_ON_AIR 0x00010000 diff --git a/src/battle_main.c b/src/battle_main.c index fc9686a0a..d846f6562 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5659,7 +5659,7 @@ void HandleAction_NothingIsFainted(void) gCurrentTurnActionNumber++; gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED - | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR + | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000 | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_CHARGING | HITMARKER_x4000000); @@ -5671,7 +5671,7 @@ void HandleAction_ActionFinished(void) gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; SpecialStatusesClear(); gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED - | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR + | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000 | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_CHARGING | HITMARKER_x4000000); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index dc6bd3f5c..46000157c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2321,14 +2321,14 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattleStruct->scriptingActive = gBattlerAttacker; } - if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 9) { gBattlescriptCurrInstr++; return; } - if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 7) { gBattlescriptCurrInstr++; @@ -2387,10 +2387,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); + gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT); } else { @@ -2399,7 +2399,7 @@ void SetMoveEffect(bool8 primary, u8 certain) return; } if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL)) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2428,10 +2428,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_BRNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); + gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT); } else { @@ -2440,7 +2440,7 @@ void SetMoveEffect(bool8 primary, u8 certain) return; } if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2484,10 +2484,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PRLZPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); + gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT); } else { @@ -2512,10 +2512,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); + gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT); } else { @@ -2524,7 +2524,7 @@ void SetMoveEffect(bool8 primary, u8 certain) return; } if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL)) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2567,10 +2567,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gEffectBattler].status1); MarkBattlerForControllerExec(gActiveBattler); - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY; - gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD); + gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT); } else { diff --git a/src/battle_util.c b/src/battle_util.c index 3d80fab2e..136195e7f 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2100,7 +2100,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] += 0x40; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2122,7 +2122,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] += 0x40; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2139,7 +2139,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] = 0x42; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2155,7 +2155,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] = 0x42; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2172,7 +2172,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] = 0x45; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2188,7 +2188,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] = 0x45; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2205,7 +2205,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] = 0x43; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2221,7 +2221,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleCommunication[MOVE_EFFECT_BYTE] = 0x43; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } } @@ -2383,7 +2383,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleStruct->scriptingActive = gBattlerTarget; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2398,7 +2398,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) gBattleStruct->scriptingActive = gBattlerAttacker; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break;