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

Channel Staff now ignores friendlies (it will pass over them harmlessly)

git-svn-id: http://svn.net-core.org/repos/t-engine4@2449 51575b47-30f0-44d4-a5cc-537603b46e54
parent c13f61dc
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,26 @@ function _M:display(dispx, dispy)
self.display_x, self.display_y = ox, oy
end
-- Default type def
target_type = {
range=20,
friendlyfire=true,
block_path = function(typ, lx, ly)
if not typ.no_restrict then
if typ.requires_knowledge and not game.level.map.remembers(lx, ly) and not game.level.map.seens(lx, ly) then return true end
if not typ.pass_terrain and game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move") then return true
-- If we explode due to something other than terrain, then we should explode ON the tile, not before it
elseif typ.stop_block and game.level.map:checkAllEntities(lx, ly, "block_move") then return true, lx, ly end
if typ.range and typ.source_actor and typ.source_actor.x and math.sqrt((typ.source_actor.x-lx)^2 + (typ.source_actor.y-ly)^2) > typ.range then return true end
end
-- If we don't block the path, then the explode point should be here
return false, lx, ly
end,
block_radius=function(typ, lx, ly)
return not typ.no_restrict and game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move")
end
}
-- @return t The target table used by ActorProject, Projectile, GameTargeting, etc.
-- @param t Target table used to generate the
-- @param t.type The engine-defined type, populates other more complex variables (see below)
......@@ -131,24 +151,6 @@ function _M:getType(t)
if not t then return {} end
-- Add the default values
t = table.clone(t)
target_type = {
range=20,
friendlyfire=true,
block_path = function(typ, lx, ly)
if not typ.no_restrict then
if typ.requires_knowledge and not game.level.map.remembers(lx, ly) and not game.level.map.seens(lx, ly) then return true end
if not typ.pass_terrain and game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move") then return true
-- If we explode due to something other than terrain, then we should explode ON the tile, not before it
elseif typ.stop_block and game.level.map:checkAllEntities(lx, ly, "block_move") then return true, lx, ly end
if typ.range and typ.source_actor and typ.source_actor.x and math.sqrt((typ.source_actor.x-lx)^2 + (typ.source_actor.y-ly)^2) > typ.range then return true end
end
-- If we don't block the path, then the explode point should be here
return false, lx, ly
end,
block_radius=function(typ, lx, ly)
return not typ.no_restrict and game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move")
end
}
table.update(t, target_type)
-- And now modify for the default types
if t.type then
......
......@@ -77,12 +77,7 @@ function _M:archeryAcquireTargets(tg, params)
for i = 1, params.multishots or 1 do
local a
if not ammo.infinite then
if self:doesPackRat() then
game.logPlayer(self, "Pack Rat!")
a = self:getInven("QUIVER")[1]
else
a = self:removeObject(self:getInven("QUIVER"), 1)
end
a = self:removeObject(self:getInven("QUIVER"), 1)
else
a = ammo
end
......
......@@ -52,7 +52,17 @@ newTalent{
else explosion = "manathrust" particle = "bolt_arcane" trail = "arcanetrail" damtype = DamageType.ARCANE
end
local tg = {type="bolt", range=self:getTalentRange(t), talent=t, display = {particle=particle, trail=trail}}
local tg = {type="bolt", range=self:getTalentRange(t), talent=t, display = {particle=particle, trail=trail},
-- Like a normal block_path, but goes over friendlies
block_path = function(typ, lx, ly)
local a = game.level.map(lx, ly, engine.Map.ACTOR)
if a and self:reactionToward(a) >= 0 then return false, lx, ly
elseif game.level.map:checkAllEntities(lx, ly, "block_move") then return true, lx, ly end
if typ.range and typ.source_actor and typ.source_actor.x and math.sqrt((typ.source_actor.x-lx)^2 + (typ.source_actor.y-ly)^2) > typ.range then return true end
return false, lx, ly
end,
}
local x, y = self:getTarget(tg)
if not x or not y then return nil end
......
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