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:
melthelesbian
2018-12-25 12:50:15 -05:00
committed by Marcus Huderle
parent dcbc8db6a3
commit 2dd706ca54
33 changed files with 265 additions and 260 deletions
+9 -8
View File
@@ -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)