restructure
This commit is contained in:
179
game/scripts/vscripts/abilities/abilityyoumu.lua
Executable file
179
game/scripts/vscripts/abilities/abilityyoumu.lua
Executable file
@@ -0,0 +1,179 @@
|
||||
function OnYoumu01AttackLanded(keys)
|
||||
local caster = EntIndexToHScript(keys.caster_entindex)
|
||||
local target = keys.target
|
||||
|
||||
if keys.ability:GetLevel() < 1 then return end
|
||||
|
||||
if caster.thtd_youmu_01_attack_count == nil then
|
||||
caster.thtd_youmu_01_attack_count = 0
|
||||
end
|
||||
|
||||
local powerChance = 0
|
||||
local pv = caster:GetAbilityPowerValue("thtd_youmu_02")
|
||||
if pv ~= nil then
|
||||
powerChance = pv[1]
|
||||
end
|
||||
|
||||
caster:GiveMana(1)
|
||||
|
||||
caster.thtd_youmu_01_attack_count = caster.thtd_youmu_01_attack_count + 1
|
||||
|
||||
if caster.thtd_youmu_01_attack_count >= keys.max_count then
|
||||
caster.thtd_youmu_01_attack_count = 0
|
||||
caster:EmitSound("Hero_Magnataur.ShockWave.Particle")
|
||||
|
||||
local targetPoint = caster:GetOrigin() + caster:GetForwardVector() * keys.length
|
||||
Youmu01Damage(keys,targetPoint,caster:GetOrigin())
|
||||
|
||||
if RollPercentage(caster:GetAbilityValue("thtd_youmu_02", "chance") + powerChance) then
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/thd2/heroes/youmu/youmu_01_blink_effect.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, target:GetOrigin())
|
||||
ParticleManager:SetParticleControlForward(effectIndex, 0 , target:GetForwardVector())
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
targetPoint = target:GetOrigin() - target:GetForwardVector() * keys.length
|
||||
Youmu01Damage(keys,targetPoint,target:GetOrigin())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Youmu01Damage(keys,targetPoint,vecCaster)
|
||||
local caster = EntIndexToHScript(keys.caster_entindex)
|
||||
local target = keys.target
|
||||
local damage = caster:THTD_GetAbilityPowerDamage(keys.ability)
|
||||
if caster:IsPower666() then damage = damage * 3 end
|
||||
|
||||
local targets =
|
||||
FindUnitsInLine(
|
||||
caster:GetTeamNumber(),
|
||||
caster:GetOrigin(),
|
||||
targetPoint,
|
||||
nil,
|
||||
360,
|
||||
keys.ability:GetAbilityTargetTeam(),
|
||||
keys.ability:GetAbilityTargetType(),
|
||||
keys.ability:GetAbilityTargetFlags()
|
||||
)
|
||||
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)
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/thd2/heroes/youmu/youmu_01_blink_effect_a.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, v:GetOrigin())
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
end
|
||||
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/heroes/thtd_youmu/ability_youmu_01_laser.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, vecCaster+Vector(0,0,32))
|
||||
ParticleManager:SetParticleControl(effectIndex, 1, targetPoint+Vector(0,0,32))
|
||||
ParticleManager:SetParticleControl(effectIndex, 9, vecCaster+Vector(0,0,32))
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
end
|
||||
|
||||
function OnYoumu03Damage(keys,targetPoint,vecCaster)
|
||||
local caster = EntIndexToHScript(keys.caster_entindex)
|
||||
local vecCaster = caster:GetOrigin()
|
||||
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/heroes/youmu/youmu_04_circle.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, targetPoint)
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
|
||||
local rad = 210*math.pi/180
|
||||
|
||||
local count = 0
|
||||
|
||||
caster:EmitSound("Sound_THTD.thtd_youmu_01")
|
||||
|
||||
local powerDamage = 0
|
||||
local pv = caster:GetAbilityPowerValue("thtd_youmu_03")
|
||||
if pv ~= nil then
|
||||
powerDamage = pv[1]
|
||||
end
|
||||
|
||||
local damage = caster:THTD_GetAbilityPowerDamage(keys.ability) + powerDamage * caster:THTD_GetStarDamage()
|
||||
if caster:IsPower666() then damage = damage * 3 end
|
||||
if caster:IsPower999() then damage = damage * 4 end
|
||||
|
||||
caster:SetContextThink(DoUniqueString("thtd_youmu_03_spell_start"),
|
||||
function()
|
||||
if GameRules:IsGamePaused() then return 0.03 end
|
||||
rad = rad + 210*math.pi/180
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/thd2/heroes/youmu/youmu_04_sword_effect.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
local effect2VecForward = Vector(targetPoint.x+math.cos(rad)*500,targetPoint.y+math.sin(rad)*500,vecCaster.z)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, vecCaster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 1, effect2VecForward)
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
vecCaster = effect2VecForward
|
||||
|
||||
local targets = THTD_FindUnitsInRadius(caster,targetPoint,550)
|
||||
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)
|
||||
|
||||
if count%5 == 0 then
|
||||
local effectIndex2 = ParticleManager:CreateParticle("particles/heroes/youmu/youmu_02_effect_explosion.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex2, 0, v:GetOrigin())
|
||||
ParticleManager:DestroyParticleSystem(effectIndex2,false)
|
||||
end
|
||||
end
|
||||
|
||||
if count > 20 then return nil end
|
||||
count = count + 1
|
||||
return 0.12
|
||||
end,
|
||||
0)
|
||||
end
|
||||
|
||||
function OnYoumu03SpellStart(keys)
|
||||
local caster = EntIndexToHScript(keys.caster_entindex)
|
||||
local vecCaster = caster:GetOrigin()
|
||||
local targetPoint = keys.target_points[1]
|
||||
|
||||
if caster.thtd_youmu_03_power_bonus == nil then
|
||||
local attack = caster:THTD_GetBaseAttack()
|
||||
local bonus = attack
|
||||
caster:THTD_AddBasePower(bonus)
|
||||
caster.thtd_youmu_03_power_bonus = bonus
|
||||
caster:THTD_AddBaseAttack(-attack)
|
||||
caster.thtd_kagerou_02_attack_bonus = attack
|
||||
caster:SetContextThink(DoUniqueString("dota_timer"),
|
||||
function()
|
||||
if GameRules:IsGamePaused() then return 0.1 end
|
||||
caster:THTD_AddBasePower(-caster.thtd_youmu_03_power_bonus)
|
||||
caster.thtd_youmu_03_power_bonus = nil
|
||||
caster:THTD_AddBaseAttack(caster.thtd_kagerou_02_attack_bonus)
|
||||
caster.thtd_kagerou_02_attack_bonus = nil
|
||||
return nil
|
||||
end,
|
||||
2.5)
|
||||
end
|
||||
|
||||
OnYoumu03Damage(keys,targetPoint,vecCaster)
|
||||
|
||||
local powerChance = 0
|
||||
local pv = caster:GetAbilityPowerValue("thtd_youmu_02")
|
||||
if pv ~= nil then
|
||||
powerChance = pv[1]
|
||||
end
|
||||
|
||||
if RollPercentage(caster:GetAbilityValue("thtd_youmu_02", "chance") + powerChance) then
|
||||
local effectIndex = ParticleManager:CreateParticle("particles/thd2/heroes/youmu/youmu_01_blink_effect.vpcf", PATTACH_CUSTOMORIGIN, caster)
|
||||
ParticleManager:SetParticleControl(effectIndex, 0, caster:GetOrigin() + RandomVector(300))
|
||||
ParticleManager:SetParticleControlForward(effectIndex, 0 , caster:GetForwardVector())
|
||||
ParticleManager:DestroyParticleSystem(effectIndex,false)
|
||||
targetPoint = targetPoint + RandomVector(150)
|
||||
OnYoumu03Damage(keys,targetPoint,vecCaster)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user