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

small fixes

git-svn-id: http://svn.net-core.org/repos/t-engine4@4324 51575b47-30f0-44d4-a5cc-537603b46e54
parent d5e9d4b1
No related branches found
No related tags found
No related merge requests found
......@@ -220,7 +220,7 @@ function _M:loaded()
self:makeCMap()
local mapseen = function(t, x, y, v)
if x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if not x or not y or x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if v ~= nil then
t[x + y * self.w] = v
self._map:setSeen(x, y, v)
......@@ -230,21 +230,21 @@ function _M:loaded()
return t[x + y * self.w]
end
local mapfov = function(t, x, y, v)
if x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if not x or not y or x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if v ~= nil then
t[x + y * self.w] = v
end
return t[x + y * self.w]
end
local maphasseen = function(t, x, y, v)
if x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if not x or not y or x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if v ~= nil then
t[x + y * self.w] = v
end
return t[x + y * self.w]
end
local mapremember = function(t, x, y, v)
if x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if not x or not y or x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if v ~= nil then
t[x + y * self.w] = v
self._map:setRemember(x, y, v)
......@@ -253,7 +253,7 @@ function _M:loaded()
return t[x + y * self.w]
end
local maplite = function(t, x, y, v)
if x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if not x or not y or x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if v ~= nil then
t[x + y * self.w] = v
self._map:setLite(x, y, v)
......@@ -262,7 +262,7 @@ function _M:loaded()
return t[x + y * self.w]
end
local mapattrs = function(t, x, y, k, v)
if x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if not x or not y or x < 0 or y < 0 or x >= self.w or y >= self.h then return end
if v ~= nil then
if not t[x + y * self.w] then t[x + y * self.w] = {} end
t[x + y * self.w][k] = v
......
......@@ -120,7 +120,7 @@ function _M:setEffect(eff_id, dur, p, silent)
if ret then
game.logSeen(self, ret:gsub("#Target#", self.name:capitalize()):gsub("#target#", self.name))
end
if fly and game.flyers and game.level.map.seens(self.x, self.y) then
if fly and game.flyers and self.x and self.y and game.level.map.seens(self.x, self.y) then
local sx, sy = game.level.map:getTileToScreen(self.x, self.y)
if game.level.map.seens(self.x, self.y) then game.flyers:add(sx, sy, 20, (rng.range(0,2)-1) * 0.5, -3, fly, {255,100,80}) end
end
......@@ -150,7 +150,7 @@ function _M:removeEffect(eff, silent, force)
if ret then
game.logSeen(self, ret:gsub("#Target#", self.name:capitalize()):gsub("#target#", self.name))
end
if fly and game.flyers then
if fly and game.flyers and self.x and self.y then
local sx, sy = game.level.map:getTileToScreen(self.x, self.y)
if game.level.map.seens(self.x, self.y) then game.flyers:add(sx, sy, 20, (rng.range(0,2)-1) * 0.5, -3, fly, {255,100,80}) end
end
......
......@@ -109,27 +109,27 @@ newTalent{
if self:getTalentLevel(t) >= 5 then
local tFeed = self:getTalentFromId(self.T_FEED)
if not tFeed.action(self, tFeed) then return nil end
effect = self:hasEffect(self.EFF_FEED)
else
game.logPlayer(self, "You must begin feeding before you can Devour Life.");
return nil
end
end
if not effect then return nil end
local target = effect.target
if target and not target.dead then
local lifeSteal = t.getLifeSteal(self, t)
self:project({type="hit", x=target.x,y=target.y}, target.x, target.y, DamageType.DEVOUR_LIFE, { dam=lifeSteal })
game.level.map:particleEmitter(self.x, self.y, math.max(math.abs(target.x-self.x), math.abs(target.y-self.y)), "dark_torrent", {tx=target.x-self.x, ty=target.y-self.y})
--local dx, dy = target.x - self.x, target.y - self.y
--game.level.map:particleEmitter(self.x, self.y,math.max(math.abs(dx), math.abs(dy)), "feed_hate", { tx=dx, ty=dy })
game:playSoundNear(self, "talents/fire")
return true
end
return nil
end,
info = function(self, t)
......
......@@ -2975,7 +2975,7 @@ newEffect{
if #targets > 0 then
local hitCount = 1
if rng.percent(eff.extraJumpChance) then hitCount = hitCount + 1 end
if rng.percent(eff.extraJumpChance or 0) then hitCount = hitCount + 1 end
-- Randomly take targets
for i = 1, hitCount do
......@@ -3806,7 +3806,7 @@ newEffect{
on_timeout = function(self, eff)
if math.floor(core.fov.distance(self.x, self.y, eff.src.x, eff.src.y)) > 1 or eff.src.dead or not game.level:hasEntity(eff.src) then
self:removeEffect(self.EFF_GRAPPLED)
end
end
end,
deactivate = function(self, eff)
self:removeTemporaryValue("combat_atk", eff.atk)
......@@ -3826,7 +3826,7 @@ newEffect{
on_lose = function(self, err) return "#Target# has escaped the crushing hold.", "-Crushing Hold" end,
on_timeout = function(self, eff)
local p = self:hasEffect(self.EFF_GRAPPLED)
if p and p.src == eff.src then
if p and p.src == eff.src then
DamageType:get(DamageType.PHYSICAL).projector(eff.src or self, self.x, self.y, DamageType.PHYSICAL, eff.power)
else
self:removeEffect(self.EFF_CRUSHING_HOLD)
......@@ -3845,7 +3845,7 @@ newEffect{
on_lose = function(self, err) return "#Target# has escaped the strangle hold.", "-Strangle Hold" end,
on_timeout = function(self, eff)
local p = self:hasEffect(self.EFF_GRAPPLED)
if p and p.src == eff.src then
if p and p.src == eff.src then
DamageType:get(DamageType.PHYSICAL).projector(eff.src or self, self.x, self.y, DamageType.PHYSICAL, eff.power)
else
self:removeEffect(self.EFF_STRANGLE_HOLD)
......@@ -4464,7 +4464,7 @@ newEffect{
on_lose = function(self, err) return "#Target# is free from the nightmare.", "-Waking Nightmare" end,
on_timeout = function(self, eff)
DamageType:get(DamageType.DARKNESS).projector(eff.src or self, self.x, self.y, DamageType.DARKNESS, eff.dam)
if rng.percent(eff.chance) then
if rng.percent(eff.chance or 0) then
-- Pull random effect
local chance = rng.range(1, 3)
if chance == 1 then
......@@ -4515,7 +4515,7 @@ newEffect{
on_lose = function(self, err) return "#Target# is freed from the demons.", "-Inner Demons" end,
on_timeout = function(self, eff)
if eff.src.dead or not game.level:hasEntity(eff.src) then eff.dur = 0 return true end
if rng.percent(eff.chance) then
if rng.percent(eff.chance or 0) then
if self:checkHit(eff.src:combatSpellpower(), self:combatSpellResist(), 0, 95, 5) then
local t = eff.src:getTalentFromId(eff.src.T_INNER_DEMONS)
t.summon_inner_demons(eff.src, self, t)
......
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