From 964e7efba9f900db7ee3f51f3821165e81cd29ff Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 16 Oct 2021 16:23:17 -0400 Subject: [PATCH] fix MOVE_TARGET_ALL_BATTLERS and other u8 vars --- include/constants/battle.h | 2 +- include/pokemon.h | 2 +- src/battle_ai_main.c | 4 ++-- src/battle_controller_player.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/constants/battle.h b/include/constants/battle.h index c5d5601fa6..577b0ba609 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -386,6 +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 0x100 +#define MOVE_TARGET_ALL_BATTLERS (0x100 | MOVE_TARGET_USER) #endif // GUARD_CONSTANTS_BATTLE_H diff --git a/include/pokemon.h b/include/pokemon.h index 1524e16f4c..7478304127 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -216,7 +216,7 @@ struct BattleMove u8 accuracy; u8 pp; u8 secondaryEffectChance; - u8 target; + u16 target; s8 priority; u32 flags; u8 split; diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index edfd764645..972dc0ed66 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -517,7 +517,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u8 atkPriority = GetMovePriority(battlerAtk, move); u16 moveEffect = gBattleMoves[move].effect; s32 moveType; - u8 moveTarget = gBattleMoves[move].target; + u16 moveTarget = gBattleMoves[move].target; u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, AI_DATA->atkAbility, AI_DATA->defAbility, AI_DATA->atkHoldEffect, AI_DATA->defHoldEffect, move); u8 effectiveness = AI_GetMoveEffectiveness(move, battlerAtk, battlerDef); bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); @@ -2514,7 +2514,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // move data u8 moveType = gBattleMoves[move].type; u16 effect = gBattleMoves[move].effect; - u8 target = gBattleMoves[move].target; + u16 target = gBattleMoves[move].target; // ally data u8 battlerAtkPartner = AI_DATA->battlerAtkPartner; u16 atkPartnerAbility = AI_DATA->atkPartnerAbility; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 0d4cf51de9..e1cb2f54f0 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -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) + if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) { u32 i = 0; for (i = 0; i < gBattlersCount; i++)