remove pointless timers from disable struct

This commit is contained in:
DizzyEggg 2023-02-07 15:10:20 +01:00
parent 0c4c3fbbb7
commit f762ed728d
4 changed files with 28 additions and 39 deletions

View File

@ -70,20 +70,15 @@ struct DisableStruct
s8 stockpileBeforeDef; s8 stockpileBeforeDef;
s8 stockpileBeforeSpDef; s8 stockpileBeforeSpDef;
u8 substituteHP; u8 substituteHP;
u8 disableTimer:4;
u8 disableTimerStartValue:4;
u8 encoredMovePos; u8 encoredMovePos;
u8 disableTimer:4;
u8 encoreTimer:4; u8 encoreTimer:4;
u8 encoreTimerStartValue:4;
u8 perishSongTimer:4; u8 perishSongTimer:4;
u8 perishSongTimerStartValue:4;
u8 furyCutterCounter; u8 furyCutterCounter;
u8 rolloutTimer:4; u8 rolloutTimer:4;
u8 rolloutTimerStartValue:4; u8 rolloutTimerStartValue:4;
u8 chargeTimer:4; u8 chargeTimer:4;
u8 chargeTimerStartValue:4;
u8 tauntTimer:4; u8 tauntTimer:4;
u8 tauntTimer2:4;
u8 battlerPreventingEscape; u8 battlerPreventingEscape;
u8 battlerWithSureHit; u8 battlerWithSureHit;
u8 isFirstTurn; u8 isFirstTurn;
@ -99,8 +94,8 @@ struct DisableStruct
u8 healBlockTimer; u8 healBlockTimer;
u8 laserFocusTimer; u8 laserFocusTimer;
u8 throatChopTimer; u8 throatChopTimer;
u8 usedMoves:4;
u8 wrapTurns; u8 wrapTurns;
u8 usedMoves:4;
u8 noRetreat:1; u8 noRetreat:1;
u8 tarShot:1; u8 tarShot:1;
u8 octolock:1; u8 octolock:1;

View File

@ -3124,7 +3124,6 @@ void SwitchInClearSetData(void)
gDisableStructs[gActiveBattler].substituteHP = disableStructCopy.substituteHP; gDisableStructs[gActiveBattler].substituteHP = disableStructCopy.substituteHP;
gDisableStructs[gActiveBattler].battlerWithSureHit = disableStructCopy.battlerWithSureHit; gDisableStructs[gActiveBattler].battlerWithSureHit = disableStructCopy.battlerWithSureHit;
gDisableStructs[gActiveBattler].perishSongTimer = disableStructCopy.perishSongTimer; gDisableStructs[gActiveBattler].perishSongTimer = disableStructCopy.perishSongTimer;
gDisableStructs[gActiveBattler].perishSongTimerStartValue = disableStructCopy.perishSongTimerStartValue;
gDisableStructs[gActiveBattler].battlerPreventingEscape = disableStructCopy.battlerPreventingEscape; gDisableStructs[gActiveBattler].battlerPreventingEscape = disableStructCopy.battlerPreventingEscape;
} }

View File

@ -10065,7 +10065,7 @@ static void Cmd_various(void)
// Check taunt // Check taunt
if (gDisableStructs[gActiveBattler].tauntTimer != 0) if (gDisableStructs[gActiveBattler].tauntTimer != 0)
{ {
gDisableStructs[gActiveBattler].tauntTimer = gDisableStructs[gActiveBattler].tauntTimer2 = 0; gDisableStructs[gActiveBattler].tauntTimer = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT);
} }
@ -10073,7 +10073,7 @@ static void Cmd_various(void)
if (gDisableStructs[gActiveBattler].encoreTimer != 0) if (gDisableStructs[gActiveBattler].encoreTimer != 0)
{ {
gDisableStructs[gActiveBattler].encoredMove = 0; gDisableStructs[gActiveBattler].encoredMove = 0;
gDisableStructs[gActiveBattler].encoreTimerStartValue = gDisableStructs[gActiveBattler].encoreTimer = 0; gDisableStructs[gActiveBattler].encoreTimer = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED
} }
// Check torment // Check torment
@ -10091,7 +10091,7 @@ static void Cmd_various(void)
// Check disable // Check disable
if (gDisableStructs[gActiveBattler].disableTimer != 0) if (gDisableStructs[gActiveBattler].disableTimer != 0)
{ {
gDisableStructs[gActiveBattler].disableTimer = gDisableStructs[gActiveBattler].disableTimerStartValue = 0; gDisableStructs[gActiveBattler].disableTimer = 0;
gDisableStructs[gActiveBattler].disabledMove = 0; gDisableStructs[gActiveBattler].disabledMove = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE;
} }
@ -12105,7 +12105,6 @@ static void Cmd_disablelastusedattack(void)
#else #else
gDisableStructs[gBattlerTarget].disableTimer = 4; gDisableStructs[gBattlerTarget].disableTimer = 4;
#endif #endif
gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns?
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
} }
else else
@ -12140,7 +12139,7 @@ static void Cmd_trysetencore(void)
gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i]; gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i];
gDisableStructs[gBattlerTarget].encoredMovePos = i; gDisableStructs[gBattlerTarget].encoredMovePos = i;
gDisableStructs[gBattlerTarget].encoreTimer = 3; gDisableStructs[gBattlerTarget].encoreTimer = 3;
gDisableStructs[gBattlerTarget].encoreTimerStartValue = gDisableStructs[gBattlerTarget].encoreTimer; gDisableStructs[gBattlerTarget].encoreTimer;
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
} }
else else
@ -12615,7 +12614,6 @@ static void Cmd_trysetperishsong(void)
{ {
gStatuses3[i] |= STATUS3_PERISH_SONG; gStatuses3[i] |= STATUS3_PERISH_SONG;
gDisableStructs[i].perishSongTimer = 3; gDisableStructs[i].perishSongTimer = 3;
gDisableStructs[i].perishSongTimerStartValue = 3;
} }
} }
@ -13200,7 +13198,6 @@ static void Cmd_setcharge(void)
{ {
gStatuses3[gBattlerAttacker] |= STATUS3_CHARGED_UP; gStatuses3[gBattlerAttacker] |= STATUS3_CHARGED_UP;
gDisableStructs[gBattlerAttacker].chargeTimer = 2; gDisableStructs[gBattlerAttacker].chargeTimer = 2;
gDisableStructs[gBattlerAttacker].chargeTimerStartValue = 2;
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@ -13290,7 +13287,7 @@ static void Cmd_settaunt(void)
u8 turns = 2; u8 turns = 2;
#endif #endif
gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = turns; gDisableStructs[gBattlerTarget].tauntTimer = turns;
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
} }
else else

View File

@ -5758,11 +5758,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
{ {
gStatuses3[battler] |= STATUS3_PERISH_SONG; gStatuses3[battler] |= STATUS3_PERISH_SONG;
gDisableStructs[battler].perishSongTimer = 3; gDisableStructs[battler].perishSongTimer = 3;
gDisableStructs[battler].perishSongTimerStartValue = 3;
} }
gStatuses3[gBattlerAttacker] |= STATUS3_PERISH_SONG; gStatuses3[gBattlerAttacker] |= STATUS3_PERISH_SONG;
gDisableStructs[gBattlerAttacker].perishSongTimer = 3; gDisableStructs[gBattlerAttacker].perishSongTimer = 3;
gDisableStructs[gBattlerAttacker].perishSongTimerStartValue = 3;
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_PerishBodyActivates; gBattlescriptCurrInstr = BattleScript_PerishBodyActivates;
effect++; effect++;
@ -6815,7 +6813,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId)
// Check taunt // Check taunt
if (gDisableStructs[battlerId].tauntTimer != 0) if (gDisableStructs[battlerId].tauntTimer != 0)
{ {
gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; gDisableStructs[battlerId].tauntTimer = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT);
ret = TRUE; ret = TRUE;
@ -6824,7 +6822,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId)
if (gDisableStructs[battlerId].encoreTimer != 0) if (gDisableStructs[battlerId].encoreTimer != 0)
{ {
gDisableStructs[battlerId].encoredMove = 0; gDisableStructs[battlerId].encoredMove = 0;
gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; gDisableStructs[battlerId].encoreTimer = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED
ret = TRUE; ret = TRUE;
} }
@ -6845,7 +6843,7 @@ static bool32 GetMentalHerbEffect(u8 battlerId)
// Check disable // Check disable
if (gDisableStructs[battlerId].disableTimer != 0) if (gDisableStructs[battlerId].disableTimer != 0)
{ {
gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; gDisableStructs[battlerId].disableTimer = 0;
gDisableStructs[battlerId].disabledMove = 0; gDisableStructs[battlerId].disabledMove = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE;
ret = TRUE; ret = TRUE;