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

100 lines
3.1 KiB
Lua
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function OnSpellStartKagerou01(keys)
local caster = keys.caster
local targetPoint = keys.target_points[1]
local vecForward = (targetPoint - caster:GetOrigin()):Normalized()
local angles = VectorToAngles(vecForward) -- 该方向的角度水平向右逆时针旋转360度
print(angles.y)
local angles2 = VectorToAngles(caster:GetForwardVector()) -- 朝向的角度
print(angles2.y)
end
function OnSpellStartKagerou02(keys)
local caster = keys.caster
local duraiton_time = keys.duration_time
caster:RemoveModifierByName("modifier_kagerou_02_buff")
keys.ability:ApplyDataDrivenModifier(caster, caster, "modifier_kagerou_02_buff", {Duration = duraiton_time})
end
function OnCreatedKagerou02Buff(keys)
local target = keys.target
local powerBonus = 0
local pv = target:GetAbilityPowerValue(keys.ability:GetAbilityName())
if pv ~= nil then
powerBonus = pv[1]
end
if target:IsPower666() then
powerBonus = powerBonus + 30
end
local power = target:THTD_GetBasePower()
local bonus = (keys.bonus_attack + powerBonus) * power
target:THTD_AddBaseAttack(bonus, "thtd_kagerou_02_bonus")
target:THTD_AddBasePower(-power, "thtd_kagerou_02_bonus")
target:THTD_AddAttackSpeed(keys.attack_speed, "thtd_kagerou_02_bonus")
end
function OnDestroyKagerou02Buff(keys)
local target = keys.target
target:THTD_AddBaseAttack("thtd_kagerou_02_bonus")
target:THTD_AddBasePower("thtd_kagerou_02_bonus")
target:THTD_AddAttackSpeed("thtd_kagerou_02_bonus")
end
function OnSpellStartKagerou03(keys)
local caster = keys.caster
local powerDuration = 0
local powerAttackup = 0
local pv = caster:GetAbilityPowerValue(keys.ability:GetAbilityName())
if pv ~= nil then
powerAttackup = pv[1]
powerDuration = pv[2]
end
local attack_up = keys.attack_up + powerAttackup
local duraiton_time = keys.duration_time + powerDuration
local shiftTime = 0.5
UnitStunTarget(caster,caster,shiftTime)
caster:SetContextThink(DoUniqueString("thtd_yuuka_02_plant"),
function()
if GameRules:IsGamePaused() then return 0.03 end
caster.kagerou_03_attack_percentage = attack_up
keys.ability:ApplyDataDrivenModifier(caster, caster, "modifier_kagerou_03_wolf", {Duration = duraiton_time})
return nil
end,
shiftTime)
end
function OnCreatedKagerou03wolf(keys)
local target = keys.target
local model = "models/heroes/lycan/lycan_wolf.vmdl"
if target.origin_mode == nil then
target.origin_mode = target:GetModelName()
end
target:SetOriginalModel(model)
target:SetModel(model)
target:THTD_AddAttackPercentage(target.kagerou_03_attack_percentage, "thtd_kagerou_03_bonus")
target:THTD_AddCritChance(keys.crit_chance, "thtd_kagerou_03_bonus")
local bonus = keys.crit_damage
if target:IsPower999() then
bonus = bonus + 500
end
target:THTD_AddCritDamage(bonus, "thtd_kagerou_03_bonus")
end
function OnDestroyKagerou03wolf(keys)
local target = keys.target
target:SetOriginalModel(target.origin_mode )
target:SetModel(target.origin_mode )
target:THTD_AddAttackPercentage("thtd_kagerou_03_bonus")
target:THTD_AddCritChance("thtd_kagerou_03_bonus")
target:THTD_AddCritDamage("thtd_kagerou_03_bonus")
end