mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
use max mon moves constant where able (#480)
* use max mon moves constant where able * fix errors in script commands file * fix more errors
This commit is contained in:
parent
dcbc8db6a3
commit
2dd706ca54
@ -419,7 +419,7 @@ struct BattleStruct
|
||||
u8 wildVictorySong;
|
||||
u8 dynamicMoveType;
|
||||
u8 wrappedBy[MAX_BATTLERS_COUNT];
|
||||
u16 assistPossibleMoves[PARTY_SIZE * 4]; // Each of mons can know max 4 moves.
|
||||
u16 assistPossibleMoves[PARTY_SIZE * MAX_MON_MOVES]; // Each of mons can know max 4 moves.
|
||||
u8 focusPunchBattlerId;
|
||||
u8 battlerPreventingSwitchout;
|
||||
u8 moneyMultiplier;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "apprentice.h"
|
||||
#include "battle.h"
|
||||
#include "battle_tower.h"
|
||||
#include "data2.h"
|
||||
#include "event_data.h"
|
||||
@ -1298,7 +1299,7 @@ static u16 sub_819FF98(u8 arg0)
|
||||
|
||||
knownMovesCount = j;
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
while (i <= MAX_MON_MOVES)
|
||||
{
|
||||
if (Random() % 2 == 0 || var_24 == TRUE)
|
||||
{
|
||||
@ -1317,7 +1318,7 @@ static u16 sub_819FF98(u8 arg0)
|
||||
if (knownMovesCount < 5)
|
||||
j = 0;
|
||||
else
|
||||
j = knownMovesCount - 4;
|
||||
j = knownMovesCount - MAX_MON_MOVES;
|
||||
|
||||
for (; j < knownMovesCount; j++)
|
||||
{
|
||||
@ -1331,7 +1332,7 @@ static u16 sub_819FF98(u8 arg0)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (knownMovesCount < 5)
|
||||
if (knownMovesCount <= MAX_MON_MOVES)
|
||||
{
|
||||
var_24 = TRUE;
|
||||
continue;
|
||||
@ -1340,10 +1341,10 @@ static u16 sub_819FF98(u8 arg0)
|
||||
{
|
||||
do
|
||||
{
|
||||
u8 learnsetId = Random() % (knownMovesCount - 4);
|
||||
u8 learnsetId = Random() % (knownMovesCount - MAX_MON_MOVES);
|
||||
moveId = learnset[learnsetId] & 0x1FF;
|
||||
valid = TRUE;
|
||||
for (j = knownMovesCount - 4; j < knownMovesCount; j++)
|
||||
for (j = knownMovesCount - MAX_MON_MOVES; j < knownMovesCount; j++)
|
||||
{
|
||||
if ((learnset[j] & 0x1FF) == moveId)
|
||||
{
|
||||
@ -1400,8 +1401,8 @@ static void GetLatestLearnedMoves(u16 species, u16 *moves)
|
||||
}
|
||||
|
||||
knownMovesCount = i;
|
||||
if (knownMovesCount > 4)
|
||||
knownMovesCount = 4;
|
||||
if (knownMovesCount > MAX_MON_MOVES)
|
||||
knownMovesCount = MAX_MON_MOVES;
|
||||
|
||||
for (j = 0; j < knownMovesCount; j++)
|
||||
moves[j] = learnset[(i - 1) - j] & 0x1FF;
|
||||
@ -1447,7 +1448,7 @@ static void sub_81A0390(u8 arg0)
|
||||
{
|
||||
gSaveBlock2Ptr->apprentices[0].party[i].species = 0;
|
||||
gSaveBlock2Ptr->apprentices[0].party[i].item = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
gSaveBlock2Ptr->apprentices[0].party[i].moves[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
|
||||
data[i] = 0;
|
||||
|
||||
// Conditional score reset, unlike Ruby.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (defaultScoreMoves & 1)
|
||||
AI_THINKING_STRUCT->score[i] = 100;
|
||||
@ -333,7 +333,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
|
||||
moveLimitations = CheckMoveLimitations(gActiveBattler, 0, 0xFF);
|
||||
|
||||
// Ignore moves that aren't possible to use.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBitTable[i] & moveLimitations)
|
||||
AI_THINKING_STRUCT->score[i] = 0;
|
||||
@ -424,7 +424,7 @@ static u8 ChooseMoveOrAction_Singles(void)
|
||||
currentMoveArray[0] = AI_THINKING_STRUCT->score[0];
|
||||
consideredMoveArray[0] = 0;
|
||||
|
||||
for (i = 1; i < 4; i++)
|
||||
for (i = 1; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[i] != MOVE_NONE)
|
||||
{
|
||||
@ -459,7 +459,7 @@ static u8 ChooseMoveOrAction_Doubles(void)
|
||||
s32 mostViableMovesNo;
|
||||
s16 mostMovePoints;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (i == sBattler_AI || gBattleMons[i].hp == 0)
|
||||
{
|
||||
@ -506,7 +506,7 @@ static u8 ChooseMoveOrAction_Doubles(void)
|
||||
mostViableMovesScores[0] = AI_THINKING_STRUCT->score[0];
|
||||
mostViableMovesIndices[0] = 0;
|
||||
mostViableMovesNo = 1;
|
||||
for (j = 1; j < 4; j++)
|
||||
for (j = 1; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[j] != 0)
|
||||
{
|
||||
@ -541,7 +541,7 @@ static u8 ChooseMoveOrAction_Doubles(void)
|
||||
mostViableTargetsArray[0] = 0;
|
||||
mostViableTargetsNo = 1;
|
||||
|
||||
for (i = 1; i < 4; i++)
|
||||
for (i = 1; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (mostMovePoints == bestMovePointsForTarget[i])
|
||||
{
|
||||
@ -594,7 +594,7 @@ static void BattleAI_DoAIProcessing(void)
|
||||
{
|
||||
AI_THINKING_STRUCT->movesetIndex++;
|
||||
|
||||
if (AI_THINKING_STRUCT->movesetIndex < 4 && !(AI_THINKING_STRUCT->aiAction & AI_ACTION_DO_NOT_ATTACK))
|
||||
if (AI_THINKING_STRUCT->movesetIndex < MAX_MON_MOVES && !(AI_THINKING_STRUCT->aiAction & AI_ACTION_DO_NOT_ATTACK))
|
||||
AI_THINKING_STRUCT->aiState = AIState_SettingUp;
|
||||
else
|
||||
AI_THINKING_STRUCT->aiState++;
|
||||
@ -610,7 +610,7 @@ static void RecordLastUsedMoveByTarget(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget])
|
||||
break;
|
||||
@ -627,7 +627,7 @@ void ClearBattlerMoveHistory(u8 battlerId)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
BATTLE_HISTORY->usedMoves[battlerId].moves[i] = MOVE_NONE;
|
||||
}
|
||||
|
||||
@ -1067,14 +1067,14 @@ static void BattleAICmd_if_user_has_attacking_move(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[i] != 0
|
||||
&& gBattleMoves[gBattleMons[sBattler_AI].moves[i]].power != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
gAIScriptPtr += 5;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||
@ -1084,14 +1084,14 @@ static void BattleAICmd_if_user_has_no_attacking_moves(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[i] != 0
|
||||
&& gBattleMoves[gBattleMons[sBattler_AI].moves[i]].power != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
gAIScriptPtr += 5;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||
@ -1182,7 +1182,7 @@ static void BattleAICmd_get_how_powerful_move_is(void)
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
|
||||
for (checkedMove = 0; checkedMove < 4; checkedMove++)
|
||||
for (checkedMove = 0; checkedMove < MAX_MON_MOVES; checkedMove++)
|
||||
{
|
||||
for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++)
|
||||
{
|
||||
@ -1207,13 +1207,13 @@ static void BattleAICmd_get_how_powerful_move_is(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (checkedMove = 0; checkedMove < 4; checkedMove++)
|
||||
for (checkedMove = 0; checkedMove < MAX_MON_MOVES; checkedMove++)
|
||||
{
|
||||
if (moveDmgs[checkedMove] > moveDmgs[AI_THINKING_STRUCT->movesetIndex])
|
||||
break;
|
||||
}
|
||||
|
||||
if (checkedMove == 4)
|
||||
if (checkedMove == MAX_MON_MOVES)
|
||||
AI_THINKING_STRUCT->funcResult = MOVE_MOST_POWERFUL; // Is the most powerful.
|
||||
else
|
||||
AI_THINKING_STRUCT->funcResult = MOVE_NOT_MOST_POWERFUL; // Not the most powerful.
|
||||
@ -1464,7 +1464,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void)
|
||||
gCritMultiplier = 1;
|
||||
AI_THINKING_STRUCT->funcResult = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
gBattleMoveDamage = 40;
|
||||
gCurrentMove = gBattleMons[sBattler_AI].moves[i];
|
||||
@ -1765,12 +1765,12 @@ static void BattleAICmd_if_has_move(void)
|
||||
switch (gAIScriptPtr[1])
|
||||
{
|
||||
case AI_USER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
gAIScriptPtr += 8;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||
@ -1783,25 +1783,25 @@ static void BattleAICmd_if_has_move(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI ^ BIT_FLANK].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
gAIScriptPtr += 8;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||
break;
|
||||
case AI_TARGET:
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
gAIScriptPtr += 8;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||
@ -1818,24 +1818,24 @@ static void BattleAICmd_if_doesnt_have_move(void)
|
||||
{
|
||||
case AI_USER:
|
||||
case AI_USER_PARTNER: // UB: no separate check for user partner.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
gAIScriptPtr += 8;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||
break;
|
||||
case AI_TARGET:
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
gAIScriptPtr += 8;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||
@ -1851,25 +1851,25 @@ static void BattleAICmd_if_has_move_with_effect(void)
|
||||
{
|
||||
case AI_USER:
|
||||
case AI_USER_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[sBattler_AI].moves[i] != 0 && gBattleMoves[gBattleMons[sBattler_AI].moves[i]].effect == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
gAIScriptPtr += 7;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||
break;
|
||||
case AI_TARGET:
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
// UB: checks sBattler_AI instead of gBattlerTarget.
|
||||
if (gBattleMons[sBattler_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i]].effect == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
gAIScriptPtr += 7;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||
@ -1885,24 +1885,24 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void)
|
||||
{
|
||||
case AI_USER:
|
||||
case AI_USER_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if(gBattleMons[sBattler_AI].moves[i] != 0 && gBattleMoves[gBattleMons[sBattler_AI].moves[i]].effect == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
gAIScriptPtr += 7;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||
break;
|
||||
case AI_TARGET:
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i]].effect == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
gAIScriptPtr += 7;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||
|
@ -49,7 +49,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
return FALSE;
|
||||
|
||||
// Check if Pokemon has a super effective move.
|
||||
for (opposingBattler = GetBattlerAtPosition(opposingPosition), i = 0; i < 4; i++)
|
||||
for (opposingBattler = GetBattlerAtPosition(opposingPosition), i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = gBattleMons[gActiveBattler].moves[i];
|
||||
if (move == MOVE_NONE)
|
||||
@ -93,7 +93,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
GetMonData(&party[i], MON_DATA_SPECIES); // Unused return value.
|
||||
GetMonData(&party[i], MON_DATA_ALT_ABILITY); // Unused return value.
|
||||
|
||||
for (opposingBattler = GetBattlerAtPosition(opposingPosition), j = 0; j < 4; j++)
|
||||
for (opposingBattler = GetBattlerAtPosition(opposingPosition), j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
move = GetMonData(&party[i], MON_DATA_MOVE1 + j);
|
||||
if (move == MOVE_NONE)
|
||||
@ -262,7 +262,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
|
||||
|
||||
if (!(gAbsentBattlerFlags & gBitTable[opposingBattler]))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = gBattleMons[gActiveBattler].moves[i];
|
||||
if (move == MOVE_NONE)
|
||||
@ -285,7 +285,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
|
||||
|
||||
if (!(gAbsentBattlerFlags & gBitTable[opposingBattler]))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = gBattleMons[gActiveBattler].moves[i];
|
||||
if (move == MOVE_NONE)
|
||||
@ -400,7 +400,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
|
||||
{
|
||||
battlerIn1 = gLastHitBy[gActiveBattler];
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
move = GetMonData(&party[i], MON_DATA_MOVE1 + j);
|
||||
if (move == 0)
|
||||
@ -715,14 +715,14 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
// Ok, we know the mon has the right typing but does it have at least one super effective move?
|
||||
if (bestMonId != PARTY_SIZE)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = GetMonData(&party[bestMonId], MON_DATA_MOVE1 + i);
|
||||
if (move != MOVE_NONE && TypeCalc(move, gActiveBattler, opposingBattler) & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
return bestMonId; // Has both the typing and at least one super effective move.
|
||||
|
||||
invalidMons |= gBitTable[bestMonId]; // Sorry buddy, we want something better.
|
||||
@ -757,7 +757,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
move = GetMonData(&party[i], MON_DATA_MOVE1 + j);
|
||||
gBattleMoveDamage = 0;
|
||||
|
@ -581,7 +581,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
@ -628,7 +628,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
@ -648,7 +648,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -913,7 +913,7 @@ static void SetLinkOpponentMonData(u8 monId)
|
||||
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -952,7 +952,7 @@ static void SetLinkOpponentMonData(u8 monId)
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -466,7 +466,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -513,7 +513,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -533,7 +533,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -798,7 +798,7 @@ static void SetLinkPartnerMonData(u8 monId)
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -837,7 +837,7 @@ static void SetLinkPartnerMonData(u8 monId)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -564,7 +564,7 @@ static u32 GetOpponentMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
@ -611,7 +611,7 @@ static u32 GetOpponentMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
@ -631,7 +631,7 @@ static u32 GetOpponentMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -905,7 +905,7 @@ static void SetOpponentMonData(u8 monId)
|
||||
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -944,7 +944,7 @@ static void SetOpponentMonData(u8 monId)
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -403,7 +403,7 @@ static void HandleInputChooseTarget(void)
|
||||
do
|
||||
{
|
||||
if (--i < 0)
|
||||
i = 4; // UB: array out of range
|
||||
i = MAX_BATTLERS_COUNT; // UB: array out of range
|
||||
gMultiUsePlayerCursor = GetBattlerAtPosition(identities[i]);
|
||||
} while (gMultiUsePlayerCursor == gBattlersCount);
|
||||
|
||||
@ -704,7 +704,7 @@ static void HandleMoveSwitching(void)
|
||||
|
||||
MoveSelectionDisplayMoveNames();
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
perMovePPBonuses[i] = (gBattleMons[gActiveBattler].ppBonuses & (3 << (i * 2))) >> (i * 2);
|
||||
|
||||
totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBattler]];
|
||||
@ -712,12 +712,12 @@ static void HandleMoveSwitching(void)
|
||||
perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses;
|
||||
|
||||
totalPPBonuses = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
totalPPBonuses |= perMovePPBonuses[i] << (i * 2);
|
||||
|
||||
gBattleMons[gActiveBattler].ppBonuses = totalPPBonuses;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
gBattleMons[gActiveBattler].moves[i] = moveInfo->moves[i];
|
||||
gBattleMons[gActiveBattler].pp[i] = moveInfo->currentPp[i];
|
||||
@ -725,14 +725,14 @@ static void HandleMoveSwitching(void)
|
||||
|
||||
if (!(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i);
|
||||
moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i);
|
||||
}
|
||||
|
||||
totalPPBonuses = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP_BONUSES);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2);
|
||||
|
||||
i = moveStruct.moves[gMoveSelectionCursor[gActiveBattler]];
|
||||
@ -748,10 +748,10 @@ static void HandleMoveSwitching(void)
|
||||
perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses;
|
||||
|
||||
totalPPBonuses = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
totalPPBonuses |= perMovePPBonuses[i] << (i * 2);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]);
|
||||
SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]);
|
||||
@ -1446,7 +1446,7 @@ static void MoveSelectionDisplayMoveNames(void)
|
||||
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
|
||||
gNumberOfMovesToChoose = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
MoveSelectionDestroyCursorAt(i);
|
||||
StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]);
|
||||
@ -1609,7 +1609,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -1656,7 +1656,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -1676,7 +1676,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -1950,7 +1950,7 @@ static void SetPlayerMonData(u8 monId)
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -1989,7 +1989,7 @@ static void SetPlayerMonData(u8 monId)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -653,7 +653,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -700,7 +700,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -720,7 +720,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -985,7 +985,7 @@ static void SetPlayerPartnerMonData(u8 monId)
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -1024,7 +1024,7 @@ static void SetPlayerPartnerMonData(u8 monId)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -564,7 +564,7 @@ static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
@ -611,7 +611,7 @@ static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
@ -631,7 +631,7 @@ static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -896,7 +896,7 @@ static void SetRecordedOpponentMonData(u8 monId)
|
||||
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -935,7 +935,7 @@ static void SetRecordedOpponentMonData(u8 monId)
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -547,7 +547,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -594,7 +594,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -614,7 +614,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -879,7 +879,7 @@ static void SetRecordedPlayerMonData(u8 monId)
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -918,7 +918,7 @@ static void SetRecordedPlayerMonData(u8 monId)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -463,7 +463,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -510,7 +510,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
@ -530,7 +530,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < 4; size++)
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
@ -795,7 +795,7 @@ static void SetWallyMonData(u8 monId)
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
@ -834,7 +834,7 @@ static void SetWallyMonData(u8 monId)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
|
@ -142,7 +142,7 @@ static void InitSinglePlayerBtlControllers(void)
|
||||
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
}
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
|
||||
sub_81B8D64(0, 0);
|
||||
sub_81B8D64(1, 0);
|
||||
@ -225,7 +225,7 @@ static void InitSinglePlayerBtlControllers(void)
|
||||
gBattlerControllerFuncs[3] = SetControllerToOpponent;
|
||||
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
{
|
||||
@ -245,7 +245,7 @@ static void InitSinglePlayerBtlControllers(void)
|
||||
gBattlerControllerFuncs[3] = SetControllerToOpponent;
|
||||
gBattlerPositions[3] = 3;
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
|
||||
sub_81B8D64(0, 0);
|
||||
sub_81B8D64(1, 0);
|
||||
@ -431,7 +431,7 @@ static void InitLinkBtlControllers(void)
|
||||
gBattlerControllerFuncs[3] = SetControllerToLinkOpponent;
|
||||
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -447,7 +447,7 @@ static void InitLinkBtlControllers(void)
|
||||
gBattlerControllerFuncs[2] = SetControllerToLinkOpponent;
|
||||
gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|
||||
@ -468,7 +468,7 @@ static void InitLinkBtlControllers(void)
|
||||
gBattlerControllerFuncs[3] = SetControllerToOpponent;
|
||||
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -484,7 +484,7 @@ static void InitLinkBtlControllers(void)
|
||||
gBattlerControllerFuncs[3] = SetControllerToLinkOpponent;
|
||||
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
|
||||
sub_81B8D64(0, 0);
|
||||
@ -574,7 +574,7 @@ static void InitLinkBtlControllers(void)
|
||||
}
|
||||
}
|
||||
|
||||
gBattlersCount = 4;
|
||||
gBattlersCount = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2554,7 +2554,7 @@ static void InitDomeTrainers(void)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.domeMonIds[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES, NULL);
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
gSaveBlock2Ptr->frontier.field_EFC[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + j, NULL);
|
||||
for (j = 0; j < 6; j++)
|
||||
gSaveBlock2Ptr->frontier.field_EFC[i].evs[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_HP_EV + j, NULL);
|
||||
@ -2814,7 +2814,7 @@ static void CreateDomeMon(u8 monPartyId, u16 tournamentTrainerId, u8 tournamentM
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].evSpread, otId);
|
||||
|
||||
happiness = 0xFF;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[monPartyId],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].moves[i], i);
|
||||
@ -2889,7 +2889,7 @@ static s32 sub_818FCBC(u16 tournamentTrainerId, bool8 arg1)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
array[i] = 0;
|
||||
for (moveId = 0; moveId < 4; moveId++)
|
||||
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
|
||||
{
|
||||
for (playerMonId = 0; playerMonId < 3; playerMonId++)
|
||||
{
|
||||
@ -2917,7 +2917,7 @@ static s32 sub_818FDB8(u16 tournamentTrainerId, bool8 arg1)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
array[i] = 0;
|
||||
for (moveId = 0; moveId < 4; moveId++)
|
||||
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
|
||||
{
|
||||
for (playerMonId = 0; playerMonId < 3; playerMonId++)
|
||||
{
|
||||
@ -4848,7 +4848,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
for (k = 0; k < DOME_TOURNAMENT_TRAINERS_COUNT; k++)
|
||||
{
|
||||
@ -5538,8 +5538,9 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
|
||||
// Calc move points of all 4 moves for all 3 pokemon hitting all 3 target mons.
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
// TODO: Clean this up, looks like a different data structure
|
||||
moveScores[i * 4 + j] = 0;
|
||||
if (gSaveBlock2Ptr->frontier.domeTrainers[winnerTournamentId].trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
moveIds[i * 4 + j] = GetFrontierBrainMonMove(i, j);
|
||||
@ -5600,7 +5601,7 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
|
||||
goto LABEL;
|
||||
while (j != 0)
|
||||
{
|
||||
for (j = 0, k = 0; k < 4 * 3; k++)
|
||||
for (j = 0, k = 0; k < MAX_MON_MOVES * 3; k++)
|
||||
{
|
||||
if (bestScore < moveScores[k])
|
||||
{
|
||||
@ -5627,7 +5628,7 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
|
||||
moveScores[j] = 0;
|
||||
bestScore = 0;
|
||||
j = 0;
|
||||
for (k = 0; k < 4 * 3; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES * 3; k++)
|
||||
j += moveScores[k];
|
||||
}
|
||||
}
|
||||
@ -6059,16 +6060,16 @@ static void sub_8194D68(void)
|
||||
s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
|
||||
s32 count;
|
||||
|
||||
for (moveSlot = 0; moveSlot < 4; moveSlot++)
|
||||
for (moveSlot = 0; moveSlot < MAX_MON_MOVES; moveSlot++)
|
||||
{
|
||||
count = 0;
|
||||
while (count < 4)
|
||||
while (count < MAX_MON_MOVES)
|
||||
{
|
||||
if (GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_MOVE1 + count, NULL) == GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveSlot, NULL))
|
||||
break;
|
||||
count++;
|
||||
}
|
||||
if (count == 4)
|
||||
if (count == MAX_MON_MOVES)
|
||||
SetMonMoveSlot(&gPlayerParty[i], MOVE_SKETCH, moveSlot);
|
||||
}
|
||||
|
||||
@ -6321,7 +6322,7 @@ static void DecideRoundWinners(u8 roundId)
|
||||
// Calculate points for both trainers.
|
||||
for (monId1 = 0; monId1 < 3; monId1++)
|
||||
{
|
||||
for (moveSlot = 0; moveSlot < 4; moveSlot++)
|
||||
for (moveSlot = 0; moveSlot < MAX_MON_MOVES; moveSlot++)
|
||||
{
|
||||
for (monId2 = 0; monId2 < 3; monId2++)
|
||||
{
|
||||
@ -6344,7 +6345,7 @@ static void DecideRoundWinners(u8 roundId)
|
||||
|
||||
for (monId1 = 0; monId1 < 3; monId1++)
|
||||
{
|
||||
for (moveSlot = 0; moveSlot < 4; moveSlot++)
|
||||
for (moveSlot = 0; moveSlot < MAX_MON_MOVES; moveSlot++)
|
||||
{
|
||||
for (monId2 = 0; monId2 < 3; monId2++)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_factory.h"
|
||||
#include "battle_factory_screen.h"
|
||||
#include "event_data.h"
|
||||
@ -433,7 +434,7 @@ static void sub_81A64C4(void)
|
||||
|
||||
CalculateMonStats(&gPlayerParty[i]);
|
||||
friendship = 0;
|
||||
for (k = 0; k < 4; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||
SetMonMoveAvoidReturn(&gPlayerParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
@ -473,7 +474,7 @@ static void sub_81A64C4(void)
|
||||
}
|
||||
|
||||
CalculateMonStats(&gEnemyParty[i]);
|
||||
for (k = 0; k < 4; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_ALT_ABILITY, &gSaveBlock2Ptr->frontier.field_E70[i + 3].abilityBit);
|
||||
@ -623,7 +624,7 @@ static void sub_81A6AEC(void)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
u16 monSetId = gUnknown_03006298[i];
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
u8 id = GetStyleForMove(gFacilityTrainerMons[monSetId].moves[j]);
|
||||
stylePoints[id]++;
|
||||
@ -756,7 +757,7 @@ void FillFactoryBrainParty(void)
|
||||
otId);
|
||||
|
||||
friendship = 0;
|
||||
for (k = 0; k < 4; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_factory_screen.h"
|
||||
#include "battle_factory.h"
|
||||
#include "sprite.h"
|
||||
@ -1691,7 +1692,7 @@ static void CreateFrontierFactorySelectableMons(u8 firstMonId)
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
otId);
|
||||
happiness = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_FRIENDSHIP, &happiness);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
@ -1721,7 +1722,7 @@ static void CreateTentFactorySelectableMons(u8 firstMonId)
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
otId);
|
||||
happiness = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_FRIENDSHIP, &happiness);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
|
@ -138,7 +138,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
if (i == var1)
|
||||
percent = 2;
|
||||
|
||||
for (var2 = 0, i = 0; i < 4; i++)
|
||||
for (var2 = 0, i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (moveInfo->moves[i] == MOVE_NONE)
|
||||
break;
|
||||
@ -160,7 +160,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
{
|
||||
var1 = 0, var2 = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (sub_805D4A8(moveInfo->moves[i]) == 0 && !(gBitTable[i] & unusableMovesBits))
|
||||
var1 += 0x1;
|
||||
@ -181,7 +181,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
{
|
||||
do
|
||||
{
|
||||
i = Random() % 4;
|
||||
i = Random() % MAX_MON_MOVES;
|
||||
if (!(gBitTable[i] & unusableMovesBits))
|
||||
chosenMoveId = i;
|
||||
} while (chosenMoveId == -1);
|
||||
@ -197,7 +197,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
|
||||
do
|
||||
{
|
||||
i = Random() % 4;
|
||||
i = Random() % MAX_MON_MOVES;
|
||||
if (!(gBitTable[i] & unusableMovesBits) && var2 == sub_805D4A8(moveInfo->moves[i]))
|
||||
chosenMoveId = i;
|
||||
} while (chosenMoveId == -1);
|
||||
@ -682,7 +682,7 @@ void BattleLoadAllHealthBoxesGfxAtOnce(void)
|
||||
LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[1]);
|
||||
LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[0]);
|
||||
LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[1]);
|
||||
numberOfBattlers = 4;
|
||||
numberOfBattlers = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
for (i = 0; i < numberOfBattlers; i++)
|
||||
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[i]]);
|
||||
|
@ -2005,7 +2005,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir
|
||||
fixedIV = partyData[i].iv * 31 / 255;
|
||||
CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, 2, 0);
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]);
|
||||
SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp);
|
||||
@ -2039,7 +2039,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir
|
||||
|
||||
SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem);
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]);
|
||||
SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp);
|
||||
|
@ -2857,7 +2857,7 @@ static void ChooseMoveUsedParticle(u8* textBuff)
|
||||
s32 counter = 0;
|
||||
u32 i = 0;
|
||||
|
||||
while (counter != 4)
|
||||
while (counter != MAX_MON_MOVES)
|
||||
{
|
||||
if (sGrammarMoveUsedTable[i] == 0)
|
||||
counter++;
|
||||
@ -2869,7 +2869,7 @@ static void ChooseMoveUsedParticle(u8* textBuff)
|
||||
{
|
||||
if (counter <= 2)
|
||||
StringCopy(textBuff, sText_SpaceIs); // is
|
||||
else if (counter <= 4)
|
||||
else if (counter <= MAX_MON_MOVES)
|
||||
StringCopy(textBuff, sText_ApostropheS); // 's
|
||||
}
|
||||
}
|
||||
@ -2900,7 +2900,7 @@ static void ChooseTypeOfMoveUsedString(u8* dst)
|
||||
while (*dst != EOS)
|
||||
dst++;
|
||||
|
||||
while (counter != 4)
|
||||
while (counter != MAX_MON_MOVES)
|
||||
{
|
||||
if (sGrammarMoveUsedTable[i] == MOVE_NONE)
|
||||
counter++;
|
||||
|
@ -793,7 +793,7 @@ static void HealMon(struct Pokemon *mon)
|
||||
SetMonData(mon, MON_DATA_HP, data);
|
||||
|
||||
ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u16 move = GetMonData(mon, MON_DATA_MOVE1 + i);
|
||||
data[0] = CalculatePPWithBonus(move, ppBonuses, i);
|
||||
@ -1137,7 +1137,7 @@ bool32 TryGenerateBattlePikeWildMon(bool8 checkKeenEyeIntimidate)
|
||||
else
|
||||
abilityBit = 0;
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &abilityBit);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(&gEnemyParty[0], wildMons[headerId][pikeMonId].moves[i], i);
|
||||
|
||||
CalculateMonStats(&gEnemyParty[0]);
|
||||
@ -1285,7 +1285,7 @@ static void TryHealMons(u8 healCount)
|
||||
else
|
||||
{
|
||||
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
u16 move = GetMonData(mon, MON_DATA_MOVE1 + j);
|
||||
max = CalculatePPWithBonus(move, ppBonuses, j);
|
||||
@ -1546,7 +1546,7 @@ static void sub_81A86C0(void)
|
||||
if (curr >= max && pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)) == 0)
|
||||
{
|
||||
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
u16 move = GetMonData(mon, MON_DATA_MOVE1 + j);
|
||||
max = CalculatePPWithBonus(move, ppBonuses, j);
|
||||
|
@ -1177,14 +1177,14 @@ static void sub_81A9834(void)
|
||||
{
|
||||
if (GetMonData(&gSaveBlock1Ptr->playerParty[id], MON_DATA_SPECIES, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL))
|
||||
{
|
||||
for (k = 0; k < 4; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||
{
|
||||
for (l = 0; l < 4; l++)
|
||||
for (l = 0; l < MAX_MON_MOVES; l++)
|
||||
{
|
||||
if (GetMonData(&gSaveBlock1Ptr->playerParty[id], MON_DATA_MOVE1 + l, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_MOVE1 + k, NULL))
|
||||
break;
|
||||
}
|
||||
if (l == 4)
|
||||
if (l == MAX_MON_MOVES)
|
||||
SetMonMoveSlot(&gPlayerParty[j], MOVE_SKETCH, k);
|
||||
}
|
||||
gSaveBlock1Ptr->playerParty[id] = gPlayerParty[j];
|
||||
@ -1360,7 +1360,7 @@ void GenerateBattlePyramidWildMon(void)
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(&gEnemyParty[0], wildMons[id].moves[i], i);
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] >= 140) // BUG: Reading outside the array as lvl was used for mon level instead of frontier lvl mode.
|
||||
|
@ -4599,12 +4599,12 @@ static void atk49_moveend(void)
|
||||
*choicedMoveAtk = gChosenMove;
|
||||
LOOP:
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].moves[i] == *choicedMoveAtk)
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
*choicedMoveAtk = 0;
|
||||
|
||||
gBattleScripting.atk49_state++;
|
||||
@ -5957,7 +5957,7 @@ static void atk5E(void)
|
||||
{
|
||||
s32 i;
|
||||
struct BattlePokemon *bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4];
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
gBattleMons[gActiveBattler].moves[i] = bufferPoke->moves[i];
|
||||
gBattleMons[gActiveBattler].pp[i] = bufferPoke->pp[i];
|
||||
@ -6652,12 +6652,12 @@ static void atk76_various(void)
|
||||
|
||||
choicedMove = &gBattleStruct->choicedMove[gActiveBattler];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gActiveBattler].moves[i] == *choicedMove)
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
*choicedMove = 0;
|
||||
}
|
||||
break;
|
||||
@ -7633,7 +7633,7 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type
|
||||
u8 moveChecked;
|
||||
u8 moveType;
|
||||
|
||||
while (validMoves < 4)
|
||||
while (validMoves < MAX_MON_MOVES)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].moves[validMoves] == 0)
|
||||
break;
|
||||
@ -8031,7 +8031,7 @@ static void atk9B_transformdataexecution(void)
|
||||
for (i = 0; i < offsetof(struct BattlePokemon, pp); i++)
|
||||
battleMonAttacker[i] = battleMonTarget[i];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMoves[gBattleMons[gBattlerAttacker].moves[i]].pp < 5)
|
||||
gBattleMons[gBattlerAttacker].pp[i] = gBattleMoves[gBattleMons[gBattlerAttacker].moves[i]].pp;
|
||||
@ -8097,13 +8097,13 @@ static void atk9D_mimicattackcopy(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].moves[i] == gLastMoves[gBattlerTarget])
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].moves[gCurrMovePos] = gLastMoves[gBattlerTarget];
|
||||
if (gBattleMoves[gLastMoves[gBattlerTarget]].pp < 5)
|
||||
@ -8134,7 +8134,7 @@ static void atk9E_metronome(void)
|
||||
if (gCurrentMove >= MOVES_COUNT)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < 4; i++); // ?
|
||||
for (i = 0; i < MAX_MON_MOVES; i++); // ?
|
||||
|
||||
i = -1;
|
||||
while (1)
|
||||
@ -8225,13 +8225,13 @@ static void atkA3_disablelastusedattack(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget])
|
||||
break;
|
||||
}
|
||||
if (gDisableStructs[gBattlerTarget].disabledMove == 0
|
||||
&& i != 4 && gBattleMons[gBattlerTarget].pp[i] != 0)
|
||||
&& i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0)
|
||||
{
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i])
|
||||
|
||||
@ -8250,7 +8250,7 @@ static void atkA4_trysetencore(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget])
|
||||
break;
|
||||
@ -8382,7 +8382,7 @@ static void atkA8_copymovepermanently(void) // sketch
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].moves[i] == MOVE_SKETCH)
|
||||
continue;
|
||||
@ -8390,7 +8390,7 @@ static void atkA8_copymovepermanently(void) // sketch
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
@ -8402,7 +8402,7 @@ static void atkA8_copymovepermanently(void) // sketch
|
||||
gBattleMons[gBattlerAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBattlerTarget]].pp;
|
||||
gActiveBattler = gBattlerAttacker;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
movePpData.moves[i] = gBattleMons[gBattlerAttacker].moves[i];
|
||||
movePpData.pp[i] = gBattleMons[gBattlerAttacker].pp[i];
|
||||
@ -8470,7 +8470,7 @@ static void atkA9_trychoosesleeptalkmove(void)
|
||||
s32 i;
|
||||
u8 unusableMovesBits = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (IsInvalidForSleepTalkOrAssist(gBattleMons[gBattlerAttacker].moves[i])
|
||||
|| gBattleMons[gBattlerAttacker].moves[i] == MOVE_FOCUS_PUNCH
|
||||
@ -8550,13 +8550,13 @@ static void atkAD_tryspiteppreduce(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gLastMoves[gBattlerTarget] == gBattleMons[gBattlerTarget].moves[i])
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != 4 && gBattleMons[gBattlerTarget].pp[i] > 1)
|
||||
if (i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] > 1)
|
||||
{
|
||||
s32 ppToDeduct = (Random() & 3) + 2;
|
||||
if (gBattleMons[gBattlerTarget].pp[i] < ppToDeduct)
|
||||
@ -9626,19 +9626,19 @@ static void atkDB_tryimprision(void)
|
||||
if (sideAttacker != GetBattlerSide(battlerId))
|
||||
{
|
||||
s32 attackerMoveId;
|
||||
for (attackerMoveId = 0; attackerMoveId < 4; attackerMoveId++)
|
||||
for (attackerMoveId = 0; attackerMoveId < MAX_MON_MOVES; attackerMoveId++)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].moves[attackerMoveId] == gBattleMons[battlerId].moves[i]
|
||||
&& gBattleMons[gBattlerAttacker].moves[attackerMoveId] != MOVE_NONE)
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
break;
|
||||
}
|
||||
if (attackerMoveId != 4)
|
||||
if (attackerMoveId != MAX_MON_MOVES)
|
||||
{
|
||||
gStatuses3[gBattlerAttacker] |= STATUS3_IMPRISONED_OTHERS;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
@ -9702,7 +9702,7 @@ static void atkDE_asistattackselect(void)
|
||||
if (GetMonData(&party[monId], MON_DATA_SPECIES2) == SPECIES_EGG)
|
||||
continue;
|
||||
|
||||
for (moveId = 0; moveId < 4; moveId++)
|
||||
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
|
||||
{
|
||||
s32 i = 0;
|
||||
u16 move = GetMonData(&party[monId], MON_DATA_MOVE1 + moveId);
|
||||
|
@ -1973,7 +1973,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
|
||||
friendship = 255;
|
||||
// Give the chosen pokemon its specified moves.
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
@ -2012,7 +2012,7 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
{
|
||||
CreateMonWithEVSpread(&gEnemyParty[firstMonId + i], apprentice->party[i].species, level, fixedIV, 8);
|
||||
friendship = 0xFF;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (apprentice->party[i].moves[j] == MOVE_FRUSTRATION)
|
||||
friendship = 0;
|
||||
@ -2102,7 +2102,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
|
||||
otID);
|
||||
|
||||
friendship = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[firstMonId + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
@ -2130,7 +2130,7 @@ static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId)
|
||||
otID);
|
||||
|
||||
friendship = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[firstMonId + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
@ -3193,7 +3193,7 @@ static void FillPartnerParty(u16 trainerId)
|
||||
TRUE, STEVEN_OTID);
|
||||
for (j = 0; j < 6; j++)
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_HP_EV + j, &sStevenMons[i].evs[j]);
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveSlot(&gPlayerParty[3 + i], sStevenMons[i].moves[j], j);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, gTrainers[TRAINER_STEVEN].trainerName);
|
||||
j = MALE;
|
||||
@ -3222,7 +3222,7 @@ static void FillPartnerParty(u16 trainerId)
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
otID);
|
||||
friendship = 0xFF;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gPlayerParty[3 + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
@ -3647,7 +3647,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
|
||||
friendship = 255;
|
||||
// Give the chosen pokemon its specified moves.
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
|
@ -746,7 +746,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
||||
if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, NULL))
|
||||
{
|
||||
for (sum = 0, j = 0; j < 4; j++)
|
||||
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||
sum += movePoints->points[0][i * 4 + j];
|
||||
|
||||
if (playerBestSum < sum)
|
||||
@ -760,7 +760,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||
species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL);
|
||||
if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG, NULL))
|
||||
{
|
||||
for (sum = 0, j = 0; j < 4; j++)
|
||||
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||
sum += movePoints->points[1][i * 4 + j];
|
||||
|
||||
if (opponentBestSum == sum)
|
||||
@ -781,7 +781,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (sum = 0, i = 0, j = 0; j < 4; j++)
|
||||
for (sum = 0, i = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (sum < movePoints->points[0][playerBestMonId * 4 + j])
|
||||
{
|
||||
@ -1422,7 +1422,7 @@ static void TrySetBattleSeminarShow(void)
|
||||
|
||||
dmgByMove[gMoveSelectionCursor[gBattlerAttacker]] = gBattleMoveDamage;
|
||||
currMoveSaved = gCurrentMove;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
gCurrentMove = gBattleMons[gBattlerAttacker].moves[i];
|
||||
powerOverride = 0;
|
||||
@ -1446,7 +1446,7 @@ static void TrySetBattleSeminarShow(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (i != gMoveSelectionCursor[gBattlerAttacker] && dmgByMove[i] > dmgByMove[gMoveSelectionCursor[gBattlerAttacker]])
|
||||
{
|
||||
@ -1458,7 +1458,7 @@ static void TrySetBattleSeminarShow(void)
|
||||
else
|
||||
bestMoveId = 1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (i != gMoveSelectionCursor[gBattlerAttacker] && dmgByMove[i] > dmgByMove[bestMoveId])
|
||||
bestMoveId = i;
|
||||
@ -1551,7 +1551,7 @@ u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId)
|
||||
i = 0;
|
||||
while (1)
|
||||
{
|
||||
if (i >= 4)
|
||||
if (i >= MAX_MON_MOVES)
|
||||
break;
|
||||
if (GetMonData(&party[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + i, NULL) == moveId)
|
||||
break;
|
||||
|
@ -85,13 +85,13 @@ void PressurePPLose(u8 defender, u8 attacker, u16 move)
|
||||
if (gBattleMons[defender].ability != ABILITY_PRESSURE)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[attacker].moves[i] == move)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4) // mons don't share any moves
|
||||
if (i == MAX_MON_MOVES) // mons don't share any moves
|
||||
return;
|
||||
|
||||
if (gBattleMons[attacker].pp[i] != 0)
|
||||
@ -116,12 +116,12 @@ void PressurePPLoseOnUsingImprision(u8 attacker)
|
||||
{
|
||||
if (atkSide != GetBattlerSide(i) && gBattleMons[i].ability == ABILITY_PRESSURE)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (gBattleMons[attacker].moves[j] == MOVE_IMPRISON)
|
||||
break;
|
||||
}
|
||||
if (j != 4)
|
||||
if (j != MAX_MON_MOVES)
|
||||
{
|
||||
imprisionPos = j;
|
||||
if (gBattleMons[attacker].pp[j] != 0)
|
||||
@ -149,12 +149,12 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker)
|
||||
{
|
||||
if (gBattleMons[i].ability == ABILITY_PRESSURE && i != attacker)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (gBattleMons[attacker].moves[j] == MOVE_PERISH_SONG)
|
||||
break;
|
||||
}
|
||||
if (j != 4)
|
||||
if (j != MAX_MON_MOVES)
|
||||
{
|
||||
perishSongPos = j;
|
||||
if (gBattleMons[attacker].pp[j] != 0)
|
||||
@ -163,7 +163,7 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker)
|
||||
}
|
||||
}
|
||||
|
||||
if (perishSongPos != 4
|
||||
if (perishSongPos != MAX_MON_MOVES
|
||||
&& !(gBattleMons[attacker].status2 & STATUS2_TRANSFORMED)
|
||||
&& !(gDisableStructs[attacker].unk18_b & gBitTable[perishSongPos]))
|
||||
{
|
||||
@ -426,7 +426,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].moves[i] == 0 && check & MOVE_LIMITATION_ZEROMOVE)
|
||||
unusableMoves |= gBitTable[i];
|
||||
@ -477,12 +477,12 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
|
||||
if (battlerSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
|
||||
{
|
||||
s32 j;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (move == gBattleMons[i].moves[j])
|
||||
break;
|
||||
}
|
||||
if (j < 4)
|
||||
if (j < MAX_MON_MOVES)
|
||||
imprisionedMoves++;
|
||||
}
|
||||
}
|
||||
@ -1021,12 +1021,12 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
if (gDisableStructs[gActiveBattler].disableTimer != 0)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gDisableStructs[gActiveBattler].disabledMove == gBattleMons[gActiveBattler].moves[i])
|
||||
break;
|
||||
}
|
||||
if (i == 4) // pokemon does not have the disabled move anymore
|
||||
if (i == MAX_MON_MOVES) // pokemon does not have the disabled move anymore
|
||||
{
|
||||
gDisableStructs[gActiveBattler].disabledMove = 0;
|
||||
gDisableStructs[gActiveBattler].disableTimer = 0;
|
||||
@ -2661,7 +2661,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||
else
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = GetMonData(mon, MON_DATA_MOVE1 + i);
|
||||
changedPP = GetMonData(mon, MON_DATA_PP1 + i);
|
||||
@ -2669,7 +2669,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
if (move && changedPP == 0)
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
if (i != MAX_MON_MOVES)
|
||||
{
|
||||
u8 maxPP = CalculatePPWithBonus(move, ppBonuses, i);
|
||||
if (changedPP + battlerHoldEffectParam > maxPP)
|
||||
|
@ -271,7 +271,7 @@ void LoadContestBgAfterMoveAnim(void)
|
||||
CopyBgTilemapBufferToVram(3);
|
||||
LoadCompressedPalette(gUnknown_08C16E90, 0, 0x200);
|
||||
sub_80D782C();
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u32 var = 5 + i;
|
||||
|
||||
@ -747,7 +747,7 @@ void sub_80D8490(u8 taskId)
|
||||
gBattle_BG0_Y = 0xA0;
|
||||
gBattle_BG2_Y = 0xA0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u16 move = gContestMons[gContestPlayerMonIndex].moves[i];
|
||||
u8 *r5 = sp8;
|
||||
@ -782,7 +782,7 @@ void sub_80D8610(u8 taskId)
|
||||
u8 numMoves = 0;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gContestMons[gContestPlayerMonIndex].moves[i] != MOVE_NONE)
|
||||
numMoves++;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "contest.h"
|
||||
#include "random.h"
|
||||
#include "contest_ai.h"
|
||||
@ -807,14 +808,14 @@ static void ContestAICmd_check_move_has_highest_appeal(void)
|
||||
u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4];
|
||||
u8 appeal = gContestEffects[gContestMoves[move].effect].appeal;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u16 newMove = gContestMons[eContestAI->contestantId].moves[i];
|
||||
if (newMove != 0 && appeal < gContestEffects[gContestMoves[newMove].effect].appeal)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
eContestAI->scriptResult = TRUE;
|
||||
else
|
||||
eContestAI->scriptResult = FALSE;
|
||||
@ -838,14 +839,14 @@ static void ContestAICmd_unk_2F(void)
|
||||
u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4];
|
||||
u8 jam = gContestEffects[gContestMoves[move].effect].jam;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u16 newMove = gContestMons[eContestAI->contestantId].moves[i];
|
||||
if (newMove != 0 && jam < gContestEffects[gContestMoves[newMove].effect].jam)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
if (i == MAX_MON_MOVES)
|
||||
eContestAI->scriptResult = TRUE;
|
||||
else
|
||||
eContestAI->scriptResult = FALSE;
|
||||
@ -1019,7 +1020,7 @@ static void ContestAICmd_check_combo_starter(void)
|
||||
int i;
|
||||
u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gContestMons[eContestAI->contestantId].moves[i])
|
||||
{
|
||||
@ -1065,7 +1066,7 @@ static void ContestAICmd_check_combo_finisher(void)
|
||||
int i;
|
||||
u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gContestMons[eContestAI->contestantId].moves[i])
|
||||
{
|
||||
@ -1677,7 +1678,7 @@ static void ContestAICmd_check_for_exciting_move(void)
|
||||
int result = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (gContestMons[eContestAI->contestantId].moves[i])
|
||||
{
|
||||
@ -1719,7 +1720,7 @@ static void ContestAICmd_unk_85(void)
|
||||
int i;
|
||||
u16 arg = T1_READ_16(gAIScriptPtr + 1);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u16 move = gContestMons[eContestAI->contestantId].moves[i];
|
||||
if (move == arg)
|
||||
|
@ -636,7 +636,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
|
||||
u16 i, j;
|
||||
|
||||
numSharedParentMoves = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
sHatchedEggMotherMoves[i] = 0;
|
||||
sHatchedEggFatherMoves[i] = 0;
|
||||
@ -648,7 +648,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
|
||||
sHatchedEggLevelUpMoves[i] = 0;
|
||||
|
||||
numLevelUpMoves = GetLevelUpMovesBySpecies(GetMonData(egg, MON_DATA_SPECIES), sHatchedEggLevelUpMoves);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
sHatchedEggFatherMoves[i] = GetBoxMonData(father, MON_DATA_MOVE1 + i);
|
||||
sHatchedEggMotherMoves[i] = GetBoxMonData(mother, MON_DATA_MOVE1 + i);
|
||||
@ -656,7 +656,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
|
||||
|
||||
numEggMoves = GetEggMoves(egg, sHatchedEggEggMoves);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (sHatchedEggFatherMoves[i] != MOVE_NONE)
|
||||
{
|
||||
@ -675,7 +675,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (sHatchedEggFatherMoves[i] != MOVE_NONE)
|
||||
{
|
||||
@ -689,18 +689,18 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (sHatchedEggFatherMoves[i] == MOVE_NONE)
|
||||
break;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (sHatchedEggFatherMoves[i] == sHatchedEggMotherMoves[j] && sHatchedEggFatherMoves[i] != MOVE_NONE)
|
||||
sHatchedEggFinalMoves[numSharedParentMoves++] = sHatchedEggFatherMoves[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (sHatchedEggFinalMoves[i] == MOVE_NONE)
|
||||
break;
|
||||
|
@ -2185,15 +2185,15 @@ static void sub_81A447C(void)
|
||||
u16 monId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
||||
if (monId < PARTY_SIZE)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
for (k = 0; k < 4; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||
{
|
||||
if (GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + k, NULL)
|
||||
== GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j, NULL))
|
||||
break;
|
||||
}
|
||||
if (k == 4)
|
||||
if (k == MAX_MON_MOVES)
|
||||
SetMonMoveSlot(&gPlayerParty[i], MOVE_SKETCH, j);
|
||||
}
|
||||
gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1] = gPlayerParty[i];
|
||||
@ -2511,7 +2511,7 @@ void CreateFrontierBrainPokemon(void)
|
||||
for (j = 0; j < NUM_STATS; j++)
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HP_EV + j, &sFrontierBrainsMons[facility][symbol][i].evs[j]);
|
||||
friendship = 0xFF;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[monPartyId], sFrontierBrainsMons[facility][symbol][i].moves[j], j);
|
||||
if (sFrontierBrainsMons[facility][symbol][i].moves[j] == MOVE_FRUSTRATION)
|
||||
|
@ -931,7 +931,7 @@ const u16 gSpeciesToNationalPokedexNum[] = // Assigns all species to the Nationa
|
||||
SPECIES_TO_NATIONAL(CHIMECHO),
|
||||
};
|
||||
|
||||
const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index)
|
||||
const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index)
|
||||
{
|
||||
HOENN_TO_NATIONAL(TREECKO),
|
||||
HOENN_TO_NATIONAL(GROVYLE),
|
||||
@ -1135,7 +1135,7 @@ const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pok
|
||||
HOENN_TO_NATIONAL(RAYQUAZA),
|
||||
HOENN_TO_NATIONAL(JIRACHI),
|
||||
HOENN_TO_NATIONAL(DEOXYS),
|
||||
HOENN_TO_NATIONAL(BULBASAUR), // Pokémon from here onwards are UNSEEN in the HoennDex.
|
||||
HOENN_TO_NATIONAL(BULBASAUR), // Pokémon from here onwards are UNSEEN in the HoennDex.
|
||||
HOENN_TO_NATIONAL(IVYSAUR),
|
||||
HOENN_TO_NATIONAL(VENUSAUR),
|
||||
HOENN_TO_NATIONAL(CHARMANDER),
|
||||
@ -2754,7 +2754,7 @@ void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src)
|
||||
|
||||
CreateMon(mon, src->species, src->level, 0, 1, src->personality, 1, src->otId);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(mon, src->moves[i], i);
|
||||
|
||||
SetMonData(mon, MON_DATA_PP_BONUSES, &src->ppBonuses);
|
||||
@ -2816,7 +2816,7 @@ void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl5
|
||||
|
||||
CreateMon(mon, src->species, level, 0, 1, src->personality, 1, src->otId);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(mon, src->moves[i], i);
|
||||
|
||||
SetMonData(mon, MON_DATA_PP_BONUSES, &src->ppBonuses);
|
||||
@ -2880,7 +2880,7 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m
|
||||
otId);
|
||||
|
||||
SetMonData(mon, MON_DATA_HELD_ITEM, &src->party[monId].item);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(mon, src->party[monId].moves[i], i);
|
||||
|
||||
evAmount = MAX_TOTAL_EVS / NUM_STATS;
|
||||
@ -2940,7 +2940,7 @@ void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest)
|
||||
|
||||
dest->heldItem = heldItem;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
dest->moves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
|
||||
|
||||
dest->level = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
@ -3266,7 +3266,7 @@ u16 GiveMoveToMon(struct Pokemon *mon, u16 move)
|
||||
u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
u16 existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
|
||||
if (!existingMove)
|
||||
@ -3285,7 +3285,7 @@ u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (!mon->moves[i])
|
||||
{
|
||||
@ -3388,7 +3388,7 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move)
|
||||
moves[3] = move;
|
||||
pp[3] = gBattleMoves[move].pp;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(mon, MON_DATA_MOVE1 + i, &moves[i]);
|
||||
SetMonData(mon, MON_DATA_PP1 + i, &pp[i]);
|
||||
@ -3415,7 +3415,7 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
|
||||
moves[3] = move;
|
||||
pp[3] = gBattleMoves[move].pp;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moves[i]);
|
||||
SetBoxMonData(boxMon, MON_DATA_PP1 + i, &pp[i]);
|
||||
@ -4849,7 +4849,7 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
|
||||
for (j = 0; j < 6; j++)
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gBattleResources->secretBase->party.EVs[i]);
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, &gBattleResources->secretBase->party.moves[i * 4 + j]);
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gBattleResources->secretBase->party.moves[i * 4 + j]].pp);
|
||||
@ -4938,7 +4938,7 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
|
||||
gBattleMons[battlerId].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL);
|
||||
gBattleMons[battlerId].item = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HELD_ITEM, NULL);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
gBattleMons[battlerId].moves[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE1 + i, NULL);
|
||||
gBattleMons[battlerId].pp[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP1 + i, NULL);
|
||||
@ -6480,7 +6480,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
|
||||
int i, j, k;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
|
||||
|
||||
for (i = 0; i < 20; i++)
|
||||
@ -6494,10 +6494,10 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
|
||||
|
||||
if (moveLevel <= (level << 9))
|
||||
{
|
||||
for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
|
||||
for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
|
||||
;
|
||||
|
||||
if (j == 4)
|
||||
if (j == MAX_MON_MOVES)
|
||||
{
|
||||
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++)
|
||||
;
|
||||
@ -6534,7 +6534,7 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
|
||||
if (species == SPECIES_EGG)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
|
||||
|
||||
for (i = 0; i < 20; i++)
|
||||
@ -6548,10 +6548,10 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
|
||||
|
||||
if (moveLevel <= (level << 9))
|
||||
{
|
||||
for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
|
||||
for (j = 0; j < MAX_MON_MOVES && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
|
||||
;
|
||||
|
||||
if (j == 4)
|
||||
if (j == MAX_MON_MOVES)
|
||||
{
|
||||
for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++)
|
||||
;
|
||||
@ -6795,7 +6795,7 @@ void BoxMonRestorePP(struct BoxPokemon *boxMon)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, 0))
|
||||
{
|
||||
|
@ -1315,7 +1315,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
|
||||
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
sum->moves[i] = GetMonData(a, MON_DATA_MOVE1+i);
|
||||
sum->pp[i] = GetMonData(a, MON_DATA_PP1+i);
|
||||
@ -1851,7 +1851,7 @@ static void sub_81C0F44(u8 taskId)
|
||||
static bool8 sub_81C1040(void)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 1; i < 4; i++)
|
||||
for (i = 1; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (pssData->summary.moves[i] != 0)
|
||||
return TRUE;
|
||||
@ -1867,14 +1867,14 @@ static void sub_81C1070(s16 *a, s8 b, u8 *c)
|
||||
|
||||
PlaySE(SE_SELECT);
|
||||
moveIndex = *c;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
moveIndex += b;
|
||||
if (moveIndex > a[0])
|
||||
moveIndex = 0;
|
||||
else if (moveIndex < 0)
|
||||
moveIndex = a[0];
|
||||
if (moveIndex == 4)
|
||||
if (moveIndex == MAX_MON_MOVES)
|
||||
{
|
||||
move = pssData->newMove;
|
||||
break;
|
||||
@ -3548,7 +3548,7 @@ static void PrintContestMoveDescription(u8 moveSlot)
|
||||
{
|
||||
u16 move;
|
||||
|
||||
if (moveSlot == 4)
|
||||
if (moveSlot == MAX_MON_MOVES)
|
||||
move = pssData->newMove;
|
||||
else
|
||||
move = pssData->summary.moves[moveSlot];
|
||||
@ -3744,7 +3744,7 @@ static void sub_81C4420(void)
|
||||
{
|
||||
u8 i;
|
||||
struct PokeSummary *summary = &pssData->summary;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (summary->moves[i] != MOVE_NONE)
|
||||
SetMoveTypeSpritePosAndType(gBattleMoves[summary->moves[i]].type, 0x55, 0x20 + (i * 0x10), i + 3);
|
||||
@ -3757,7 +3757,7 @@ static void sub_81C4484(void)
|
||||
{
|
||||
u8 i;
|
||||
struct PokeSummary *summary = &pssData->summary;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (summary->moves[i] != MOVE_NONE)
|
||||
SetMoveTypeSpritePosAndType(NUMBER_OF_MON_TYPES + gContestMoves[summary->moves[i]].contestCategory, 0x55, 0x20 + (i * 0x10), i + 3);
|
||||
|
@ -718,7 +718,7 @@ void RecordedBattle_CopyBattlerMoves(void)
|
||||
if (sUnknown_0203C7AC == 2)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
sPlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i];
|
||||
}
|
||||
@ -739,17 +739,17 @@ void sub_818603C(u8 arg0)
|
||||
{
|
||||
if (arg0 == 1)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (gBattleMons[battlerId].moves[j] != sPlayerMonMoves[battlerId / 2][j])
|
||||
break;
|
||||
}
|
||||
if (j != 4) // player's mon's move has been changed
|
||||
if (j != MAX_MON_MOVES) // player's mon's move has been changed
|
||||
{
|
||||
RecordedBattle_SetBattlerAction(battlerId, ACTION_MOVE_CHANGE);
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
for (k = 0; k < 4; k++)
|
||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||
{
|
||||
if (gBattleMons[battlerId].moves[j] == sPlayerMonMoves[battlerId / 2][k])
|
||||
{
|
||||
@ -772,11 +772,11 @@ void sub_818603C(u8 arg0)
|
||||
u8 var;
|
||||
|
||||
RecordedBattle_GetBattlerAction(battlerId);
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
ppBonuses[j] = ((gBattleMons[battlerId].ppBonuses & ((3 << (j << 1)))) >> (j << 1));
|
||||
}
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
array1[j] = RecordedBattle_GetBattlerAction(battlerId);
|
||||
movePp.moves[j] = gBattleMons[battlerId].moves[array1[j]];
|
||||
@ -784,14 +784,14 @@ void sub_818603C(u8 arg0)
|
||||
array3[j] = ppBonuses[array1[j]];
|
||||
array2[j] = (gDisableStructs[battlerId].unk18_b & gBitTable[j]) >> j;
|
||||
}
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
gBattleMons[battlerId].moves[j] = movePp.moves[j];
|
||||
gBattleMons[battlerId].pp[j] = movePp.pp[j];
|
||||
}
|
||||
gBattleMons[battlerId].ppBonuses = 0;
|
||||
gDisableStructs[battlerId].unk18_b = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
gBattleMons[battlerId].ppBonuses |= (array3[j]) << (j << 1);
|
||||
gDisableStructs[battlerId].unk18_b |= (array2[j]) << (j);
|
||||
@ -799,23 +799,23 @@ void sub_818603C(u8 arg0)
|
||||
|
||||
if (!(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED))
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
ppBonuses[j] = ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP_BONUSES, NULL) & ((3 << (j << 1)))) >> (j << 1));
|
||||
}
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
movePp.moves[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + array1[j], NULL);
|
||||
movePp.pp[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP1 + array1[j], NULL);
|
||||
array3[j] = ppBonuses[array1[j]];
|
||||
}
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_MOVE1 + j, &movePp.moves[j]);
|
||||
SetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PP1 + j, &movePp.pp[j]);
|
||||
}
|
||||
var = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
var |= (array3[j]) << (j << 1);
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ void HealPlayerParty(void)
|
||||
ppBonuses = GetMonData(&gPlayerParty[i], MON_DATA_PP_BONUSES);
|
||||
|
||||
// restore PP.
|
||||
for(j = 0; j < 4; j++)
|
||||
for(j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
arg[0] = CalculatePPWithBonus(GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j), ppBonuses, j);
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_PP1 + j, arg);
|
||||
|
Loading…
Reference in New Issue
Block a user