Skip to content

Commit

Permalink
Merge pull request #1959 from SnorlaxMonster/master
Browse files Browse the repository at this point in the history
Rename HITMARKER_IGNORE_SAFEGUARD
  • Loading branch information
GriffinRichards authored Nov 18, 2023
2 parents 12a64fe + 190e77e commit 758f744
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
#define HITMARKER_ATTACKSTRING_PRINTED (1 << 10)
#define HITMARKER_NO_PPDEDUCT (1 << 11)
#define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12)
#define HITMARKER_IGNORE_SAFEGUARD (1 << 13)
#define HITMARKER_STATUS_ABILITY_EFFECT (1 << 13)
#define HITMARKER_SYNCHRONISE_EFFECT (1 << 14)
#define HITMARKER_RUN (1 << 15)
#define HITMARKER_IGNORE_ON_AIR (1 << 16)
Expand Down
30 changes: 15 additions & 15 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2246,11 +2246,11 @@ void SetMoveEffect(bool8 primary, u8 certain)
gBattleScripting.battler = 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)
INCREMENT_RESET_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)
INCREMENT_RESET_RETURN

Expand Down Expand Up @@ -2300,10 +2300,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
{
Expand All @@ -2312,7 +2312,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
RESET_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);
Expand Down Expand Up @@ -2341,10 +2341,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
{
Expand All @@ -2353,7 +2353,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
RESET_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);
Expand Down Expand Up @@ -2397,10 +2397,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
{
Expand All @@ -2425,10 +2425,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
{
Expand All @@ -2437,7 +2437,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
RESET_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);
Expand Down Expand Up @@ -2480,10 +2480,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &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
{
Expand Down
16 changes: 8 additions & 8 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,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_PASSIVE_DAMAGE
| HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT
| HITMARKER_CHARGING | HITMARKER_NEVER_SET);
Expand All @@ -662,7 +662,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_PASSIVE_DAMAGE
| HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT
| HITMARKER_CHARGING | HITMARKER_NEVER_SET);
Expand Down Expand Up @@ -2782,7 +2782,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleCommunication[MOVE_EFFECT_BYTE] += MOVE_EFFECT_AFFECTS_USER;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
Expand All @@ -2797,7 +2797,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
Expand All @@ -2812,7 +2812,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
Expand All @@ -2827,7 +2827,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
Expand Down Expand Up @@ -2963,7 +2963,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleScripting.battler = gBattlerTarget;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
Expand All @@ -2979,7 +2979,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleScripting.battler = gBattlerAttacker;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
Expand Down

0 comments on commit 758f744

Please sign in to comment.