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:
committed by
Marcus Huderle
parent
dcbc8db6a3
commit
2dd706ca54
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user