pokemon-showdown/data/mods/gen6/statuses.js
Guangcong Luo 9b943fb62f Fix Dynamax stat handling
We now track `baseMaxhp`, the pre-Dynamax max HP. We also have a new
function `getUndynamaxedHP` for use by moves that use it (famously,
Endeavor).

- `baseStoredStats` is unused outside of the mouseover stats display.
  I updated its implementation to reflect this.

- Power Construct doesn't have a defined behavior during Dynamax. I
  ended up implementing an approximation of what it should probably do.

- Endeavor, Pain Split, Super Fang, and Nature's Madness now work on
  undynamaxed HP.

- Moves that deal or heal percentage damage now do it based on
  undynamaxed max HP, other than G-Max Finale.

Fixes #6131

Fixes #6087
2019-12-04 09:25:46 +09:00

48 lines
1.0 KiB
JavaScript

'use strict';
/**@type {{[k: string]: ModdedPureEffectData}} */
let BattleStatuses = {
brn: {
inherit: true,
onResidual(pokemon) {
this.damage(pokemon.baseMaxhp / 8);
},
},
par: {
inherit: true,
onModifySpe(spe, pokemon) {
if (!pokemon.hasAbility('quickfeet')) {
return this.chainModify(0.25);
}
},
},
confusion: {
inherit: true,
onBeforeMove(pokemon) {
pokemon.volatiles.confusion.time--;
if (!pokemon.volatiles.confusion.time) {
pokemon.removeVolatile('confusion');
return;
}
this.add('-activate', pokemon, 'confusion');
if (this.randomChance(1, 2)) {
return;
}
let damage = this.getDamage(pokemon, pokemon, 40);
if (typeof damage !== 'number') throw new Error("Confusion damage not dealt");
this.damage(damage, pokemon, pokemon, /** @type {ActiveMove} */ ({
id: 'confused',
effectType: 'Move',
type: '???',
}));
return false;
},
},
choicelock: {
inherit: true,
onBeforeMove() {},
},
};
exports.BattleStatuses = BattleStatuses;