Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Nov 5, 2023
1 parent 632ca74 commit 90a9d66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/game/scenes/world/entities/building/building.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,6 +23,8 @@ export class EnemyBerserk extends Enemy {
might: 1.7,
},
});

this.healAmount = Math.ceil(this.live.maxHealth * ENEMY_HEAL_MULTIPLIER);
}

public update() {
Expand All @@ -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);
}
}
}

0 comments on commit 90a9d66

Please sign in to comment.