Code: Select all
newTalent{
name = "Corpsewall",
type = {"spell/corpse", 4},
points = 5,
require = spells_req_high4,
mana = 50,
cooldown = function(self, t) return math.ceil(self:combatTalentLimit(t, 18, 40, 24)) end,
-- getLength = function(self, t) return 1 + math.floor(self:combatTalentScale(t, 3, 7)/2)*2 end,
getNb = function(self,t) return 2 + math.floor(self:combatTalentScale(t, 1, 3)) end,
range = 5,
action = function(self, t)
-- local halflength = math.floor(t.getLength(self,t)/2)
-- local block = function(_, lx, ly)
-- return game.level.map:checkAllEntities(lx, ly, "block_move")
-- end
-- local tg = {type="wall", range=self:getTalentRange(t), halflength=halflength, talent=t, halfmax_spots=halflength+1}
-- local x, y = self:getTarget(tg)
-- if not x or not y then return nil end
-- local _ _, _, _, x, y = self:canProject(tg, x, y)
-- if game.level.map:checkEntity(x, y, Map.TERRAIN, "block_move") then return nil end
local tg = {type="bolt", nowarning=true, range=self:getTalentRange(t), nolock=true, talent=t}
local tx, ty, target = self:getTarget(tg)
if not tx or not ty then return nil end
local _ _, _, _, tx, ty = self:canProject(tg, tx, ty)
target = game.level.map(tx, ty, Map.ACTOR)
if target == self then target = nil end
local nb = t.getNb(self,t)
-- Find space
for i = 1, nb do
local x, y = util.findFreeGrid(tx, ty, 5, true, {[Map.ACTOR]=true})
if not x then
game.logPlayer(self, "Not enough space to summon!")
return
end
local NPC = require "mod.class.NPC"
local m = NPC.new{
<npc details go here>
}
setupSummon(self, m, x, y)
end
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
return ([[Creates a towering wall of flesh and bone of %d length at the target location for 10 turns. The wall is so large that it blocks line of sight, and it will lash out nearby foes with bleeding attacks, diseases and Bone Grasp.]]):
format(t.getNb(self, t))
end,
}