Fix Powder config not checking for Powder status (#6113)

This commit is contained in:
PhallenTree 2025-01-26 17:12:18 +00:00 committed by GitHub
parent 4158f9251f
commit 6b23a02e7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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