Closed BaiqingL closed 4 months ago
If you have the exact HP number you can assign it to the curHP
property in the options object of the Pokemon
, but if you need a percentage you'll have to calculate it yourself. Here's a simple example to calculate Gengar using Focus Blast vs a Chansey at 70% HP
const chansey = new Pokemon(gen, 'Chansey', {
item: 'Eviolite',
nature: 'Calm',
evs: {hp: 252, spd: 252},
});
chansey.originalCurHP = Math.round(70 * chansey.maxHP() / 100);
const result = calculate(
gen,
new Pokemon(gen, 'Gengar', {
item: 'Choice Specs',
nature: 'Timid',
evs: {spa: 252},
boosts: {spa: 1},
}),
chansey,
new Move(gen, 'Focus Blast')
);
I see, this works, thank you!
Is it possible to provide say, 70% as an argument to the defender side pokemon and calculate damage given the assumption that the pokemon is already at 70% health?