From 5509ceea0420afdb3628af207f28d7a7db3283d3 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 16 Oct 2021 16:10:45 -0400 Subject: [PATCH] expand move target field --- include/battle.h | 2 +- include/battle_util.h | 2 +- include/constants/battle.h | 3 +-- src/battle_controller_player.c | 4 ++-- src/battle_util.c | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/battle.h b/include/battle.h index 22b60d6e4f..26c6b3e40a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -491,7 +491,7 @@ struct BattleStruct u8 turnEffectsBattlerId; u8 turnCountersTracker; u16 wrappedMove[MAX_BATTLERS_COUNT]; - u8 moveTarget[MAX_BATTLERS_COUNT]; + u16 moveTarget[MAX_BATTLERS_COUNT]; u8 expGetterMonId; u8 wildVictorySong; u8 dynamicMoveType; diff --git a/include/battle_util.h b/include/battle_util.h index 7d1b99f347..ee7337ef2d 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -109,7 +109,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn); void ClearFuryCutterDestinyBondGrudge(u8 battlerId); void HandleAction_RunBattleScript(void); u32 SetRandomTarget(u32 battlerId); -u8 GetMoveTarget(u16 move, u8 setTarget); +u32 GetMoveTarget(u16 move, u8 setTarget); u8 IsMonDisobedient(void); u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating); u32 GetBattlerHoldEffectParam(u8 battlerId); diff --git a/include/constants/battle.h b/include/constants/battle.h index 90294b4b4d..c5d5601fa6 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -386,7 +386,6 @@ #define MOVE_TARGET_FOES_AND_ALLY 0x20 #define MOVE_TARGET_OPPONENTS_FIELD 0x40 #define MOVE_TARGET_ALLY 0x80 - -#define MOVE_TARGET_ALL_BATTLERS (MOVE_TARGET_BOTH | MOVE_TARGET_OPPONENTS_FIELD) +#define MOVE_TARGET_ALL_BATTLERS 0x100 #endif // GUARD_CONSTANTS_BATTLE_H diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 877e447508..0d4cf51de9 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -590,7 +590,7 @@ static void TryShowAsTarget(u32 battlerId) static void HandleInputChooseMove(void) { - u8 moveTarget; + u16 moveTarget; u32 canSelectTarget = 0; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleResources->bufferA[gActiveBattler][4]); @@ -644,7 +644,7 @@ static void HandleInputChooseMove(void) // Show all available targets for multi-target moves if (B_SHOW_TARGETS) { - if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) + if (moveTarget & MOVE_TARGET_ALL_BATTLERS) { u32 i = 0; for (i = 0; i < gBattlersCount; i++) diff --git a/src/battle_util.c b/src/battle_util.c index e01c89fca9..cdacaf1799 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7018,7 +7018,7 @@ u32 SetRandomTarget(u32 battlerId) return target; } -u8 GetMoveTarget(u16 move, u8 setTarget) +u32 GetMoveTarget(u16 move, u8 setTarget) { u8 targetBattler = 0; u32 i, moveTarget, side;