Skip to content

Commit

Permalink
Fix Powder config not checking for Powder status (#6113)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhallenTree authored Jan 26, 2025
1 parent 4158f92 commit 6b23a02
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -3138,6 +3138,8 @@ static inline bool32 TryFormChangeBeforeMove(void)
static inline bool32 TryActivatePowderStatus(u32 move)
{
u32 partnerMove = gBattleMons[BATTLE_PARTNER(gBattlerAttacker)].moves[gBattleStruct->chosenMovePositions[BATTLE_PARTNER(gBattlerAttacker)]];
if (!(gBattleMons[gBattlerAttacker].status2 & STATUS2_POWDER))
return FALSE;
if (GetBattleMoveType(move) == TYPE_FIRE && !gBattleStruct->pledgeMove)
return TRUE;
if (move == MOVE_FIRE_PLEDGE && partnerMove == MOVE_GRASS_PLEDGE)
Expand Down Expand Up @@ -3616,20 +3618,17 @@ static void CancellerPowderMove(u32 *effect)

static void CancellerPowderStatus(u32 *effect)
{
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_POWDER)
if (TryActivatePowderStatus(gCurrentMove))
{
if (TryActivatePowderStatus(gCurrentMove))
{
gProtectStructs[gBattlerAttacker].powderSelfDmg = TRUE;
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 4;
gProtectStructs[gBattlerAttacker].powderSelfDmg = TRUE;
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 4;

if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE
|| HasTrainerUsedGimmick(gBattlerAttacker, GIMMICK_Z_MOVE))
gBattlescriptCurrInstr = BattleScript_MoveUsedPowder;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
*effect = 1;
}
if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE
|| HasTrainerUsedGimmick(gBattlerAttacker, GIMMICK_Z_MOVE))
gBattlescriptCurrInstr = BattleScript_MoveUsedPowder;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
*effect = 1;
}
}

Expand Down

0 comments on commit 6b23a02

Please sign in to comment.