summaryrefslogtreecommitdiff
path: root/src/battle_ai_switch_items.c
diff options
context:
space:
mode:
authormelthelesbian <44884535+melthelesbian@users.noreply.github.com>2018-12-25 12:50:15 -0500
committerMarcus Huderle <huderlem@gmail.com>2018-12-25 11:50:15 -0600
commit2dd706ca5410d98ad214ceff7026d6db276f4d5a (patch)
tree20d184fb4f7e48d965c6c88b39dfd7fc11d3dd86 /src/battle_ai_switch_items.c
parentdcbc8db6a32e70651163a132950d486d93a58254 (diff)
use max mon moves constant where able (#480)
* use max mon moves constant where able * fix errors in script commands file * fix more errors
Diffstat (limited to 'src/battle_ai_switch_items.c')
-rw-r--r--src/battle_ai_switch_items.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c
index ad25b483c..a5958ebc6 100644
--- a/src/battle_ai_switch_items.c
+++ b/src/battle_ai_switch_items.c
@@ -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;