From 90a9d66c9ce56f4f7954c563c58e9b09883c54e8 Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:47:54 +0300 Subject: [PATCH] Minor fixes --- src/game/scenes/world/entities/building/building.ts | 6 +++--- .../world/entities/npc/variants/enemy/variants/berserk.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/scenes/world/entities/building/building.ts b/src/game/scenes/world/entities/building/building.ts index cbc49be1..9f3f4573 100644 --- a/src/game/scenes/world/entities/building/building.ts +++ b/src/game/scenes/world/entities/building/building.ts @@ -844,7 +844,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } private handleToggleModes() { - const handlerToggle = (mode: WorldMode) => { + const handler = (mode: WorldMode) => { switch (mode) { case WorldMode.BUILDING_INDICATORS: { this.toggleIndicators(); @@ -853,10 +853,10 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } }; - this.scene.events.on(WorldEvents.TOGGLE_MODE, handlerToggle); + this.scene.events.on(WorldEvents.TOGGLE_MODE, handler); this.once(Phaser.GameObjects.Events.DESTROY, () => { - this.scene.events.off(WorldEvents.TOGGLE_MODE, handlerToggle); + this.scene.events.off(WorldEvents.TOGGLE_MODE, handler); }); } diff --git a/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts b/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts index 581c2042..13e4539e 100644 --- a/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts +++ b/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts @@ -10,6 +10,8 @@ export class EnemyBerserk extends Enemy { private healTimestamp: number = 0; + private healAmount: number = 0; + constructor(scene: IWorld, data: EnemyVariantData) { super(scene, { ...data, @@ -21,6 +23,8 @@ export class EnemyBerserk extends Enemy { might: 1.7, }, }); + + this.healAmount = Math.ceil(this.live.maxHealth * ENEMY_HEAL_MULTIPLIER); } public update() { @@ -47,7 +51,7 @@ export class EnemyBerserk extends Enemy { if (now >= this.healTimestamp) { this.healTimestamp = now + ENEMY_HEAL_TIMESTAMP_PAUSE; - this.live.heal(this.live.maxHealth * ENEMY_HEAL_MULTIPLIER); + this.live.heal(this.healAmount); } } }