Fix gyro ball base power (#206)

* Fix gyro ball base power

* Update gyro ball for gen6+
pull/209/head
Tempoanon 2024-04-20 01:43:37 -04:00 committed by GitHub
parent 9ec505bf35
commit 934fc0ef86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 2 deletions

View File

@ -1707,8 +1707,18 @@ export class BattleStatRatioPowerAttr extends VariablePowerAttr {
const statThresholds = [ 0.25, 1 / 3, 0.5, 1, -1 ];
let statThresholdPowers = [ 150, 120, 80, 60, 40 ];
if (this.invert)
statThresholdPowers = statThresholdPowers.reverse();
if (this.invert) {
// Gyro ball uses a specific formula
let userSpeed = user.getStat(this.stat);
if (userSpeed < 1) {
// Gen 6+ always have 1 base power
power.value = 1;
return true;
}
let bp = Math.floor(Math.min(150, 25 * target.getStat(this.stat) / userSpeed + 1));
power.value = bp;
return true;
}
let w = 0;
while (w < statThresholds.length - 1 && statRatio > statThresholds[w]) {