mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-15 12:52:20 +02:00
Cleanup EnemyBattleInfo's hp method to use super
This commit is contained in:
parent
b25dac0913
commit
e4d74d9c1c
@ -198,25 +198,7 @@ export class EnemyBattleInfo extends BattleInfo {
|
|||||||
resolve: (r: void | PromiseLike<void>) => void,
|
resolve: (r: void | PromiseLike<void>) => void,
|
||||||
instant?: boolean,
|
instant?: boolean,
|
||||||
): void {
|
): void {
|
||||||
let duration = !instant ? Phaser.Math.Clamp(Math.abs(this.lastHp - pokemon.hp) * 5, 250, 5000) : 0;
|
super.updatePokemonHp(pokemon, resolve, instant);
|
||||||
const speed = globalScene.hpBarSpeed;
|
|
||||||
if (speed) {
|
|
||||||
duration = speed >= 3 ? 0 : duration / Math.pow(2, speed);
|
|
||||||
}
|
|
||||||
globalScene.tweens.add({
|
|
||||||
targets: this.hpBar,
|
|
||||||
ease: "Sine.easeOut",
|
|
||||||
scaleX: pokemon.getHpRatio(true),
|
|
||||||
duration: duration,
|
|
||||||
onUpdate: () => {
|
|
||||||
this.updateHpFrame();
|
|
||||||
},
|
|
||||||
onComplete: () => {
|
|
||||||
this.updateHpFrame();
|
|
||||||
resolve();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
this.lastHp = pokemon.hp;
|
this.lastHp = pokemon.hp;
|
||||||
this.lastMaxHp = pokemon.getMaxHp();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user