restructure
This commit is contained in:
72
game/scripts/vscripts/abilities/abilityletty.lua
Executable file
72
game/scripts/vscripts/abilities/abilityletty.lua
Executable file
@@ -0,0 +1,72 @@
|
||||
function OnLetty01SpellStart(keys)
|
||||
local caster = keys.caster
|
||||
local targetPoint = keys.target_points[1]
|
||||
|
||||
local powerCount = 0
|
||||
local powerDamage = 0
|
||||
local pv = caster:GetAbilityPowerValue(keys.ability:GetAbilityName())
|
||||
if pv ~= nil then
|
||||
powerCount = pv[1]
|
||||
powerDamage = pv[2]
|
||||
end
|
||||
|
||||
local maxCount = keys.max_count + powerCount
|
||||
local count_effect = maxCount
|
||||
local count = maxCount
|
||||
keys.ability:StartCooldown(maxCount - 1)
|
||||
|
||||
caster:SetContextThink(DoUniqueString("thtd_letty01_spell_start_effect"),
|
||||
function()
|
||||
for i=1,20 do
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/heroes/letty/ability_letty_01.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, targetPoint + Vector(math.cos(math.pi/4*i),math.sin(math.pi/4*i),0)*200 + RandomVector(100))
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
end
|
||||
count_effect = count_effect - 1
|
||||
caster:EmitSound("Sound_THTD.thtd_letty_01")
|
||||
if count_effect > 0 then
|
||||
return 1.0
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
0)
|
||||
|
||||
caster:SetContextThink(DoUniqueString("thtd_letty01_spell_start"),
|
||||
function()
|
||||
if GameRules:IsGamePaused() then return 0.03 end
|
||||
local targets = THTD_FindUnitsInRadius(caster,targetPoint,keys.radius)
|
||||
local damage = (caster:THTD_GetAbilityPowerDamage(keys.ability) + powerDamage * caster:THTD_GetStarDamage()) * 2^(maxCount - count)
|
||||
for k,v in pairs(targets) do
|
||||
local DamageTable = {
|
||||
ability = keys.ability,
|
||||
victim = v,
|
||||
attacker = caster,
|
||||
damage = damage,
|
||||
damage_type = keys.ability:GetAbilityDamageType(),
|
||||
damage_flags = DOTA_DAMAGE_FLAG_NONE
|
||||
}
|
||||
UnitDamageTarget(DamageTable)
|
||||
end
|
||||
|
||||
count = count - 1
|
||||
if count > 0 then
|
||||
return 1.0
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
0)
|
||||
end
|
||||
|
||||
function OnCreatedLetty02Buff(keys)
|
||||
local target = keys.target
|
||||
|
||||
target:AddMagicalResist(-keys.magic_armor)
|
||||
end
|
||||
|
||||
function OnDestroyLetty02Buff(keys)
|
||||
local target = keys.target
|
||||
|
||||
target:AddMagicalResist(keys.magic_armor)
|
||||
end
|
||||
Reference in New Issue
Block a user