Files
2HUCardTDGame/scripts/vscripts/abilities/abilityhina.lua
2021-10-24 15:36:18 -04:00

144 lines
4.7 KiB
Lua
Executable File

-- 特殊太卡,弃用
function OnHina02Think(keys)
local caster = EntIndexToHScript(keys.caster_entindex)
if keys.ability:GetLevel() < 1 then return end
-- caster:EmitSound("Hero_TrollWarlord.WhirlingAxes.Melee")
local effect = "particles/econ/items/troll_warlord/troll_ti10_shoulder/troll_ti10_whirling_axe_melee.vpcf"
local damage = 1000
local damage_tick = 0.1
local damage_duration = 3.0
local max_count = math.floor(damage_duration/damage_tick + 0.5)
local radius = 1000 - 200
local elapsed_duration = 0
local enemies_hit = {}
local caster_pos = caster:GetAbsOrigin()
local caster_direction = caster:GetForwardVector()
local effectIndexList = {}
local effectPointList = {}
for i = 1,5 do
local axe_target_point = RotatePosition(caster_pos, QAngle(0, i * 72, 0), caster_pos + caster_direction * 175)
local effectIndex = ParticleManager:CreateParticle(effect, PATTACH_ABSORIGIN_FOLLOW, caster)
ParticleManager:SetParticleControl(effectIndex, 0, caster_pos + Vector(0, 0, 100))
ParticleManager:SetParticleControl(effectIndex, 1, axe_target_point + Vector(0, 0, 100))
ParticleManager:SetParticleControl(effectIndex, 4, Vector(damage_duration, 0, 0))
effectIndexList[i] = effectIndex
effectPointList[i] = axe_target_point
end
local count = 1
caster:SetContextThink(DoUniqueString("dota_timer"),
function()
if GameRules:IsGamePaused() then return 0.1 end
for i = 1,5 do
local axe_target_point = RotatePosition(caster_pos, QAngle(0, 360 * count/max_count, 0), effectPointList[i])
axe_target_point = axe_target_point + (axe_target_point - caster_pos):Normalized() * radius * count/max_count
ParticleManager:SetParticleControl(effectIndexList[i], 1, axe_target_point + Vector(0, 0, 100))
end
local targets = THTD_FindUnitsInRadius(caster,caster_pos,1200)
local damage = 1200
for k,v in pairs(targets) do
if v~=nil and v:IsNull()==false and v:IsAlive() then
if enemies_hit[v:entindex()] ~= true then
enemies_hit[v:entindex()] = true
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
end
end
-- If the duration is over, end
if count < max_count then
count = count + 1
return damage_tick
else
for i = 1,5 do
ParticleManager:ReleaseParticleIndex(effectIndexList[i])
end
return nil
end
end,
0.1)
end
function OnSpellStartHina02(keys)
local caster = EntIndexToHScript(keys.caster_entindex)
local targetPoint = keys.target_points[1]
local range = keys.range
local bonus_crit = keys.bonus_crit
local chance = keys.chance
local duration = math.floor(keys.duration * 100 + 0.5)/100
local tick = math.floor(keys.tick * 100 + 0.5)/100
local effect = "particles/econ/items/troll_warlord/troll_ti10_shoulder/troll_ti10_whirling_axe_melee.vpcf"
local effectIndex = ParticleManager:CreateParticle(effect, PATTACH_ABSORIGIN_FOLLOW, caster)
ParticleManager:SetParticleControl(effectIndex, 0, caster:GetAbsOrigin() + Vector(0, 0, 100))
ParticleManager:SetParticleControl(effectIndex, 1, targetPoint + Vector(0, 0, 100))
ParticleManager:SetParticleControl(effectIndex, 4, Vector(duration + 4, 0, 0))
local powerChance = 0
local pv = caster:GetAbilityPowerValue("thtd_hina_02")
if pv ~= nil then
powerChance = pv[1]
end
local crit666 = 1
if caster:IsPower666() then crit666 = 5 end
local time = duration
caster:SetContextThink(DoUniqueString("dota_timer"),
function()
if GameRules:IsGamePaused() then return 0.1 end
time = time - tick
if time < 0 then
ParticleManager:DestroyParticleSystem(effectIndex,true)
return nil
end
local targets = THTD_FindUnitsInRadius(caster,targetPoint,range)
local damage = caster:THTD_GetAbilityPowerDamage(keys.ability)
for k,v in pairs(targets) do
local crit = 1
v.thtd_hina_02_debuff_count = math.min(999, (v.thtd_hina_02_debuff_count or 0) + 1)
local count = v.thtd_hina_02_debuff_count
if caster:IsPower999() then
for _,tar in pairs(targets) do
if v ~= tar then
count = count + (tar.thtd_hina_02_debuff_count or 0) * 0.4
end
end
end
if RollPercentage(chance + powerChance) then
crit = 1 + count * (bonus_crit + powerChance)/100
end
local DamageTable = {
ability = keys.ability,
victim = v,
attacker = caster,
damage = damage * crit * crit666,
damage_type = keys.ability:GetAbilityDamageType(),
damage_flags = DOTA_DAMAGE_FLAG_NONE
}
UnitDamageTarget(DamageTable)
end
return tick
end,
tick)
end