diff --git a/include/battle.h b/include/battle.h index 73ae60831f53..19a7ca24253b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -795,13 +795,12 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER #define F_DYNAMIC_TYPE_IGNORE_PHYSICALITY (1 << 6) // If set, the dynamic type's physicality won't be used for certain move effects. #define F_DYNAMIC_TYPE_SET (1 << 7) // Set for all dynamic types to distinguish a dynamic type of Normal (0) from no dynamic type. -#define GET_MOVE_TYPE(move, typeArg) \ -{ \ +#define GET_MOVE_TYPE(move, typeArg) do { \ if (gBattleStruct->dynamicMoveType) \ typeArg = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; \ else \ - typeArg = gMovesInfo[move].type; \ -} + typeArg = gMovesInfo[move].type; \ +} while(0) #define IS_MOVE_PHYSICAL(move)(GetBattleMoveCategory(move) == DAMAGE_CATEGORY_PHYSICAL) #define IS_MOVE_SPECIAL(move)(GetBattleMoveCategory(move) == DAMAGE_CATEGORY_SPECIAL) diff --git a/src/battle_util.c b/src/battle_util.c index e87fa9f368f4..0ec40fb14fbc 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -10828,6 +10828,7 @@ bool32 ShouldGetStatBadgeBoost(u16 badgeFlag, u32 battler) u8 GetBattleMoveCategory(u32 moveId) { + u8 moveType; if (gBattleStruct != NULL && gBattleStruct->zmove.active && !IS_MOVE_STATUS(moveId)) return gBattleStruct->zmove.activeCategory; if (gBattleStruct != NULL && IsMaxMove(moveId)) // TODO: Might be buggy depending on when this is called. @@ -10839,10 +10840,11 @@ u8 GetBattleMoveCategory(u32 moveId) if (IS_MOVE_STATUS(moveId)) return DAMAGE_CATEGORY_STATUS; - else if (gMovesInfo[moveId].type < TYPE_MYSTERY) - return DAMAGE_CATEGORY_PHYSICAL; + else if (gMain.inBattle) + GET_MOVE_TYPE(moveId, moveType); else - return DAMAGE_CATEGORY_SPECIAL; + moveType = gMovesInfo[moveId].type; + return moveType < TYPE_MYSTERY ? DAMAGE_CATEGORY_PHYSICAL : DAMAGE_CATEGORY_SPECIAL; } static bool32 TryRemoveScreens(u32 battler)