Skip to content
Snippets Groups Projects
Commit c51ed58a authored by dg's avatar dg
Browse files

plop

git-svn-id: http://svn.net-core.org/repos/t-engine4@1334 51575b47-30f0-44d4-a5cc-537603b46e54
parent 0501363e
No related branches found
No related tags found
No related merge requests found
......@@ -27,10 +27,19 @@ newAI("dumb_talented", function(self)
for tid, _ in pairs(self.talents) do
local t = self:getTalentFromId(tid)
-- 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))
if t.mode == "activated" and not self:isTalentCoolingDown(t) and target_dist <= self:getTalentRange(t) and self:preUseTalent(t, true, true) and self:canProject({type=t.direct_hit and "hit" or "bolt"}, self.ai_target.actor.x, self.ai_target.actor.y) and self:hasLOS(self.ai_target.actor.x, self.ai_target.actor.y) then
if t.mode == "activated" and
not self:isTalentCoolingDown(t) and
target_dist <= self:getTalentRange(t)
and self:preUseTalent(t, true, true) and
self:canProject({type=t.direct_hit and "hit" or "bolt"}, self.ai_target.actor.x, self.ai_target.actor.y) and
self:hasLOS(self.ai_target.actor.x, self.ai_target.actor.y)
then
avail[#avail+1] = tid
print(self.name, self.uid, "dumb ai talents can use", t.name, tid)
elseif t.mode == "sustained" and not self:isTalentCoolingDown(t) and not self:isTalentActive(t.id) and self:preUseTalent(t, true, true) then
elseif t.mode == "sustained" and not self:isTalentCoolingDown(t) and
not self:isTalentActive(t.id) and
self:preUseTalent(t, true, true)
then
avail[#avail+1] = tid
print(self.name, self.uid, "dumb ai talents can activate", t.name, tid)
end
......
......@@ -88,6 +88,8 @@ function _M:init(t, no_default)
self.unused_generics = self.unused_generics or 1
self.unused_talents_types = self.unused_talents_types or 0
t.sight = t.sight or 20
t.resource_pool_refs = t.resource_pool_refs or {}
t.lite = t.lite or 0
......
......@@ -35,16 +35,7 @@ function _M:act()
if not mod.class.Actor.act(self) then return end
-- Compute FOV, if needed
-- if self.lite > 0 then
-- print("lite", self.name, self.lite)
-- self:computeFOV(self.lite, "block_sight", function(x, y, dx, dy, sqdist) game.level.map:applyLite(x, y) end, true, true)
-- end
-- If the actor has no special vision we can use the default cache
if not self.special_vision then
self:computeFOV(self.sight or 20, "block_sight", nil, nil, nil, true)
else
self:computeFOV(self.sight or 20, "block_sight")
end
self:doFOV()
-- Let the AI think .... beware of Shub !
-- If AI did nothing, use energy anyway
......@@ -57,6 +48,19 @@ function _M:act()
if not self.energy.used then self:useEnergy() end
end
function _M:doFOV()
-- if self.lite > 0 then
-- print("lite", self.name, self.lite)
-- self:computeFOV(self.lite, "block_sight", function(x, y, dx, dy, sqdist) game.level.map:applyLite(x, y) end, true, true)
-- end
-- If the actor has no special vision we can use the default cache
if not self.special_vision then
self:computeFOV(self.sight or 20, "block_sight", nil, nil, nil, true)
else
self:computeFOV(self.sight or 20, "block_sight")
end
end
--- Give target to others
function _M:seen_by(who)
if self.ai_target.actor then return end
......
......@@ -281,6 +281,10 @@ function _M:playerFOV()
end
end
function _M:doFOV()
self:playerFOV()
end
--- Called before taking a hit, overload mod.class.Actor:onTakeHit() to stop resting and running
function _M:onTakeHit(value, src)
self:runStop("taken damage")
......
......@@ -1578,3 +1578,20 @@ newEffect{
self:removeTemporaryValue("unstoppable", eff.tmpid)
end,
}
newEffect{
name = "DIM_VISION",
desc = "Reduced Vision",
type = "physical",
status = "detrimental",
parameters = { sight=5 },
activate = function(self, eff)
if self.sight - eff.sight < 1 then eff.sight = self.sight - 1 end
eff.tmpid = self:addTemporaryValue("sight", -eff.sight)
self:doFOV()
end,
deactivate = function(self, eff)
self:removeTemporaryValue("sight", eff.tmpid)
self:doFOV()
end,
}
No preview for this file type
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