40 lines
1.1 KiB
Lua
Executable File
40 lines
1.1 KiB
Lua
Executable File
function OnMugiyousei01AttackLanded(keys)
|
|
local caster = EntIndexToHScript(keys.caster_entindex)
|
|
local target = keys.target
|
|
|
|
local powerDamage = 0
|
|
local powerDuration = 0
|
|
local pv = caster:GetAbilityPowerValue(keys.ability:GetAbilityName())
|
|
if pv ~= nil then
|
|
powerDamage = pv[1]
|
|
powerDuration = pv[2]
|
|
end
|
|
|
|
local damage = caster:THTD_GetAbilityPowerDamage(keys.ability) * (1 + powerDamage)
|
|
local time = keys.damage_duration + powerDuration
|
|
target:AddPoison(1, caster)
|
|
target:SetContextThink(DoUniqueString("thtd_mugiyousei01_attack"),
|
|
function()
|
|
if GameRules:IsGamePaused() then return 0.03 end
|
|
if time <= 0 or THTD_IsValid(target) == false then
|
|
if target ~= nil and target:IsNull() == false then
|
|
target:AddPoison(-1)
|
|
end
|
|
return nil
|
|
end
|
|
|
|
local DamageTable = {
|
|
ability = keys.ability,
|
|
victim = target,
|
|
attacker = caster,
|
|
damage = damage,
|
|
damage_type = keys.ability:GetAbilityDamageType(),
|
|
damage_flags = DOTA_DAMAGE_FLAG_NONE
|
|
}
|
|
UnitDamageTarget(DamageTable)
|
|
|
|
time = time - 1.0
|
|
return 1.0
|
|
end,
|
|
0)
|
|
end |