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

When leaving a level all player originated projectiles are removed

parent 47b0e770
No related branches found
No related tags found
No related merge requests found
...@@ -157,11 +157,29 @@ function _M:onEnterLevel(zone, level) ...@@ -157,11 +157,29 @@ function _M:onEnterLevel(zone, level)
-- Clear existing player created effects on the map -- Clear existing player created effects on the map
for i, eff in ipairs(level.map.effects) do for i, eff in ipairs(level.map.effects) do
if eff.src and eff.src == game.player then if eff.src and eff.src.player then
eff.duration = 0 eff.duration = 0
eff.grids = {} eff.grids = {}
print("[onEnterLevel] Cancelling player created effect ", tostring(eff.name))
end end
end end
-- Clear existing player created entities from the map
local todel = {}
for uid, ent in pairs(level.entities) do
if ((ent.summoner and ent.summoner.player) or (ent.src and ent.src.player)) and not game.party:hasMember(ent) then
print("[onEnterLevel] Terminating player created entity ", uid, ent.name, ent:getEntityKind())
if ent.temporary then ent.temporary = 0 end
if ent.summon_time then ent.summon_time = 0 end
if ent.duration then ent.duration = 0 end
if ent:getEntityKind() == "projectile" then
todel[#todel+1] = ent
end
end
end
for _, ent in ipairs(todel) do
level:removeEntity(ent, true)
ent.dead = true
end
end end
function _M:onEnterLevelEnd(zone, level) function _M:onEnterLevelEnd(zone, level)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod" -- Nicolas Casalini "DarkGod"
-- darkgod@te4.org -- darkgod@te4.org
local Object = require "engine.Object" local Object = require "mod.class.Object"
newTalent{ newTalent{
name = "Ice Claw", name = "Ice Claw",
...@@ -93,8 +93,10 @@ newTalent{ ...@@ -93,8 +93,10 @@ newTalent{
requires_target = true, requires_target = true,
on_learn = function(self, t) self.resists[DamageType.COLD] = (self.resists[DamageType.COLD] or 0) + 1 end, on_learn = function(self, t) self.resists[DamageType.COLD] = (self.resists[DamageType.COLD] or 0) + 1 end,
on_unlearn = function(self, t) self.resists[DamageType.COLD] = (self.resists[DamageType.COLD] or 0) - 1 end, on_unlearn = function(self, t) self.resists[DamageType.COLD] = (self.resists[DamageType.COLD] or 0) - 1 end,
getDuration = function(self, t) return math.floor(self:combatTalentScale(t, 5, 9)) end,
getLength = function(self, t) return 1 + math.floor(self:combatTalentScale(t, 3, 7)/2)*2 end,
action = function(self, t) action = function(self, t)
local halflength = 1 + math.floor(self:getTalentLevel(t) / 2) local halflength = math.floor(t.getLength(self,t)/2)
local block = function(_, lx, ly) local block = function(_, lx, ly)
return game.level.map:checkAllEntities(lx, ly, "block_move") return game.level.map:checkAllEntities(lx, ly, "block_move")
end end
...@@ -111,10 +113,13 @@ newTalent{ ...@@ -111,10 +113,13 @@ newTalent{
local e = Object.new{ local e = Object.new{
old_feat = oe, old_feat = oe,
name = "ice wall", image = "npc/iceblock.png", name = "ice wall", image = "npc/iceblock.png",
type = "wall", subtype = "ice", desc = "a summoned, transparent wall of ice",
type = "wall",
display = '#', color=colors.LIGHT_BLUE, back_color=colors.BLUE, display = '#', color=colors.LIGHT_BLUE, back_color=colors.BLUE,
always_remember = true, always_remember = true,
can_pass = {pass_wall=1}, can_pass = {pass_wall=1},
does_block_move = true,
show_tooltip = true,
block_move = true, block_move = true,
block_sight = false, block_sight = false,
temporary = 4 + self:getTalentLevel(t), temporary = 4 + self:getTalentLevel(t),
...@@ -129,10 +134,14 @@ newTalent{ ...@@ -129,10 +134,14 @@ newTalent{
game.level.map:updateMap(self.x, self.y) game.level.map:updateMap(self.x, self.y)
end end
end, end,
dig = function(src, x, y, old)
game.level:removeEntity(old)
return nil, old.old_feat
end,
summoner_gain_exp = true, summoner_gain_exp = true,
summoner = self, summoner = self,
} }
e.tooltip = mod.class.Grid.tooltip
game.level:addEntity(e) game.level:addEntity(e)
game.level.map(px, py, Map.TERRAIN, e) game.level.map(px, py, Map.TERRAIN, e)
-- game.nicer_tiles:updateAround(game.level, px, py) -- game.nicer_tiles:updateAround(game.level, px, py)
...@@ -142,7 +151,7 @@ newTalent{ ...@@ -142,7 +151,7 @@ newTalent{
end, end,
info = function(self, t) info = function(self, t)
return ([[Summons an icy wall of %d length for %d turns. Ice walls are transparent. return ([[Summons an icy wall of %d length for %d turns. Ice walls are transparent.
Each point in cold drake talents also increases your cold resistance by 1%%.]]):format(3 + math.floor(self:getTalentLevel(t) / 2) * 2, 4 + self:getTalentLevel(t)) Each point in cold drake talents also increases your cold resistance by 1%%.]]):format(3 + math.floor(self:getTalentLevel(t) / 2) * 2, t.getDuration(self, t))
end, end,
} }
......
...@@ -138,7 +138,11 @@ newTalent{ ...@@ -138,7 +138,11 @@ newTalent{
shader = "shadow_simulacrum", shader = "shadow_simulacrum",
shader_args = { color = {0.6, 0.0, 0.0}, base = 0.9, time_factor = 1500 }, shader_args = { color = {0.6, 0.0, 0.0}, base = 0.9, time_factor = 1500 },
always_remember = true, always_remember = true,
desc = "a summoned wall of mental energy",
type = "wall",
can_pass = {pass_wall=1}, can_pass = {pass_wall=1},
does_block_move = true,
show_tooltip = true,
block_move = true, block_move = true,
block_sight = true, block_sight = true,
temporary = t.getDuration(self, t), temporary = t.getDuration(self, t),
...@@ -158,10 +162,14 @@ newTalent{ ...@@ -158,10 +162,14 @@ newTalent{
game.level.map:updateMap(self.x, self.y) game.level.map:updateMap(self.x, self.y)
end end
end, end,
dig = function(src, x, y, old)
game.level:removeEntity(old)
return nil, old.old_feat
end,
summoner_gain_exp = true, summoner_gain_exp = true,
summoner = self, summoner = self,
} }
e.tooltip = mod.class.Grid.tooltip
game.level:addEntity(e) game.level:addEntity(e)
game.level.map(px, py, Map.TERRAIN, e) game.level.map(px, py, Map.TERRAIN, e)
game.nicer_tiles:updateAround(game.level, px, py) game.nicer_tiles:updateAround(game.level, px, py)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod" -- Nicolas Casalini "DarkGod"
-- darkgod@te4.org -- darkgod@te4.org
local Object = require "engine.Object" local Object = require "mod.class.Object"
newTalent{ newTalent{
name = "Stone Skin", name = "Stone Skin",
...@@ -155,10 +155,14 @@ newTalent{ ...@@ -155,10 +155,14 @@ newTalent{
local e = Object.new{ local e = Object.new{
old_feat = oe, old_feat = oe,
name = "summoned wall", image = "terrain/granite_wall1.png", name = "stone wall", image = "terrain/granite_wall1.png",
display = '#', color_r=255, color_g=255, color_b=255, back_color=colors.GREY, display = '#', color_r=255, color_g=255, color_b=255, back_color=colors.GREY,
desc = "a summoned wall of stone",
type = "wall", --subtype = "floor",
always_remember = true, always_remember = true,
can_pass = {pass_wall=1}, can_pass = {pass_wall=1},
does_block_move = true,
show_tooltip = true,
block_move = true, block_move = true,
block_sight = true, block_sight = true,
temporary = t.getDuration(self, t), temporary = t.getDuration(self, t),
...@@ -181,6 +185,7 @@ newTalent{ ...@@ -181,6 +185,7 @@ newTalent{
summoner_gain_exp = true, summoner_gain_exp = true,
summoner = self, summoner = self,
} }
e.tooltip = mod.class.Grid.tooltip
game.level:addEntity(e) game.level:addEntity(e)
game.level.map(x + i, y + j, Map.TERRAIN, e) game.level.map(x + i, y + j, Map.TERRAIN, e)
end 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