Skip to content

Commit

Permalink
Fix Spectral Thief behavior (#575)
Browse files Browse the repository at this point in the history
Fixes Spectral Thief stealing negative stat changes, as reported https://www.smogon.com/forums/posts/9748441.

Additionally, fixes Spectral Thief not removing positive boosts (particularly Defense boosts) from the target.
  • Loading branch information
AWildNoob authored Oct 7, 2023
1 parent 72ffd2e commit 98a94f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion calc/src/mechanics/gen789.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ export function calculateSMSSSV(
if (move.named('Spectral Thief')) {
let stat: StatID;
for (stat in defender.boosts) {
if (defender.boosts[stat]) {
if (defender.boosts[stat] > 0) {
attacker.boosts[stat] +=
attacker.hasAbility('Contrary') ? -defender.boosts[stat]! : defender.boosts[stat]!;
if (attacker.boosts[stat] > 6) attacker.boosts[stat] = 6;
if (attacker.boosts[stat] < -6) attacker.boosts[stat] = -6;
attacker.stats[stat] = getModifiedStat(attacker.rawStats[stat]!, attacker.boosts[stat]!);
defender.boosts[stat] = 0;
defender.stats[stat] = defender.rawStats[stat];
}
}
}
Expand Down

0 comments on commit 98a94f0

Please sign in to comment.