Create common AI strategy which supports all weapon types

This commit is contained in:
2022-08-18 23:01:05 +02:00
parent 1e3e2e6abb
commit 0f365410b0
4 changed files with 67 additions and 0 deletions

View File

@@ -103,4 +103,15 @@ public class Enemy extends Character implements NPC {
return this;
}
public Enemy defaultAI() {
var ai = new WeaponBasedAI(this, runner.getPlayer());
addEventListener(MoveEvent.TYPE, ai::recomputePath);
addEventListener(EnemyDiedEvent.TYPE, e -> ai.recomputePath());
this.ai = ai;
return this;
}
}