87 lines
2.5 KiB
Lua
Executable File
87 lines
2.5 KiB
Lua
Executable File
function OnKogasa01SpellStart(keys)
|
|
local caster = keys.caster
|
|
local targetPoint = keys.target_points[1]
|
|
|
|
local powerRange = 0
|
|
local powerDamage = 0
|
|
local powerSpecial = 0
|
|
local pv = caster:GetAbilityPowerValue(keys.ability:GetAbilityName())
|
|
if pv ~= nil then
|
|
powerRange = pv[1]
|
|
powerDamage = pv[2]
|
|
powerSpecial = pv[3]
|
|
end
|
|
|
|
caster:EmitSound("Sound_THTD.thtd_kogasa_01")
|
|
|
|
local special = 0
|
|
if caster:HasModifier("modifier_byakuren_03_buff") then
|
|
special = caster.thtd_byakuren_buff_kogasa + powerSpecial
|
|
end
|
|
|
|
local damage = caster:THTD_GetAbilityPowerDamage(keys.ability) * (1 + powerDamage)
|
|
local targets = THTD_FindUnitsInRadius(caster,targetPoint,keys.radius + powerRange)
|
|
for k,v in pairs(targets) do
|
|
if not v:HasModifier("modifier_kogasa_debuff") then
|
|
keys.ability:ApplyDataDrivenModifier(caster,v,"modifier_kogasa_debuff", {Duration = keys.duration_time})
|
|
end
|
|
if v.thtd_is_fearing ~= true then
|
|
v.thtd_is_fearing = true
|
|
local current_next_move_point = v.next_move_point
|
|
v.next_move_point = FirstPointList[v.thtd_player_index]
|
|
|
|
local time = keys.duration_time
|
|
v:SetContextThink(DoUniqueString("modifier_kogasa_debuff"),
|
|
function()
|
|
if GameRules:IsGamePaused() then return 0.03 end
|
|
if not IsValidAlive(v) then
|
|
return nil
|
|
end
|
|
if time <= 0 or THTD_IsValid(caster) == false then
|
|
v.next_move_point = current_next_move_point
|
|
v.thtd_is_fearing = false
|
|
return nil
|
|
end
|
|
time = time - 0.1
|
|
return 0.1
|
|
end,
|
|
0)
|
|
end
|
|
|
|
local realDamage = damage
|
|
if special > 0 then
|
|
if v.thtd_kogasa_01_special ~= true then
|
|
v.thtd_kogasa_01_special = true
|
|
UnitDamageHpRemove(caster, v, special)
|
|
else
|
|
realDamage = realDamage * special
|
|
end
|
|
end
|
|
|
|
local DamageTable = {
|
|
ability = keys.ability,
|
|
victim = v,
|
|
attacker = caster,
|
|
damage = realDamage,
|
|
damage_type = keys.ability:GetAbilityDamageType(),
|
|
damage_flags = DOTA_DAMAGE_FLAG_NONE
|
|
}
|
|
UnitDamageTarget(DamageTable)
|
|
end
|
|
|
|
local effectIndex = ParticleManager:CreateParticle("particles/heroes/kogasa/ability_kogasa_01.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
|
ParticleManager:SetParticleControl(effectIndex, 0, targetPoint)
|
|
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
|
end
|
|
|
|
function OnCreatedKogasa02Debuff(keys)
|
|
local target = keys.target
|
|
|
|
target:AddPhysicalArmor(-keys.armor)
|
|
end
|
|
|
|
function OnDestroyKogasa02Debuff(keys)
|
|
local target = keys.target
|
|
|
|
target:AddPhysicalArmor(keys.armor)
|
|
end |