Rename battlerId to battler for consistency (#2126)

This commit is contained in:
Alex
2025-05-09 13:43:23 +02:00
committed by GitHub
parent 384b8f127e
commit 2044bea883
47 changed files with 1391 additions and 1390 deletions
+23 -23
View File
@@ -71,7 +71,7 @@ void FreeBattleResources(void)
}
}
void AdjustFriendshipOnBattleFaint(u8 battlerId)
void AdjustFriendshipOnBattleFaint(u8 battler)
{
u8 opposingBattlerId;
@@ -90,28 +90,28 @@ void AdjustFriendshipOnBattleFaint(u8 battlerId)
opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
}
if (gBattleMons[opposingBattlerId].level > gBattleMons[battlerId].level)
if (gBattleMons[opposingBattlerId].level > gBattleMons[battler].level)
{
if (gBattleMons[opposingBattlerId].level - gBattleMons[battlerId].level > 29)
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_LARGE);
if (gBattleMons[opposingBattlerId].level - gBattleMons[battler].level > 29)
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battler]], FRIENDSHIP_EVENT_FAINT_LARGE);
else
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_SMALL);
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battler]], FRIENDSHIP_EVENT_FAINT_SMALL);
}
else
{
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_SMALL);
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battler]], FRIENDSHIP_EVENT_FAINT_SMALL);
}
}
void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1)
void SwitchPartyOrderInGameMulti(u8 battler, u8 arg1)
{
if (GetBattlerSide(battlerId) != B_SIDE_OPPONENT)
if (GetBattlerSide(battler) != B_SIDE_OPPONENT)
{
s32 i;
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = *(i + (u8 *)(gBattleStruct->battlerPartyOrders));
SwitchPartyMonSlots(GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId]), GetPartyIdFromBattlePartyId(arg1));
SwitchPartyMonSlots(GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battler]), GetPartyIdFromBattlePartyId(arg1));
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
*(i + (u8 *)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i];
@@ -120,7 +120,7 @@ void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1)
// Called when a Pokémon is unable to attack during a Battle Palace battle.
// Check if it was because they are frozen/asleep, and if so try to cure the status.
u32 BattlePalace_TryEscapeStatus(u8 battlerId)
u32 BattlePalace_TryEscapeStatus(u8 battler)
{
u32 effect = 0;
@@ -129,13 +129,13 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
switch (gBattleCommunication[MULTIUSE_STATE])
{
case 0:
if (gBattleMons[battlerId].status1 & STATUS1_SLEEP)
if (gBattleMons[battler].status1 & STATUS1_SLEEP)
{
if (UproarWakeUpCheck(battlerId))
if (UproarWakeUpCheck(battler))
{
// Wake up from Uproar
gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP);
gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE);
gBattleMons[battler].status1 &= ~(STATUS1_SLEEP);
gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE);
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP_UPROAR;
gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp;
@@ -145,18 +145,18 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
{
u32 toSub;
if (gBattleMons[battlerId].ability == ABILITY_EARLY_BIRD)
if (gBattleMons[battler].ability == ABILITY_EARLY_BIRD)
toSub = 2;
else
toSub = 1;
// Reduce number of sleep turns
if ((gBattleMons[battlerId].status1 & STATUS1_SLEEP) < toSub)
gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP);
if ((gBattleMons[battler].status1 & STATUS1_SLEEP) < toSub)
gBattleMons[battler].status1 &= ~(STATUS1_SLEEP);
else
gBattleMons[battlerId].status1 -= toSub;
gBattleMons[battler].status1 -= toSub;
if (gBattleMons[battlerId].status1 & STATUS1_SLEEP)
if (gBattleMons[battler].status1 & STATUS1_SLEEP)
{
// Still asleep
gBattlescriptCurrInstr = BattleScript_MoveUsedIsAsleep;
@@ -165,7 +165,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
else
{
// Wake up
gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE);
gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE);
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP;
gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp;
@@ -176,7 +176,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
gBattleCommunication[MULTIUSE_STATE]++;
break;
case 1:
if (gBattleMons[battlerId].status1 & STATUS1_FREEZE)
if (gBattleMons[battler].status1 & STATUS1_FREEZE)
{
if (Random() % 5 != 0)
{
@@ -186,7 +186,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
else
{
// Unfreeze
gBattleMons[battlerId].status1 &= ~(STATUS1_FREEZE);
gBattleMons[battler].status1 &= ~(STATUS1_FREEZE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED;
@@ -203,7 +203,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
if (effect == 2)
{
gActiveBattler = battlerId;
gActiveBattler = battler;
BtlController_EmitSetMonData(B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
}