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

stone wall

git-svn-id: http://svn.net-core.org/repos/t-engine4@217 51575b47-30f0-44d4-a5cc-537603b46e54
parent 0e7c3bb8
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ function _M:init(t, no_default)
for k, e in pairs(t) do
local ee = e
if type(e) == "table" then ee = table.clone(e, true) end
if type(e) == "table" and not e.__CLASSNAME then ee = table.clone(e, true) end
self[k] = ee
end
......
......@@ -222,8 +222,10 @@ newDamageType{
local feat = game.level.map(x, y, Map.TERRAIN)
if feat then
if feat.dig then
game.level.map(x, y, Map.TERRAIN, game.zone.grid_list[feat.dig])
game.logSeen({x=x,y=y}, "%s turns into %s.", feat.name:capitalize(), game.zone.grid_list[feat.dig].name)
local newfeat_name = feat.dig
if type(feat.dig) == "function" then newfeat_name = feat.dig(self, x, y, feat) end
game.level.map(x, y, Map.TERRAIN, game.zone.grid_list[newfeat_name])
game.logSeen({x=x,y=y}, "%s turns into %s.", feat.name:capitalize(), game.zone.grid_list[newfeat_name].name)
end
end
end,
......
local Object = require "engine.Object"
newTalent{
name = "Stone Skin",
type = {"spell/earth", 1},
......@@ -69,3 +71,62 @@ newTalent{
The damage will increase with the Magic stat]]):format(8 + self:combatSpellpower(0.15) * self:getTalentLevel(t))
end,
}
newTalent{
name = "Stone Wall",
type = {"spell/earth",4},
points = 5,
cooldown = 12,
mana = 70,
range = 20,
action = function(self, t)
local x, y = self.x, self.y
if self:getTalentLevel(t) >= 4 then
-- local tg = {type="bolt", range=self:getTalentRange(t), nolock=true}
-- local x, y = self:getTarget(tg)
-- if not x or not y then return nil end
-- for i = 1, self:getTalentLevelRaw(t) do
-- self:project(tg, x, y, DamageType.DIG, 1)
-- end
end
for i = -1, 1 do for j = -1, 1 do if game.level.map:isBound(x + i, y + j) then
if not game.level.map:checkAllEntities(x + i, y + j, "block_move") then
-- Ok some explanation, we make a new *OBJECT* because objects can have energy and act
-- it stores the current terrain in "old_feat" and restores it when it expires
-- We CAN set an object as a terrain because they are all entities
local e = Object.new{
old_feat = game.level.map(x + i, y + j, Map.TERRAIN),
name = "summoned wall", image = "terrain/granite_wall1.png",
display = '#', color_r=255, color_g=255, color_b=255,
always_remember = true,
block_move = true,
block_sight = true,
temporary = 2 + self:combatSpellpower(0.03) * self:getTalentLevel(t),
x = x + i, y = y + j,
canAct = function() return true end,
act = function(self)
self:useEnergy()
self.temporary = self.temporary - 1
if self.temporary <= 0 then
print("reseting", self.x, self.y, "to", self.old_feat, self.old_feat.name)
game.level.map(self.x, self.y, Map.TERRAIN, self.old_feat)
game:removeEntity(self)
game.level.map:redisplay()
end
end
}
game:addEntity(e)
print("setting", x+i, y+j, "to", game.level.map(x + i, y + j, Map.TERRAIN), game.level.map(x + i, y + j, Map.TERRAIN).name)
game.level.map(x + i, y + j, Map.TERRAIN, e)
end
end end end
return true
end,
require = { stat = { mag=34 } },
info = function(self, t)
return ([[Entombs yourself in a wall of stone for %d turns.]]):format(2 + self:combatSpellpower(0.03) * self:getTalentLevel(t))
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