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

fix adv shadow targetting

New ActorProject:getTargetLimited method
parent 3b2e8aea
No related branches found
No related tags found
No related merge requests found
......@@ -253,6 +253,7 @@ function _M:canProject(t, x, y)
-- Stop at range or on block
local stop_x, stop_y = typ.start_x, typ.start_y
local stop_radius_x, stop_radius_y = typ.start_x, typ.start_y
local l, is_corner_blocked
if typ.source_actor.lineFOV then
l = typ.source_actor:lineFOV(x, y, nil, nil, typ.start_x, typ.start_y)
......@@ -300,6 +301,14 @@ function _M:canProject(t, x, y)
return is_hit, stop_x, stop_y, stop_radius_x, stop_radius_y
end
--- Calls :getTarget and :canProject to limit the results and returns the same as getTarget
function _M:getTargetLimited(t)
local x, y = self:getTarget(t)
local _ _, x, y = self:canProject(t, x, y)
local target = game.level.map(x, y, Map.ACTOR)
return x, y, target
end
--- Project damage to a distance using a moving projectile
-- @param t a type table describing the attack, passed to engine.Target:getType() for interpretation
-- @param x target coords
......
......@@ -30,25 +30,18 @@ newTalent{
getReduction = function(self, t) return self:combatTalentScale(t, 10, 40) end,
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t), talent=t, first_target="friend"}
local x, y, target = self:getTarget(tg)
local x, y, target = self:getTargetLimited(tg)
if x and y and target and target.summoner and target.summoner == self and target.is_doomed_shadow then
local tg2 = {type="hit", range=self:getTalentRange(t), source_actor=target, pass_terrain=true}
local x, y, target2 = self:getTarget(tg2)
local _ _, x, y = self:canProject(tg2, x, y)
local tg2 = {type="hit", range=self:getTalentRange(t), start_x=x, start_y=y, source_actor=target, pass_terrain=true}
local x, y, target2 = self:getTargetLimited(tg2)
if x and y and target2 and target2.x == x and target2.y == y then
game.level.map:particleEmitter(target.x, target.y, 1, "teleport")
game.level.map:particleEmitter(target2.x, target2.y, 1, "teleport")
target.die(target)
target2:setEffect(target2.EFF_CURSE_IMPOTENCE, 5, {power=t.getReduction(self, t)})
game:playSoundNear(target, "talents/earth")
else return nil end
else return nil end
return true
......@@ -73,12 +66,10 @@ newTalent{
getDamage = function(self, t) return self:combatTalentMindDamage(t, 0, 280) end,
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t), talent=t, first_target="friend"}
local x, y, target = self:getTarget(tg)
local _ _, x, y = self:canProject(tg, x, y)
local x, y, target = self:getTargetLimited(tg)
if x and y and target and target.x == x and target.y == y and target.is_doomed_shadow and target.summoner and target.summoner == self then
local tg2 = {type="hit", range=self:getTalentRange(t), source_actor=target, friendlyblock=false, pass_terrain=true,}
local x, y, target2 = self:getTarget(tg2)
local _ _, x, y = self:canProject(tg2, x, y)
local tg2 = {type="hit", range=self:getTalentRange(t), start_x=x, start_y=y, source_actor=target, friendlyblock=false, pass_terrain=true,}
local x, y, target2 = self:getTargetLimited(tg2)
if x and y and target2 and target2.x == x and target2.y == y then
local ox, oy = target.x, target.y
local sx, sy = util.findFreeGrid(x, y, 3, true, {[engine.Map.ACTOR]=true})
......
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