local FLY_SWORD = {
id = 90001,
speed = 8,
duration = 15000,
damage = 100,
}
function OnSkillCast(player, target)
local sword = CreateEffect(player.x, player.y, "fly_sword")
local timer
timer = SetTimer(function()
if not sword or not sword.alive then return end
local tx, ty = GetTargetPos(player, target)
MoveTo(sword, tx, ty, FLY_SWORD.speed)
if Distance(sword, tx, ty) < 10 then
Damage(target, FLY_SWORD.damage, player)
DestroyEffect(sword)
KillTimer(timer)
end
end, 100)
end
local FlySword = {}
FlySword.__index = FlySword
function FlySword.new(owner, target, cfg) ... end
function FlySword:update(dt) ... end
function FlySword nHit() ... end
function FlySword:destroy() ... end
return FlySword
|