From beb3c978784dbbaa7434304c4b79533a7d759e36 Mon Sep 17 00:00:00 2001 From: Renge Date: Sat, 30 Apr 2022 19:38:55 -0400 Subject: [PATCH] fix: canAttack --- src/shattered_sword/AI/BullAI.ts | 4 ++++ src/shattered_sword/AI/TigerAI.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/shattered_sword/AI/BullAI.ts b/src/shattered_sword/AI/BullAI.ts index a661462..9e276e8 100644 --- a/src/shattered_sword/AI/BullAI.ts +++ b/src/shattered_sword/AI/BullAI.ts @@ -12,6 +12,10 @@ export default class BullAI extends EnemyAI { this.attackTimer = new Timer(4000); } + canAttack(position: Vec2): boolean { + return this.attackTimer.isStopped(); + } + collideWithPlayer(player: PlayerController): void { player.damage(10); if (this.isAttaking && !player.invincible && !player.godMode) { diff --git a/src/shattered_sword/AI/TigerAI.ts b/src/shattered_sword/AI/TigerAI.ts index c3e2be0..c9f0ce2 100644 --- a/src/shattered_sword/AI/TigerAI.ts +++ b/src/shattered_sword/AI/TigerAI.ts @@ -17,6 +17,10 @@ export default class TigerAI extends EnemyAI { return null; } + canAttack(position: Vec2): boolean { + return this.attackTimer.isStopped(); + } + collideWithPlayer(player: PlayerController): void { player.damage(10); if (this.isAttaking && !player.invincible && !player.godMode) {