From 75186624ce88e391afa629c7f2b6b8b6f217eb2b Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 19 Aug 2018 15:30:34 -0300 Subject: Only make enemies heal 50% of the time --- index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5138e92..ca01536 100644 --- a/index.js +++ b/index.js @@ -1312,9 +1312,14 @@ const basicAI = function() { if (mostHurtAlly.hp / mostHurtAlly.maxHP <= 0.5) { // We can only heal them if we have healing actions available! if (this.getValidActions('ally').find(a => isHealingAction(a))) { - this.targetType = 'ally' - this.targetCharacter = mostHurtAlly - break determineTarget + // If we're an enemy, be nice: only heal 50% of the time. + // This also lets the enemy be "tough", more focused towards fighting + // than defending. + if (this.team === this.battle.playerCharacter.team || Math.random() <= 0.5) { + this.targetType = 'ally' + this.targetCharacter = mostHurtAlly + break determineTarget + } } } -- cgit 1.3.0-6-gf8a5