Fixed Hidden Power damage category for PSS < GEN_4 (#5053)

* Fixed Hidden Power damage category for PSS < GEN_4

* Fixed category display regression

* Wrapped GET_MOVE_TYPE

---------

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
hedara90 2024-07-29 13:45:14 +02:00 committed by GitHub
parent b54226dde3
commit a89820fa96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View file

@ -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)

View file

@ -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)