From 2dd706ca5410d98ad214ceff7026d6db276f4d5a Mon Sep 17 00:00:00 2001 From: melthelesbian <44884535+melthelesbian@users.noreply.github.com> Date: Tue, 25 Dec 2018 12:50:15 -0500 Subject: use max mon moves constant where able (#480) * use max mon moves constant where able * fix errors in script commands file * fix more errors --- src/contest_ai.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/contest_ai.c') diff --git a/src/contest_ai.c b/src/contest_ai.c index 1342ea102..97e8c8f29 100644 --- a/src/contest_ai.c +++ b/src/contest_ai.c @@ -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) -- cgit v1.2.3