Skip to content

Commit

Permalink
Fixed Hidden Power damage category for PSS < GEN_4 (rh-hideout#5053)
Browse files Browse the repository at this point in the history
* Fixed Hidden Power damage category for PSS < GEN_4

* Fixed category display regression

* Wrapped GET_MOVE_TYPE

---------

Co-authored-by: Hedara <hedara90@gmail.com>
  • Loading branch information
hedara90 and Hedara authored Jul 29, 2024
1 parent b54226d commit a89820f
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions include/battle.h
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 5 additions & 3 deletions src/battle_util.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit a89820f

Please sign in to comment.