diff options
author | Florrie <towerofnix@gmail.com> | 2018-08-16 09:20:15 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-08-16 09:20:15 -0300 |
commit | 841b9d8f83bda72ddd8326b77e3696ca1ca24812 (patch) | |
tree | 033a81496a310f4c3caa0cc540d10a2045605adb | |
parent | c8090b52793cbdec4c28ceea3acddf19fc167cfd (diff) |
Pick random target in AI
-rw-r--r-- | index.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/index.js b/index.js index 2762bf6..c7327d6 100644 --- a/index.js +++ b/index.js @@ -613,7 +613,8 @@ class BattleCharacter extends Sprite { determineNewTarget(targetType) { const targets = this.getValidTargets(targetType) if (targets.length) { - this.targetCharacter = targets[0] + // TODO: Some sort of "follow the leader" mechanic + this.targetCharacter = targets[Math.floor(Math.random() * targets.length)] } else { this.targetCharacter = null } |