Skip to content

Commit

Permalink
Merge pull request #866 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 12feab5 + a5503c0 commit 108d7bb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
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 @@ -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++;
Expand Down Expand Up @@ -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
{
Expand All @@ -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);
Expand Down Expand Up @@ -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
{
Expand All @@ -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);
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down
20 changes: 10 additions & 10 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand All @@ -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++;
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 108d7bb

Please sign in to comment.