Commit fb1222bed98399214a8806e38a5ecaa889b65ba1

Authored by DarkGod
1 parent 1c6f64d5

fix to AI for less borking

@@ -30,7 +30,7 @@ newAI("dumb_talented", function(self) @@ -30,7 +30,7 @@ newAI("dumb_talented", function(self)
30 -- 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)) 30 -- 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))
31 -- For dumb AI assume we need range and LOS 31 -- For dumb AI assume we need range and LOS
32 -- No special check for bolts, etc. 32 -- No special check for bolts, etc.
33 - local total_range = self:getTalentRange(t) + self:getTalentRadius(t) 33 + local total_range = (self:getTalentRange(t) or 0) + (self:getTalentRadius(t) or 0)
34 local tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt", range=total_range} 34 local tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt", range=total_range}
35 if t.mode == "activated" and not t.no_npc_use and 35 if t.mode == "activated" and not t.no_npc_use and
36 not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and 36 not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and
@@ -83,7 +83,7 @@ newAI("use_tactical", function(self) @@ -83,7 +83,7 @@ newAI("use_tactical", function(self)
83 local tg = self:getTalentTarget(t) 83 local tg = self:getTalentTarget(t)
84 local default_tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt"} 84 local default_tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt"}
85 -- Only assume range... some talents may no require LOS, etc 85 -- Only assume range... some talents may no require LOS, etc
86 - local within_range = target_dist and target_dist <= (self:getTalentRange(t) + self:getTalentRadius(t)) 86 + local within_range = target_dist and target_dist <= ((self:getTalentRange(t) or 0) + (self:getTalentRadius(t) or 0))
87 if t.mode == "activated" and not t.no_npc_use and 87 if t.mode == "activated" and not t.no_npc_use and
88 not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and 88 not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and
89 (not self:getTalentRequiresTarget(t) or within_range) 89 (not self:getTalentRequiresTarget(t) or within_range)