minor label change

This commit is contained in:
AlexOn1ine 2025-01-05 17:49:58 +01:00
parent 36cf8bfb0b
commit 60738a0cbc
9 changed files with 70 additions and 70 deletions

View file

@ -654,7 +654,7 @@ struct BattlerState
// Cleared at the beginning of the battle. Fields need to be cleared when needed manually otherwise. // Cleared at the beginning of the battle. Fields need to be cleared when needed manually otherwise.
struct BattleStruct struct BattleStruct
{ {
struct BattlerState battlerStates[MAX_BATTLERS_COUNT]; struct BattlerState battlerState[MAX_BATTLERS_COUNT];
u8 turnEffectsTracker; u8 turnEffectsTracker;
u8 turnEffectsBattlerId; u8 turnEffectsBattlerId;
u8 turnCountersTracker; u8 turnCountersTracker;

View file

@ -734,7 +734,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
if (IsTwoTurnNotSemiInvulnerableMove(battlerAtk, move) && CanTargetFaintAi(battlerDef, battlerAtk)) if (IsTwoTurnNotSemiInvulnerableMove(battlerAtk, move) && CanTargetFaintAi(battlerDef, battlerAtk))
RETURN_SCORE_MINUS(10); RETURN_SCORE_MINUS(10);
if (gBattleStruct->battlerStates[battlerDef].commandingDondozo) if (gBattleStruct->battlerState[battlerDef].commandingDondozo)
RETURN_SCORE_MINUS(20); RETURN_SCORE_MINUS(20);
// check if negates type // check if negates type

View file

@ -40,11 +40,11 @@ static void InitializeSwitchinCandidate(struct Pokemon *mon)
static bool32 IsAceMon(u32 battler, u32 monPartyId) static bool32 IsAceMon(u32 battler, u32 monPartyId)
{ {
if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_ACE_POKEMON if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_ACE_POKEMON
&& !gBattleStruct->battlerStates[battler].forcedSwitch && !gBattleStruct->battlerState[battler].forcedSwitch
&& monPartyId == CalculateEnemyPartyCountInSide(battler)-1) && monPartyId == CalculateEnemyPartyCountInSide(battler)-1)
return TRUE; return TRUE;
if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_DOUBLE_ACE_POKEMON if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_DOUBLE_ACE_POKEMON
&& !gBattleStruct->battlerStates[battler].forcedSwitch && !gBattleStruct->battlerState[battler].forcedSwitch
&& (monPartyId == CalculateEnemyPartyCount()-1 || monPartyId == CalculateEnemyPartyCount()-2)) && (monPartyId == CalculateEnemyPartyCount()-1 || monPartyId == CalculateEnemyPartyCount()-2))
return TRUE; return TRUE;
return FALSE; return FALSE;

View file

@ -430,7 +430,7 @@ bool32 IsDamageMoveUnusable(u32 battlerAtk, u32 battlerDef, u32 move, u32 moveTy
if (battlerDef == BATTLE_PARTNER(battlerAtk)) if (battlerDef == BATTLE_PARTNER(battlerAtk))
battlerDefAbility = aiData->abilities[battlerDef]; battlerDefAbility = aiData->abilities[battlerDef];
if (gBattleStruct->battlerStates[battlerDef].commandingDondozo) if (gBattleStruct->battlerState[battlerDef].commandingDondozo)
return TRUE; return TRUE;
if (CanAbilityBlockMove(battlerAtk, battlerDef, move, aiData->abilities[battlerDef])) if (CanAbilityBlockMove(battlerAtk, battlerDef, move, aiData->abilities[battlerDef]))
@ -1510,7 +1510,7 @@ bool32 IsSemiInvulnerable(u32 battlerDef, u32 move)
{ {
if (gStatuses3[battlerDef] & STATUS3_PHANTOM_FORCE) if (gStatuses3[battlerDef] & STATUS3_PHANTOM_FORCE)
return TRUE; return TRUE;
else if (gBattleStruct->battlerStates[battlerDef].commandingDondozo) else if (gBattleStruct->battlerState[battlerDef].commandingDondozo)
return TRUE; return TRUE;
else if (!MoveDamagesAirborne(move) && gStatuses3[battlerDef] & STATUS3_ON_AIR) else if (!MoveDamagesAirborne(move) && gStatuses3[battlerDef] & STATUS3_ON_AIR)
return TRUE; return TRUE;

View file

@ -386,9 +386,9 @@ void BattleArena_AddSkillPoints(u8 battler)
if (gHitMarker & HITMARKER_OBEYS) if (gHitMarker & HITMARKER_OBEYS)
{ {
if (gBattleStruct->battlerStates[battler].alreadyStatusedMoveAttempt) if (gBattleStruct->battlerState[battler].alreadyStatusedMoveAttempt)
{ {
gBattleStruct->battlerStates[battler].alreadyStatusedMoveAttempt = FALSE; gBattleStruct->battlerState[battler].alreadyStatusedMoveAttempt = FALSE;
skillPoints[battler] -= 2; skillPoints[battler] -= 2;
} }
else if (gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT) else if (gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)

View file

@ -2699,7 +2699,7 @@ static inline bool32 IsAnyAbilityPopUpActive(void)
{ {
for (u32 battler = 0; battler < gBattlersCount; battler++) for (u32 battler = 0; battler < gBattlersCount; battler++)
{ {
if (gBattleStruct->battlerStates[battler].activeAbilityPopUps) if (gBattleStruct->battlerState[battler].activeAbilityPopUps)
return TRUE; return TRUE;
} }
@ -2730,7 +2730,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
LoadSpritePalette(&sSpritePalette_AbilityPopUp); LoadSpritePalette(&sSpritePalette_AbilityPopUp);
} }
gBattleStruct->battlerStates[battlerId].activeAbilityPopUps = TRUE; gBattleStruct->battlerState[battlerId].activeAbilityPopUps = TRUE;
battlerPosition = GetBattlerPosition(battlerId); battlerPosition = GetBattlerPosition(battlerId);
if (isDoubleBattle) if (isDoubleBattle)
@ -2821,7 +2821,7 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite)
||(sprite->tRightToLeft && (sprite->x -= 4) <= sprite->tOriginalX - ABILITY_POP_UP_POS_X_SLIDE) ||(sprite->tRightToLeft && (sprite->x -= 4) <= sprite->tOriginalX - ABILITY_POP_UP_POS_X_SLIDE)
) )
{ {
gBattleStruct->battlerStates[sprite->tBattlerId].activeAbilityPopUps = FALSE; gBattleStruct->battlerState[sprite->tBattlerId].activeAbilityPopUps = FALSE;
DestroySprite(sprite); DestroySprite(sprite);
} }
} }
@ -2835,7 +2835,7 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite)
void DestroyAbilityPopUp(u8 battlerId) void DestroyAbilityPopUp(u8 battlerId)
{ {
if (gBattleStruct->battlerStates[battlerId].activeAbilityPopUps) if (gBattleStruct->battlerState[battlerId].activeAbilityPopUps)
{ {
gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][0]].tFrames = 0; gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][0]].tFrames = 0;
gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][1]].tFrames = 0; gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][1]].tFrames = 0;

View file

@ -3239,7 +3239,7 @@ void SwitchInClearSetData(u32 battler)
gBattleStruct->lastTakenMoveFrom[battler][1] = 0; gBattleStruct->lastTakenMoveFrom[battler][1] = 0;
gBattleStruct->lastTakenMoveFrom[battler][2] = 0; gBattleStruct->lastTakenMoveFrom[battler][2] = 0;
gBattleStruct->lastTakenMoveFrom[battler][3] = 0; gBattleStruct->lastTakenMoveFrom[battler][3] = 0;
gBattleStruct->battlerStates[battler].lastMoveFailed = FALSE; gBattleStruct->battlerState[battler].lastMoveFailed = FALSE;
gBattleStruct->palaceFlags &= ~(1u << battler); gBattleStruct->palaceFlags &= ~(1u << battler);
gBattleStruct->canPickupItem &= ~(1u << battler); gBattleStruct->canPickupItem &= ~(1u << battler);
@ -3936,7 +3936,7 @@ static void TryDoEventsBeforeFirstTurn(void)
*(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE; *(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE;
gChosenActionByBattler[i] = B_ACTION_NONE; gChosenActionByBattler[i] = B_ACTION_NONE;
gChosenMoveByBattler[i] = MOVE_NONE; gChosenMoveByBattler[i] = MOVE_NONE;
gBattleStruct->battlerStates[i].absentBattlerFlags = gAbsentBattlerFlags & (1u << i); gBattleStruct->battlerState[i].absentBattlerFlags = gAbsentBattlerFlags & (1u << i);
} }
TurnValuesCleanUp(FALSE); TurnValuesCleanUp(FALSE);
SpecialStatusesClear(); SpecialStatusesClear();
@ -4053,7 +4053,7 @@ void BattleTurnPassed(void)
{ {
gChosenActionByBattler[i] = B_ACTION_NONE; gChosenActionByBattler[i] = B_ACTION_NONE;
gChosenMoveByBattler[i] = MOVE_NONE; gChosenMoveByBattler[i] = MOVE_NONE;
gBattleStruct->battlerStates[i].absentBattlerFlags = gAbsentBattlerFlags & (1u << i); gBattleStruct->battlerState[i].absentBattlerFlags = gAbsentBattlerFlags & (1u << i);
} }
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_BATTLERS_COUNT; i++)
@ -4242,10 +4242,10 @@ static void HandleTurnActionSelectionState(void)
*(gBattleStruct->monToSwitchIntoId + battler) = PARTY_SIZE; *(gBattleStruct->monToSwitchIntoId + battler) = PARTY_SIZE;
if (gBattleTypeFlags & BATTLE_TYPE_MULTI if (gBattleTypeFlags & BATTLE_TYPE_MULTI
|| (position & BIT_FLANK) == B_FLANK_LEFT || (position & BIT_FLANK) == B_FLANK_LEFT
|| gBattleStruct->battlerStates[GetBattlerAtPosition(BATTLE_PARTNER(position))].absentBattlerFlags || gBattleStruct->battlerState[GetBattlerAtPosition(BATTLE_PARTNER(position))].absentBattlerFlags
|| gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(position))] == STATE_WAIT_ACTION_CONFIRMED) || gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(position))] == STATE_WAIT_ACTION_CONFIRMED)
{ {
if (gBattleStruct->battlerStates[battler].absentBattlerFlags || gBattleStruct->battlerStates[battler].commandingDondozo) if (gBattleStruct->battlerState[battler].absentBattlerFlags || gBattleStruct->battlerState[battler].commandingDondozo)
{ {
gChosenActionByBattler[battler] = B_ACTION_NOTHING_FAINTED; gChosenActionByBattler[battler] = B_ACTION_NOTHING_FAINTED;
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
@ -4620,7 +4620,7 @@ static void HandleTurnActionSelectionState(void)
if (((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !IsDoubleBattle()) if (((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !IsDoubleBattle())
|| (position & BIT_FLANK) != B_FLANK_LEFT || (position & BIT_FLANK) != B_FLANK_LEFT
|| gBattleStruct->battlerStates[GetBattlerAtPosition(BATTLE_PARTNER(position))].absentBattlerFlags) || gBattleStruct->battlerState[GetBattlerAtPosition(BATTLE_PARTNER(position))].absentBattlerFlags)
{ {
BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i); BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i);
} }
@ -5169,10 +5169,10 @@ static void TurnValuesCleanUp(bool8 var0)
gBattleMons[i].status2 &= ~STATUS2_SUBSTITUTE; gBattleMons[i].status2 &= ~STATUS2_SUBSTITUTE;
if (!(gStatuses3[i] & STATUS3_COMMANDER)) if (!(gStatuses3[i] & STATUS3_COMMANDER))
gBattleStruct->battlerStates[i].commandingDondozo = FALSE; gBattleStruct->battlerState[i].commandingDondozo = FALSE;
gSpecialStatuses[i].parentalBondState = PARENTAL_BOND_OFF; gSpecialStatuses[i].parentalBondState = PARENTAL_BOND_OFF;
gBattleStruct->battlerStates[i].usedEjectItem = FALSE; gBattleStruct->battlerState[i].usedEjectItem = FALSE;
} }
gSideStatuses[B_SIDE_PLAYER] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); gSideStatuses[B_SIDE_PLAYER] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK);
@ -5245,12 +5245,12 @@ static bool32 TryDoMoveEffectsBeforeMoves(void)
SortBattlersBySpeed(battlers, FALSE); SortBattlersBySpeed(battlers, FALSE);
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
{ {
if (!gBattleStruct->battlerStates[battlers[i]].focusPunchBattlers if (!gBattleStruct->battlerState[battlers[i]].focusPunchBattlers
&& !(gBattleMons[battlers[i]].status1 & STATUS1_SLEEP) && !(gBattleMons[battlers[i]].status1 & STATUS1_SLEEP)
&& !(gDisableStructs[battlers[i]].truantCounter) && !(gDisableStructs[battlers[i]].truantCounter)
&& !(gProtectStructs[battlers[i]].noValidMoves)) && !(gProtectStructs[battlers[i]].noValidMoves))
{ {
gBattleStruct->battlerStates[battlers[i]].focusPunchBattlers = TRUE; gBattleStruct->battlerState[battlers[i]].focusPunchBattlers = TRUE;
gBattlerAttacker = battlers[i]; gBattlerAttacker = battlers[i];
switch (GetMoveEffect(gChosenMoveByBattler[gBattlerAttacker])) switch (GetMoveEffect(gChosenMoveByBattler[gBattlerAttacker]))
{ {
@ -5373,7 +5373,7 @@ static void CheckChangingTurnOrderEffects(void)
gBattleStruct->effectsBeforeUsingMoveDone = FALSE; gBattleStruct->effectsBeforeUsingMoveDone = FALSE;
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{ {
gBattleStruct->battlerStates[i].focusPunchBattlers = FALSE; gBattleStruct->battlerState[i].focusPunchBattlers = FALSE;
gBattleStruct->ateBoost[i] = FALSE; gBattleStruct->ateBoost[i] = FALSE;
gSpecialStatuses[i].gemBoost = FALSE; gSpecialStatuses[i].gemBoost = FALSE;
} }

View file

@ -1166,9 +1166,9 @@ static void Cmd_attackcanceler(void)
s32 i; s32 i;
if (gBattleStruct->battlerStates[gBattlerAttacker].usedEjectItem) if (gBattleStruct->battlerState[gBattlerAttacker].usedEjectItem)
{ {
gBattleStruct->battlerStates[gBattlerAttacker].usedEjectItem = FALSE; gBattleStruct->battlerState[gBattlerAttacker].usedEjectItem = FALSE;
gCurrentActionFuncId = B_ACTION_TRY_FINISH; gCurrentActionFuncId = B_ACTION_TRY_FINISH;
return; return;
} }
@ -1432,7 +1432,7 @@ static bool32 AccuracyCalcHelper(u32 move, u32 battler)
{ {
effect = TRUE; effect = TRUE;
} }
else if (gBattleStruct->battlerStates[battler].pursuitTarget) else if (gBattleStruct->battlerState[battler].pursuitTarget)
{ {
effect = TRUE; effect = TRUE;
} }
@ -1581,7 +1581,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u
break; break;
} }
if (gBattleStruct->battlerStates[battlerAtk].usedMicleBerry) if (gBattleStruct->battlerState[battlerAtk].usedMicleBerry)
{ {
if (atkAbility == ABILITY_RIPEN) if (atkAbility == ABILITY_RIPEN)
calc = (calc * 140) / 100; // ripen gives 40% acc boost calc = (calc * 140) / 100; // ripen gives 40% acc boost
@ -3227,7 +3227,7 @@ void SetMoveEffect(bool32 primary, bool32 certain)
if (i != gBattlersCount) if (i != gBattlersCount)
break; break;
if (!CanBeSlept(gEffectBattler, GetBattlerAbility(gEffectBattler), BLOCKED_BY_SLEEP_CLAUSE) && !gBattleStruct->battlerStates[gEffectBattler].sleepClauseEffectExempt) if (!CanBeSlept(gEffectBattler, GetBattlerAbility(gEffectBattler), BLOCKED_BY_SLEEP_CLAUSE) && !gBattleStruct->battlerState[gEffectBattler].sleepClauseEffectExempt)
break; break;
cancelMultiTurnMovesResult = CancelMultiTurnMoves(gEffectBattler); cancelMultiTurnMovesResult = CancelMultiTurnMoves(gEffectBattler);
@ -5913,7 +5913,7 @@ static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent)
if (battler != gBattlerAttacker if (battler != gBattlerAttacker
&& !(excludeCurrent && battler == gBattlerTarget) && !(excludeCurrent && battler == gBattlerTarget)
&& IsBattlerAlive(battler) && IsBattlerAlive(battler)
&& !gBattleStruct->battlerStates[gBattlerAttacker].targetsDone[battler] && !gBattleStruct->battlerState[gBattlerAttacker].targetsDone[battler]
&& (GetBattlerSide(battler) != GetBattlerSide(gBattlerAttacker) || moveTarget == MOVE_TARGET_FOES_AND_ALLY)) && (GetBattlerSide(battler) != GetBattlerSide(gBattlerAttacker) || moveTarget == MOVE_TARGET_FOES_AND_ALLY))
break; break;
} }
@ -6414,9 +6414,9 @@ static void Cmd_moveend(void)
if ((gBattleStruct->moveResultFlags[gBattlerTarget] & (MOVE_RESULT_FAILED | MOVE_RESULT_DOESNT_AFFECT_FOE)) if ((gBattleStruct->moveResultFlags[gBattlerTarget] & (MOVE_RESULT_FAILED | MOVE_RESULT_DOESNT_AFFECT_FOE))
|| (gBattleMons[gBattlerAttacker].status2 & (STATUS2_FLINCHED)) || (gBattleMons[gBattlerAttacker].status2 & (STATUS2_FLINCHED))
|| gProtectStructs[gBattlerAttacker].prlzImmobility) || gProtectStructs[gBattlerAttacker].prlzImmobility)
gBattleStruct->battlerStates[gBattlerAttacker].lastMoveFailed = TRUE; gBattleStruct->battlerState[gBattlerAttacker].lastMoveFailed = TRUE;
else else
gBattleStruct->battlerStates[gBattlerAttacker].lastMoveFailed = FALSE; gBattleStruct->battlerState[gBattlerAttacker].lastMoveFailed = FALSE;
// Set ShellTrap to activate after the attacker's turn if target was hit by a physical move. // Set ShellTrap to activate after the attacker's turn if target was hit by a physical move.
if (GetMoveEffect(gChosenMoveByBattler[gBattlerTarget]) == EFFECT_SHELL_TRAP if (GetMoveEffect(gChosenMoveByBattler[gBattlerTarget]) == EFFECT_SHELL_TRAP
@ -6454,7 +6454,7 @@ static void Cmd_moveend(void)
} }
u32 originalEffect = GetMoveEffect(originallyUsedMove); u32 originalEffect = GetMoveEffect(originallyUsedMove);
if (!(gAbsentBattlerFlags & (1u << gBattlerAttacker)) if (!(gAbsentBattlerFlags & (1u << gBattlerAttacker))
&& !gBattleStruct->battlerStates[gBattlerAttacker].absentBattlerFlags && !gBattleStruct->battlerState[gBattlerAttacker].absentBattlerFlags
&& originalEffect != EFFECT_BATON_PASS && originalEffect != EFFECT_HEALING_WISH) && originalEffect != EFFECT_BATON_PASS && originalEffect != EFFECT_HEALING_WISH)
{ {
if (gHitMarker & HITMARKER_OBEYS) if (gHitMarker & HITMARKER_OBEYS)
@ -6498,7 +6498,7 @@ static void Cmd_moveend(void)
break; break;
case MOVEEND_MIRROR_MOVE: // mirror move case MOVEEND_MIRROR_MOVE: // mirror move
if (!(gAbsentBattlerFlags & (1u << gBattlerAttacker)) if (!(gAbsentBattlerFlags & (1u << gBattlerAttacker))
&& !gBattleStruct->battlerStates[gBattlerAttacker].absentBattlerFlags && !gBattleStruct->battlerState[gBattlerAttacker].absentBattlerFlags
&& !IsMoveMirrorMoveBanned(originallyUsedMove) && !IsMoveMirrorMoveBanned(originallyUsedMove)
&& gHitMarker & HITMARKER_OBEYS && gHitMarker & HITMARKER_OBEYS
&& gBattlerAttacker != gBattlerTarget && gBattlerAttacker != gBattlerTarget
@ -6518,7 +6518,7 @@ static void Cmd_moveend(void)
&& MoveResultHasEffect(gBattlerTarget)) && MoveResultHasEffect(gBattlerTarget))
gProtectStructs[gBattlerAttacker].targetAffected = TRUE; gProtectStructs[gBattlerAttacker].targetAffected = TRUE;
gBattleStruct->battlerStates[gBattlerAttacker].targetsDone[gBattlerTarget] = TRUE; gBattleStruct->battlerState[gBattlerAttacker].targetsDone[gBattlerTarget] = TRUE;
if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& IsDoubleBattle() && IsDoubleBattle()
&& !gProtectStructs[gBattlerAttacker].chargingTurn && !gProtectStructs[gBattlerAttacker].chargingTurn
@ -6549,9 +6549,9 @@ static void Cmd_moveend(void)
u8 originalBounceTarget = gBattlerAttacker; u8 originalBounceTarget = gBattlerAttacker;
gBattleStruct->bouncedMoveIsUsed = FALSE; gBattleStruct->bouncedMoveIsUsed = FALSE;
gBattlerAttacker = gBattleStruct->attackerBeforeBounce; gBattlerAttacker = gBattleStruct->attackerBeforeBounce;
gBattleStruct->battlerStates[gBattlerAttacker].targetsDone[originalBounceTarget] = TRUE; gBattleStruct->battlerState[gBattlerAttacker].targetsDone[originalBounceTarget] = TRUE;
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
gBattleStruct->battlerStates[originalBounceTarget].targetsDone[i] = FALSE; gBattleStruct->battlerState[originalBounceTarget].targetsDone[i] = FALSE;
nextTarget = GetNextTarget(moveTarget, FALSE); nextTarget = GetNextTarget(moveTarget, FALSE);
if (nextTarget != MAX_BATTLERS_COUNT) if (nextTarget != MAX_BATTLERS_COUNT)
{ {
@ -6721,7 +6721,7 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection
effect = TRUE; effect = TRUE;
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattleStruct->battlerStates[battler].usedEjectItem = TRUE; gBattleStruct->battlerState[battler].usedEjectItem = TRUE;
if (ejectButtonBattlers & (1u << battler)) if (ejectButtonBattlers & (1u << battler))
{ {
gBattlescriptCurrInstr = BattleScript_EjectButtonActivates; gBattlescriptCurrInstr = BattleScript_EjectButtonActivates;
@ -7010,7 +7010,7 @@ static void Cmd_moveend(void)
gBattleStruct->poisonPuppeteerConfusion = FALSE; gBattleStruct->poisonPuppeteerConfusion = FALSE;
gBattleStruct->fickleBeamBoosted = FALSE; gBattleStruct->fickleBeamBoosted = FALSE;
gBattleStruct->redCardActivates = FALSE; gBattleStruct->redCardActivates = FALSE;
gBattleStruct->battlerStates[gBattlerAttacker].usedMicleBerry = FALSE; gBattleStruct->battlerState[gBattlerAttacker].usedMicleBerry = FALSE;
if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
gBattleStruct->pledgeMove = FALSE; gBattleStruct->pledgeMove = FALSE;
if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE) if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE)
@ -7022,7 +7022,7 @@ static void Cmd_moveend(void)
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
{ {
gBattleStruct->battlerStates[gBattlerAttacker].targetsDone[i] = FALSE; gBattleStruct->battlerState[gBattlerAttacker].targetsDone[i] = FALSE;
if (gBattleStruct->commanderActive[i] != SPECIES_NONE && !IsBattlerAlive(i)) if (gBattleStruct->commanderActive[i] != SPECIES_NONE && !IsBattlerAlive(i))
{ {
@ -7036,7 +7036,7 @@ static void Cmd_moveend(void)
gBattleScripting.moveendState++; gBattleScripting.moveendState++;
break; break;
case MOVEEND_PURSUIT_NEXT_ACTION: case MOVEEND_PURSUIT_NEXT_ACTION:
if (gBattleStruct->battlerStates[gBattlerTarget].pursuitTarget) if (gBattleStruct->battlerState[gBattlerTarget].pursuitTarget)
{ {
u32 storedTarget = gBattlerTarget; u32 storedTarget = gBattlerTarget;
if (SetTargetToNextPursuiter(gBattlerTarget)) if (SetTargetToNextPursuiter(gBattlerTarget))
@ -7736,20 +7736,20 @@ static bool32 DoSwitchInEffectsForBattler(u32 battler)
} }
// Healing Wish activates before hazards. // Healing Wish activates before hazards.
// Starting from Gen8 - it heals only pokemon which can be healed. In gens 5,6,7 the effect activates anyways. // Starting from Gen8 - it heals only pokemon which can be healed. In gens 5,6,7 the effect activates anyways.
else if ((gBattleStruct->battlerStates[battler].storedHealingWish || gBattleStruct->battlerStates[battler].storedLunarDance) else if ((gBattleStruct->battlerState[battler].storedHealingWish || gBattleStruct->battlerState[battler].storedLunarDance)
&& (gBattleMons[battler].hp != gBattleMons[battler].maxHP || gBattleMons[battler].status1 != 0 || B_HEALING_WISH_SWITCH < GEN_8)) && (gBattleMons[battler].hp != gBattleMons[battler].maxHP || gBattleMons[battler].status1 != 0 || B_HEALING_WISH_SWITCH < GEN_8))
{ {
if (gBattleStruct->battlerStates[battler].storedHealingWish) if (gBattleStruct->battlerState[battler].storedHealingWish)
{ {
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_HealingWishActivates; gBattlescriptCurrInstr = BattleScript_HealingWishActivates;
gBattleStruct->battlerStates[battler].storedHealingWish = FALSE; gBattleStruct->battlerState[battler].storedHealingWish = FALSE;
} }
else // Lunar Dance else // Lunar Dance
{ {
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_LunarDanceActivates; gBattlescriptCurrInstr = BattleScript_LunarDanceActivates;
gBattleStruct->battlerStates[battler].storedLunarDance = FALSE; gBattleStruct->battlerState[battler].storedLunarDance = FALSE;
} }
} }
else if (!(gDisableStructs[battler].spikesDone) else if (!(gDisableStructs[battler].spikesDone)
@ -7898,7 +7898,7 @@ static bool32 DoSwitchInEffectsForBattler(u32 battler)
gBattleStruct->hpOnSwitchout[GetBattlerSide(i)] = gBattleMons[i].hp; gBattleStruct->hpOnSwitchout[GetBattlerSide(i)] = gBattleMons[i].hp;
} }
gBattleStruct->battlerStates[battler].forcedSwitch = FALSE; gBattleStruct->battlerState[battler].forcedSwitch = FALSE;
return FALSE; return FALSE;
} }
@ -7914,7 +7914,7 @@ static void Cmd_switchineffects(void)
{ {
// Multiple mons fainted and are being switched-in. Their abilities/hazards will play according to speed ties. // Multiple mons fainted and are being switched-in. Their abilities/hazards will play according to speed ties.
case BS_FAINTED_MULTIPLE_1: // Saves the battlers. case BS_FAINTED_MULTIPLE_1: // Saves the battlers.
gBattleStruct->battlerStates[battler].multipleSwitchInBattlers = TRUE; gBattleStruct->battlerState[battler].multipleSwitchInBattlers = TRUE;
UpdateSentMonFlags(battler); UpdateSentMonFlags(battler);
// Increment fainted battler. // Increment fainted battler.
@ -7943,7 +7943,7 @@ static void Cmd_switchineffects(void)
for (; gBattleStruct->multipleSwitchInCursor < gBattlersCount; gBattleStruct->multipleSwitchInCursor++) for (; gBattleStruct->multipleSwitchInCursor < gBattlersCount; gBattleStruct->multipleSwitchInCursor++)
{ {
gBattlerFainted = gBattleStruct->multipleSwitchInSortedBattlers[gBattleStruct->multipleSwitchInCursor]; gBattlerFainted = gBattleStruct->multipleSwitchInSortedBattlers[gBattleStruct->multipleSwitchInCursor];
if (gBattleStruct->battlerStates[gBattlerFainted].multipleSwitchInBattlers) if (gBattleStruct->battlerState[gBattlerFainted].multipleSwitchInBattlers)
{ {
if (DoSwitchInEffectsForBattler(gBattlerFainted)) if (DoSwitchInEffectsForBattler(gBattlerFainted))
return; return;
@ -7951,7 +7951,7 @@ static void Cmd_switchineffects(void)
} }
// All battlers done, end // All battlers done, end
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
gBattleStruct->battlerStates[i].multipleSwitchInBattlers = FALSE; gBattleStruct->battlerState[i].multipleSwitchInBattlers = FALSE;
gBattleStruct->multipleSwitchInState = 0; gBattleStruct->multipleSwitchInState = 0;
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
@ -10063,7 +10063,7 @@ static void Cmd_various(void)
case VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT: case VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT:
{ {
VARIOUS_ARGS(); VARIOUS_ARGS();
gBattleStruct->battlerStates[battler].alreadyStatusedMoveAttempt = TRUE; gBattleStruct->battlerState[battler].alreadyStatusedMoveAttempt = TRUE;
break; break;
} }
case VARIOUS_PALACE_TRY_ESCAPE_STATUS: case VARIOUS_PALACE_TRY_ESCAPE_STATUS:
@ -12539,7 +12539,7 @@ static void Cmd_forcerandomswitch(void)
{ {
*(gBattleStruct->battlerPartyIndexes + gBattlerTarget) = gBattlerPartyIndexes[gBattlerTarget]; *(gBattleStruct->battlerPartyIndexes + gBattlerTarget) = gBattlerPartyIndexes[gBattlerTarget];
gBattlescriptCurrInstr = BattleScript_RoarSuccessSwitch; gBattlescriptCurrInstr = BattleScript_RoarSuccessSwitch;
gBattleStruct->battlerStates[gBattlerTarget].forcedSwitch = TRUE; gBattleStruct->battlerState[gBattlerTarget].forcedSwitch = TRUE;
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = validMons[RandomUniform(RNG_FORCE_RANDOM_SWITCH, 0, validMonsCount - 1)]; *(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = validMons[RandomUniform(RNG_FORCE_RANDOM_SWITCH, 0, validMonsCount - 1)];
if (!IsMultiBattle()) if (!IsMultiBattle())
@ -14075,7 +14075,7 @@ static void Cmd_jumpifnopursuitswitchdmg(void)
if (SetTargetToNextPursuiter(gBattlerAttacker)) if (SetTargetToNextPursuiter(gBattlerAttacker))
{ {
ChangeOrderTargetAfterAttacker(); ChangeOrderTargetAfterAttacker();
gBattleStruct->battlerStates[gBattlerAttacker].pursuitTarget = TRUE; gBattleStruct->battlerState[gBattlerAttacker].pursuitTarget = TRUE;
gBattleStruct->pursuitSwitchByMove = gActionsByTurnOrder[gCurrentTurnActionNumber] == B_ACTION_USE_MOVE; gBattleStruct->pursuitSwitchByMove = gActionsByTurnOrder[gCurrentTurnActionNumber] == B_ACTION_USE_MOVE;
gBattleStruct->pursuitStoredSwitch = gBattleStruct->monToSwitchIntoId[gBattlerAttacker]; gBattleStruct->pursuitStoredSwitch = gBattleStruct->monToSwitchIntoId[gBattlerAttacker];
*(gBattleStruct->moveTarget + gBattlerTarget) = gBattlerAttacker; *(gBattleStruct->moveTarget + gBattlerTarget) = gBattlerAttacker;
@ -17673,11 +17673,11 @@ void BS_JumpIfSleepClause(void)
// Can freely sleep own partner // Can freely sleep own partner
if (IsDoubleBattle() && IsSleepClauseEnabled() && GetBattlerSide(gBattlerAttacker) == GetBattlerSide(gBattlerTarget)) if (IsDoubleBattle() && IsSleepClauseEnabled() && GetBattlerSide(gBattlerAttacker) == GetBattlerSide(gBattlerTarget))
{ {
gBattleStruct->battlerStates[gBattlerTarget].sleepClauseEffectExempt = TRUE; gBattleStruct->battlerState[gBattlerTarget].sleepClauseEffectExempt = TRUE;
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
return; return;
} }
gBattleStruct->battlerStates[gBattlerTarget].sleepClauseEffectExempt = FALSE; gBattleStruct->battlerState[gBattlerTarget].sleepClauseEffectExempt = FALSE;
// Can't sleep if clause is active otherwise // Can't sleep if clause is active otherwise
if (IsSleepClauseActiveForSide(GetBattlerSide(gBattlerTarget))) if (IsSleepClauseActiveForSide(GetBattlerSide(gBattlerTarget)))
gBattlescriptCurrInstr = cmd->jumpInstr; gBattlescriptCurrInstr = cmd->jumpInstr;
@ -17849,9 +17849,9 @@ void BS_StoreHealingWish(void)
u32 battler = GetBattlerForBattleScript(cmd->battler); u32 battler = GetBattlerForBattleScript(cmd->battler);
if (gCurrentMove == MOVE_LUNAR_DANCE) if (gCurrentMove == MOVE_LUNAR_DANCE)
gBattleStruct->battlerStates[battler].storedLunarDance = TRUE; gBattleStruct->battlerState[battler].storedLunarDance = TRUE;
else else
gBattleStruct->battlerStates[battler].storedHealingWish = TRUE; gBattleStruct->battlerState[battler].storedHealingWish = TRUE;
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }

View file

@ -239,8 +239,8 @@ void HandleAction_UseMove(void)
u16 moveTarget; u16 moveTarget;
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
if (gBattleStruct->battlerStates[gBattlerAttacker].absentBattlerFlags if (gBattleStruct->battlerState[gBattlerAttacker].absentBattlerFlags
|| gBattleStruct->battlerStates[gBattlerAttacker].commandingDondozo || gBattleStruct->battlerState[gBattlerAttacker].commandingDondozo
|| !IsBattlerAlive(gBattlerAttacker)) || !IsBattlerAlive(gBattlerAttacker))
{ {
gCurrentActionFuncId = B_ACTION_FINISHED; gCurrentActionFuncId = B_ACTION_FINISHED;
@ -334,7 +334,7 @@ void HandleAction_UseMove(void)
} }
else if (IsDoubleBattle() else if (IsDoubleBattle()
&& gSideTimers[side].followmeTimer == 0 && gSideTimers[side].followmeTimer == 0
&& !gBattleStruct->battlerStates[*(gBattleStruct->moveTarget + gBattlerAttacker)].pursuitTarget && !gBattleStruct->battlerState[*(gBattleStruct->moveTarget + gBattlerAttacker)].pursuitTarget
&& (!IsBattleMoveStatus(gCurrentMove) || (moveTarget != MOVE_TARGET_USER && moveTarget != MOVE_TARGET_ALL_BATTLERS)) && (!IsBattleMoveStatus(gCurrentMove) || (moveTarget != MOVE_TARGET_USER && moveTarget != MOVE_TARGET_ALL_BATTLERS))
&& ((GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC) && ((GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC)
|| (GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_STORM_DRAIN && moveType == TYPE_WATER))) || (GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_STORM_DRAIN && moveType == TYPE_WATER)))
@ -3281,7 +3281,7 @@ static void CancellerObedience(u32 *effect)
break; break;
case DISOBEYS_FALL_ASLEEP: case DISOBEYS_FALL_ASLEEP:
if (IsSleepClauseEnabled()) if (IsSleepClauseEnabled())
gBattleStruct->battlerStates[gBattlerAttacker].sleepClauseEffectExempt = TRUE; gBattleStruct->battlerState[gBattlerAttacker].sleepClauseEffectExempt = TRUE;
gBattlescriptCurrInstr = BattleScript_IgnoresAndFallsAsleep; gBattlescriptCurrInstr = BattleScript_IgnoresAndFallsAsleep;
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED; gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
break; break;
@ -5245,7 +5245,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
SaveBattlerAttacker(gBattlerAttacker); SaveBattlerAttacker(gBattlerAttacker);
gSpecialStatuses[battler].switchInAbilityDone = TRUE; gSpecialStatuses[battler].switchInAbilityDone = TRUE;
gBattlerAttacker = partner; gBattlerAttacker = partner;
gBattleStruct->battlerStates[battler].commandingDondozo = TRUE; gBattleStruct->battlerState[battler].commandingDondozo = TRUE;
gBattleStruct->commanderActive[partner] = gBattleMons[battler].species; gBattleStruct->commanderActive[partner] = gBattleMons[battler].species;
gStatuses3[battler] |= STATUS3_COMMANDER; gStatuses3[battler] |= STATUS3_COMMANDER;
if (gBattleMons[battler].status2 & STATUS2_CONFUSION if (gBattleMons[battler].status2 & STATUS2_CONFUSION
@ -5931,7 +5931,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
&& IsMoveMakingContact(move, gBattlerAttacker)) && IsMoveMakingContact(move, gBattlerAttacker))
{ {
if (IsSleepClauseEnabled()) if (IsSleepClauseEnabled())
gBattleStruct->battlerStates[gBattlerAttacker].sleepClauseEffectExempt = TRUE; gBattleStruct->battlerState[gBattlerAttacker].sleepClauseEffectExempt = TRUE;
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_SLEEP; gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_SLEEP;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor(); BattleScriptPushCursor();
@ -7045,7 +7045,7 @@ static u32 TrySetMicleBerry(u32 battler, u32 itemId, enum ItemEffect caseID)
{ {
if (HasEnoughHpToEatBerry(battler, 4, itemId)) if (HasEnoughHpToEatBerry(battler, 4, itemId))
{ {
gBattleStruct->battlerStates[battler].usedMicleBerry = TRUE; gBattleStruct->battlerState[battler].usedMicleBerry = TRUE;
if (caseID == ITEMEFFECT_ON_SWITCH_IN_FIRST_TURN || caseID == ITEMEFFECT_NORMAL) if (caseID == ITEMEFFECT_ON_SWITCH_IN_FIRST_TURN || caseID == ITEMEFFECT_NORMAL)
{ {
BattleScriptExecute(BattleScript_MicleBerryActivateEnd2); BattleScriptExecute(BattleScript_MicleBerryActivateEnd2);
@ -9130,7 +9130,7 @@ static inline u32 CalcMoveBasePower(struct DamageCalculationData *damageCalcData
basePower *= 2; basePower *= 2;
break; break;
case EFFECT_PURSUIT: case EFFECT_PURSUIT:
if (gBattleStruct->battlerStates[battlerDef].pursuitTarget) if (gBattleStruct->battlerState[battlerDef].pursuitTarget)
basePower *= 2; basePower *= 2;
break; break;
case EFFECT_NATURAL_GIFT: case EFFECT_NATURAL_GIFT:
@ -9359,7 +9359,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(struct DamageCalculationData *
modifier = uq4_12_multiply(modifier, UQ_4_12(0.5)); modifier = uq4_12_multiply(modifier, UQ_4_12(0.5));
break; break;
case EFFECT_STOMPING_TANTRUM: case EFFECT_STOMPING_TANTRUM:
if (gBattleStruct->battlerStates[battlerAtk].lastMoveFailed) if (gBattleStruct->battlerState[battlerAtk].lastMoveFailed)
modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); modifier = uq4_12_multiply(modifier, UQ_4_12(2.0));
break; break;
case EFFECT_MAGNITUDE: case EFFECT_MAGNITUDE:
@ -12143,9 +12143,9 @@ u32 GetBattleMoveType(u32 move)
void TryActivateSleepClause(u32 battler, u32 indexInParty) void TryActivateSleepClause(u32 battler, u32 indexInParty)
{ {
if (gBattleStruct->battlerStates[battler].sleepClauseEffectExempt) if (gBattleStruct->battlerState[battler].sleepClauseEffectExempt)
{ {
gBattleStruct->battlerStates[battler].sleepClauseEffectExempt = FALSE; gBattleStruct->battlerState[battler].sleepClauseEffectExempt = FALSE;
return; return;
} }
@ -12201,7 +12201,7 @@ bool32 DoesDestinyBondFail(u32 battler)
{ {
if (B_DESTINY_BOND_FAIL >= GEN_7 if (B_DESTINY_BOND_FAIL >= GEN_7
&& GetMoveEffect(gLastResultingMoves[battler]) == EFFECT_DESTINY_BOND && GetMoveEffect(gLastResultingMoves[battler]) == EFFECT_DESTINY_BOND
&& !gBattleStruct->battlerStates[battler].lastMoveFailed) && !gBattleStruct->battlerState[battler].lastMoveFailed)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@ -12227,7 +12227,7 @@ bool32 IsPursuitTargetSet(void)
{ {
for (u32 battler = 0; battler < gBattlersCount; battler++) for (u32 battler = 0; battler < gBattlersCount; battler++)
{ {
if (gBattleStruct->battlerStates[battler].pursuitTarget) if (gBattleStruct->battlerState[battler].pursuitTarget)
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -12236,13 +12236,13 @@ bool32 IsPursuitTargetSet(void)
void ClearPursuitValues(void) void ClearPursuitValues(void)
{ {
for (u32 i = 0; i < gBattlersCount; i++) for (u32 i = 0; i < gBattlersCount; i++)
gBattleStruct->battlerStates[i].pursuitTarget = FALSE; gBattleStruct->battlerState[i].pursuitTarget = FALSE;
gBattleStruct->pursuitSwitchByMove = FALSE; gBattleStruct->pursuitSwitchByMove = FALSE;
gBattleStruct->pursuitStoredSwitch = 0; gBattleStruct->pursuitStoredSwitch = 0;
} }
void ClearPursuitValuesIfSet(u32 battler) void ClearPursuitValuesIfSet(u32 battler)
{ {
if (gBattleStruct->battlerStates[battler].pursuitTarget) if (gBattleStruct->battlerState[battler].pursuitTarget)
ClearPursuitValues(); ClearPursuitValues();
} }