Skip to content
Snippets Groups Projects
Commit fb1222be authored by DarkGod's avatar DarkGod
Browse files

fix to AI for less borking

parent 1c6f64d5
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ newAI("dumb_talented", function(self) ...@@ -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)) -- 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 -- For dumb AI assume we need range and LOS
-- No special check for bolts, etc. -- 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} 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 if t.mode == "activated" and not t.no_npc_use and
not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and 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)
local tg = self:getTalentTarget(t) local tg = self:getTalentTarget(t)
local default_tg = {type=util.getval(t.direct_hit, self, t) and "hit" or "bolt"} 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 -- 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 if t.mode == "activated" and not t.no_npc_use and
not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and not self:isTalentCoolingDown(t) and self:preUseTalent(t, true, true) and
(not self:getTalentRequiresTarget(t) or within_range) (not self:getTalentRequiresTarget(t) or within_range)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment