From fb1222bed98399214a8806e38a5ecaa889b65ba1 Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Fri, 6 Jun 2014 11:04:08 +0200 Subject: [PATCH] fix to AI for less borking --- game/engines/default/engine/ai/talented.lua | 2 +- game/modules/tome/ai/tactical.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/game/engines/default/engine/ai/talented.lua b/game/engines/default/engine/ai/talented.lua index b2bd43fe2b..bee35b1c7b 100644 --- a/game/engines/default/engine/ai/talented.lua +++ b/game/engines/default/engine/ai/talented.lua @@ -30,7 +30,7 @@ newAI("dumb_talented", function(self) -- print(self.name, self.uid, "dumb ai talents can try use", t.name, tid, "::", t.mode, not self:isTalentCoolingDown(t), target_dist <= self:getTalentRange(t), self:preUseTalent(t, true), self:canProject({type="bolt"}, self.ai_target.actor.x, self.ai_target.actor.y)) -- For dumb AI assume we need range and LOS -- No special check for bolts, etc. - local total_range = self:getTalentRange(t) + self:getTalentRadius(t) + local total_range = (self:getTalentRange(t) or 0) + (self:getTalentRadius(t) or 0) local tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt", range=total_range} if t.mode == "activated" and not t.no_npc_use and not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and diff --git a/game/modules/tome/ai/tactical.lua b/game/modules/tome/ai/tactical.lua index 2d78bfcd3a..2323a97395 100644 --- a/game/modules/tome/ai/tactical.lua +++ b/game/modules/tome/ai/tactical.lua @@ -83,7 +83,7 @@ newAI("use_tactical", function(self) local tg = self:getTalentTarget(t) local default_tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt"} -- Only assume range... some talents may no require LOS, etc - local within_range = target_dist and target_dist <= (self:getTalentRange(t) + self:getTalentRadius(t)) + local within_range = target_dist and target_dist <= ((self:getTalentRange(t) or 0) + (self:getTalentRadius(t) or 0)) if t.mode == "activated" and not t.no_npc_use and not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and (not self:getTalentRequiresTarget(t) or within_range) -- GitLab