Fix damage display issues with battle info

This commit is contained in:
Flashfyre committed 2024-03-01 10:28:29 -05:00
1 parent 1f6a6f4621
commit 6f54fa7741
6 files changed
+25 -18

No files matched your search

+10 -2
View File
@@ -1123,8 +1123,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.scene.applyModifiers(EnemyDamageReducerModifier, false, damage);
if (damage) {
damage.value = this.damage(damage.value);
this.scene.unshiftPhase(new DamagePhase(this.scene, this.getBattlerIndex(), damage.value, result as DamageResult, isCritical));
damage.value = this.damageAndUpdate(damage.value, result as DamageResult, isCritical);
if (isCritical)
this.scene.queueMessage('A critical hit!');
this.scene.setPhaseQueueSplice();
@@ -1201,6 +1200,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return damage;
}
damageAndUpdate(damage: integer, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, preventEndure: boolean = false): integer {
const damagePhase = new DamagePhase(this.scene, this.getBattlerIndex(), damage, result as DamageResult, critical);
this.scene.unshiftPhase(damagePhase);
damage = this.damage(damage, ignoreSegments, preventEndure);
// Damage amount may have changed, but needed to be queued before calling damage function
damagePhase.updateAmount(damage);
return damage;
}
heal(amount: integer): integer {
const healAmount = Math.min(amount, this.getMaxHp() - this.hp);
this.hp += healAmount;