diff options
author | Kurausukun <lord.uber1@gmail.com> | 2020-12-10 23:30:52 -0500 |
---|---|---|
committer | Kurausukun <lord.uber1@gmail.com> | 2020-12-10 23:30:52 -0500 |
commit | 58976ebaa8d73d174940f622ec36f22bcd2fd8a2 (patch) | |
tree | c27ab24ed83fdb16654b5814d681af487b119601 /src/battle_ai_script_commands.c | |
parent | 32ae13f9b66ab1b01146e5746e9350f97f055526 (diff) | |
parent | 8d29f65c6c7f34aa53ae2e7ae3e4f34a95025602 (diff) |
Merge remote-tracking branch 'upstream/master' into berry_crush
Diffstat (limited to 'src/battle_ai_script_commands.c')
-rw-r--r-- | src/battle_ai_script_commands.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 5aef7a04f..4adb39a5d 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -14,7 +14,6 @@ #include "constants/battle_ai.h" #include "constants/battle_move_effects.h" #include "constants/moves.h" -#include "constants/species.h" #define AI_ACTION_DONE 0x0001 #define AI_ACTION_FLEE 0x0002 @@ -451,7 +450,16 @@ static u8 ChooseMoveOrAction_Doubles(void) { s32 i; s32 j; +#ifndef BUGFIX s32 scriptsToRun; +#else + // the value assigned to this is a u32 (aiFlags) + // this becomes relevant because aiFlags can have bit 31 set + // and scriptsToRun is shifted + // this never happens in the vanilla game because bit 31 is + // only set when it's the first battle + u32 scriptsToRun; +#endif s16 bestMovePointsForTarget[MAX_BATTLERS_COUNT]; s8 mostViableTargetsArray[MAX_BATTLERS_COUNT]; u8 actionOrMoveIndex[MAX_BATTLERS_COUNT]; @@ -1299,7 +1307,7 @@ static void Cmd_count_usable_party_mons(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - u8 position; + u32 position; battlerOnField1 = gBattlerPartyIndexes[battlerId]; position = GetBattlerPosition(battlerId) ^ BIT_FLANK; battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)]; |