Skip to content

Commit

Permalink
Fixes Purifying Salt not halving dmg for dynamic move types
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine committed Aug 12, 2024
1 parent 863b96f commit fe21a30
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9771,7 +9771,7 @@ static inline u32 CalcDefenseStat(u32 move, u32 battlerAtk, u32 battlerDef, u32
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5));
break;
case ABILITY_PURIFYING_SALT:
if (gMovesInfo[move].type == TYPE_GHOST)
if (moveType == TYPE_GHOST)
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0));
break;
}
Expand Down
18 changes: 18 additions & 0 deletions test/battle/ability/purifying_salt.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ SINGLE_BATTLE_TEST("Purifying Salt halves damage from Ghost-type moves", s16 dam
}
}

SINGLE_BATTLE_TEST("Purifying Salt halves damage from dynamic Ghost-type moves", s16 damage)
{
u16 ability;
PARAMETRIZE { ability = ABILITY_STURDY; }
PARAMETRIZE { ability = ABILITY_PURIFYING_SALT; }
GIVEN {
ASSUME(gMovesInfo[MOVE_TERA_BLAST].effect == EFFECT_TERA_BLAST);
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_GHOST); }
OPPONENT(SPECIES_GARGANACL) { Ability(ability); }
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(0.5), results[1].damage);
}
}

SINGLE_BATTLE_TEST("Purifying Salt makes Rest fail")
{
GIVEN {
Expand Down

0 comments on commit fe21a30

Please sign in to comment.