Code: Select all
newTalent{
name = "Fan of Knives",
type = {"technique/throwing-knives", 2},
require = techs_dex_req2,
points = 5,
tactical = { ATTACKAREA = 3 },
getDamage = function (self, t) return self:combatTalentWeaponDamage(t, 0.6, 1.2) end,
getNb = function(self, t) return math.floor(self:combatTalentScale(t, 4, 8)) end,
range = 0,
cooldown = 10,
stamina = 20,
radius = function(self, t) return math.floor(self:combatTalentScale(t, 3, 7)) end,
target = function(self, t)
return {type="cone", range=self:getTalentRange(t), friendlyfire=false, radius=self:getTalentRadius(t)}
end,
action = function(self, t)
local tg = self:getTalentTarget(t)
local x, y = self:getTarget(tg)
if not x or not y then return end
local nb = t.getNb(self,t)
local count = t.getNb(self,t)
local tgts = {}
grids = self:project(tg, x, y, function(px, py)
local target = game.level.map(px, py, engine.Map.ACTOR)
if not target then return end
tgts[#tgts+1] = target
end)
table.shuffle(tgts)
while count > 0 do
if #tgts <= 0 then break end
for i = 1, math.min(nb, #tgts) do
local a, id = tgts[i]
local tg2 = {type="bolt", range=self:getTalentRadius(t), selffire=false, talent=t, display={display='', particle="arrow", particle_args={tile="shockbolt/object/knife_steel"} }}
self:projectile(tg2, a.x, a.y, function(px, py, tg2, self)
local target = game.level.map(px, py, engine.Map.ACTOR)
if target and target ~= self then
local t2 = self:getTalentFromId(self.T_THROWING_KNIVES)
self:attackTargetWith(target, t2.getKnives(self, t), nil, t.getDamage(self,t))
target.turn_procs.fan_of_knives = 1 + (target.turn_procs.fan_of_knives or 0)
if target.turn_procs.fan_of_knives==3 then table.remove(tgts, id) end
end
end)
count = count - 1
end
end
return true
end,
info = function(self, t)
return ([[Throw up to %d throwing knives at enemies within a radius %d cone, for %d%% damage each. If the number of knives exceeds the number of enemies, a target can be hit up to 3 times.]]):
format(t.getNb(self,t), self:getTalentRadius(t), t.getDamage(self, t)*100)
end,
}