Files
2HUCardTDGame/game/scripts/vscripts/abilities/abilityhanadayousei.lua
2021-11-10 08:48:00 -05:00

31 lines
865 B
Lua
Executable File

function OnHanadayousei01Attack(keys)
local caster = EntIndexToHScript(keys.caster_entindex)
local target = keys.target
local powerCount = 0
local powerRange = 0
local pv = caster:GetAbilityPowerValue(keys.ability:GetAbilityName())
if pv ~= nil then
powerCount = pv[1]
powerRange = pv[2]
end
if caster.__hanadayousei_lock ~= true then
caster.__hanadayousei_lock = true
local targets = THTD_FindUnitsInRadius(caster,caster:GetOrigin(), 800 + powerRange)
local count = 0
for i=1,#targets do
local unit = targets[i]
if unit~=nil and unit:IsNull()==false and unit~=target and unit:IsAlive() then
caster:PerformAttack(unit,true,false,true,false,true,false,true)
count = count + 1
end
if powerCount ~= 99 then
if count >= (3 + powerCount) then
break
end
end
end
caster.__hanadayousei_lock = false
end
end