Replace: moveId -> move, moveIdx -> moveIndex (#2134)

This commit is contained in:
Alex
2025-05-09 17:33:23 +02:00
committed by GitHub
parent 2044bea883
commit baf5be2035
23 changed files with 133 additions and 133 deletions
+19 -19
View File
@@ -2678,24 +2678,24 @@ int GetDomeTrainerSelectedMons(u16 tournamentTrainerId)
static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom)
{
int i, moveId, playerMonId;
int i, moveIndex, playerMonId;
int partyMovePoints[FRONTIER_PARTY_SIZE];
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
partyMovePoints[i] = 0;
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
{
for (playerMonId = 0; playerMonId < FRONTIER_PARTY_SIZE; playerMonId++)
{
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
{
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId),
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex),
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD);
}
else
{
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId],
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex],
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD);
}
}
@@ -2707,24 +2707,24 @@ static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom)
// Identical to function above, but uses EFFECTIVENESS_MODE_BAD
static int SelectOpponentMons_Bad(u16 tournamentTrainerId, bool8 allowRandom)
{
int i, moveId, playerMonId;
int i, moveIndex, playerMonId;
int partyMovePoints[FRONTIER_PARTY_SIZE];
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
partyMovePoints[i] = 0;
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
{
for (playerMonId = 0; playerMonId < FRONTIER_PARTY_SIZE; playerMonId++)
{
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
{
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId),
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex),
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD);
}
else
{
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId],
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex],
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD);
}
}
@@ -5222,7 +5222,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
{
int i, j, k;
int moveScores[MAX_MON_MOVES * FRONTIER_PARTY_SIZE];
u16 moveIds[MAX_MON_MOVES * FRONTIER_PARTY_SIZE];
u16 moves[MAX_MON_MOVES * FRONTIER_PARTY_SIZE];
u16 bestScore = 0;
u16 bestId = 0;
int movePower = 0;
@@ -5236,17 +5236,17 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
// TODO: Clean this up, looks like a different data structure (2D array)
moveScores[i * MAX_MON_MOVES + j] = 0;
if (DOME_TRAINERS[winnerTournamentId].trainerId == TRAINER_FRONTIER_BRAIN)
moveIds[i * MAX_MON_MOVES + j] = GetFrontierBrainMonMove(i, j);
moves[i * MAX_MON_MOVES + j] = GetFrontierBrainMonMove(i, j);
else
moveIds[i * MAX_MON_MOVES + j] = gFacilityTrainerMons[DOME_MONS[winnerTournamentId][i]].moves[j];
moves[i * MAX_MON_MOVES + j] = gFacilityTrainerMons[DOME_MONS[winnerTournamentId][i]].moves[j];
movePower = gBattleMoves[moveIds[i * MAX_MON_MOVES + j]].power;
movePower = gBattleMoves[moves[i * MAX_MON_MOVES + j]].power;
if (movePower == 0)
movePower = 40;
else if (movePower == 1)
movePower = 60;
else if (moveIds[i * MAX_MON_MOVES + j] == MOVE_SELF_DESTRUCT
|| moveIds[i * MAX_MON_MOVES + j] == MOVE_EXPLOSION)
else if (moves[i * MAX_MON_MOVES + j] == MOVE_SELF_DESTRUCT
|| moves[i * MAX_MON_MOVES + j] == MOVE_EXPLOSION)
movePower /= 2;
for (k = 0; k < FRONTIER_PARTY_SIZE; k++)
@@ -5265,7 +5265,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
else
targetAbility = gSpeciesInfo[targetSpecies].abilities[0];
var = AI_TypeCalc(moveIds[i * MAX_MON_MOVES + j], targetSpecies, targetAbility);
var = AI_TypeCalc(moves[i * MAX_MON_MOVES + j], targetSpecies, targetAbility);
if (var & MOVE_RESULT_NOT_VERY_EFFECTIVE && var & MOVE_RESULT_SUPER_EFFECTIVE)
moveScores[i * MAX_MON_MOVES + j] += movePower;
else if (var & MOVE_RESULT_NO_EFFECT)
@@ -5285,7 +5285,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
}
else if (bestScore == moveScores[i * MAX_MON_MOVES + j])
{
if (moveIds[bestId] < moveIds[i * MAX_MON_MOVES + j]) // Why not use (Random() & 1) instead of promoting moves with a higher id?
if (moves[bestId] < moves[i * MAX_MON_MOVES + j]) // Why not use (Random() & 1) instead of promoting moves with a higher id?
bestId = i * MAX_MON_MOVES + j;
}
}
@@ -5296,7 +5296,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
{
for (i = 0; i < roundId - 1; i++)
{
if (gSaveBlock2Ptr->frontier.domeWinningMoves[GetOpposingNPCTournamentIdByRound(winnerTournamentId, i)] == moveIds[j])
if (gSaveBlock2Ptr->frontier.domeWinningMoves[GetOpposingNPCTournamentIdByRound(winnerTournamentId, i)] == moves[j])
break;
}
if (i != roundId - 1)
@@ -5316,7 +5316,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
j = k;
bestScore = moveScores[k];
}
else if (bestScore == moveScores[k] && moveIds[j] < moveIds[k]) // Yes, these conditions are redundant
else if (bestScore == moveScores[k] && moves[j] < moves[k]) // Yes, these conditions are redundant
{
j = k;
bestScore = moveScores[k];
@@ -5328,7 +5328,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
if (moveScores[j] == 0)
j = bestId;
return moveIds[j];
return moves[j];
}
static void Task_ShowTourneyTree(u8 taskId)