From 8200682b21fc6e9bb61e20a300fccb30970b995f Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Sun, 6 Sep 2020 19:02:30 -0400 Subject: u8 position --- src/battle_ai_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 748e4729a..032e5f407 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1299,7 +1299,7 @@ static void Cmd_count_usable_party_mons(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - u32 position; + u8 position; battlerOnField1 = gBattlerPartyIndexes[battlerId]; position = GetBattlerPosition(battlerId) ^ BIT_FLANK; battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)]; -- cgit v1.2.3 From 7dc95a0103af08c95c9093b6efa6c77af77a2538 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Sun, 13 Sep 2020 04:22:50 -0300 Subject: Undo PokeCodec's PRs This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183. --- src/battle_ai_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 032e5f407..748e4729a 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1299,7 +1299,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)]; -- cgit v1.2.3 From c724f2b8099645daf85884895047e60e23368e4b Mon Sep 17 00:00:00 2001 From: Kaz Date: Wed, 16 Sep 2020 22:01:45 -0400 Subject: battle_ai_script_commands.c: -g fixes the fakematch. --- src/battle_ai_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 032e5f407..5aef7a04f 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -616,8 +616,8 @@ static void RecordLastUsedMoveByTarget(void) { if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget]) break; - if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] != gLastMoves[gBattlerTarget] // HACK: This redundant condition is a hack to make the asm match. - && BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] == MOVE_NONE) + + if (BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] == MOVE_NONE) { BATTLE_HISTORY->usedMoves[gBattlerTarget].moves[i] = gLastMoves[gBattlerTarget]; break; -- cgit v1.2.3 From 52598983250fd8ad7b66ff2b9d77046859f169c8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 1 Oct 2020 17:20:38 -0400 Subject: Replace POKEMON_SLOTS_NUMBER --- src/battle_ai_script_commands.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 032e5f407..1fd0642ad 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 -- cgit v1.2.3 From 4b748d32ccd7c35716ea7c1b3267b0b0ac53bca4 Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Sat, 7 Nov 2020 18:21:17 -0500 Subject: Bugfix for ChooseMoveOrAction_Doubles. --- src/battle_ai_script_commands.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 4185f8017..2423cfe37 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -450,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]; -- cgit v1.2.3 From 81d95b9325ed2526ce638744408f453a8169abb4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 12 Dec 2020 23:28:01 -0500 Subject: Use BUGFIX for some inline fixes --- src/battle_ai_script_commands.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 2423cfe37..651f9da2a 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1613,8 +1613,10 @@ static void Cmd_if_status_not_in_party(void) if (species != SPECIES_NONE && species != SPECIES_EGG && hp != 0 && status == statusToCompareTo) { - gAIScriptPtr += 10; // UB: Still bugged in Emerald. Uncomment the return statement to fix. - // return; + gAIScriptPtr += 10; + #ifdef BUGFIX + return; + #endif } } -- cgit v1.2.3 From b1197ac2da952ca289d9e5ca37b49fd05207f65b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 12 Dec 2020 23:57:25 -0500 Subject: UBFIX for if_status_not_in_party --- src/battle_ai_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_ai_script_commands.c') diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 651f9da2a..952868e11 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1614,7 +1614,7 @@ static void Cmd_if_status_not_in_party(void) if (species != SPECIES_NONE && species != SPECIES_EGG && hp != 0 && status == statusToCompareTo) { gAIScriptPtr += 10; - #ifdef BUGFIX + #ifdef UBFIX return; #endif } -- cgit v1.2.3