function(combat_unit)
local name = "yds_passive_custom"
combat_unit.Attack:RegisterOnMissileImpactCallback(
name,
function(level, attack_data, caster, target)
if attack_data.missile_id ~= "yds_attack" then
return
end
-- 初始化或获取已绑定的属性计数器
caster.yds_passive_custom = caster.yds_passive_custom or caster:GetBoundedAttribute(name)
-- 攻击计数器加1
caster.yds_passive_custom = caster.yds_passive_custom + 1
-- 显示到面板
caster:ModifyAttribute("yds_passive_xs", caster.yds_passive_custom)
-- 当攻击计数器达到4时,重置计数器并触发
if caster.yds_passive_custom >= 4 then
caster.yds_passive_custom = 0
-- 面板属性归0
caster:SetAttribute("yds_passive_xs", 0)
for i = 1, 2 do
combat_unit.Attack:NewMissileAttack(target, "attack_brain")
end
end
end
)
end
function(combat_unit) local name = "yds_passive_custom" combat_unit.Attack:RegisterOnMissileImpactCallback( name, function(level, attack_data, caster, target) if attack_data.missile_id ~= "yds_attack" then return end -- 初始化或获取已绑定的属性计数器 caster.yds_passive_custom = caster.yds_passive_custom or caster:GetBoundedAttribute(name) -- 攻击计数器加1 caster.yds_passive_custom = caster.yds_passive_custom + 1 -- 显示到面板 caster:ModifyAttribute("yds_passive_xs", caster.yds_passive_custom) -- 当攻击计数器达到4时,重置计数器并触发 if caster.yds_passive_custom >= 4 then caster.yds_passive_custom = 0 -- 面板属性归0 caster:SetAttribute("yds_passive_xs", 0) for i = 1, 2 do combat_unit.Attack:NewMissileAttack(target, "attack_brain") end end end ) end