1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
local event_util = {}
local event_handlers = { ['单位-冷却普攻'] = function(which_unit, label, cooldown, callback) local o = {}
msg = which_unit:on(enums.umsg.unit_damage_calc, function(_, u2, event_data)
if is_first_normal_attack(event_data) then which_unit:do_cool_action(label, cooldown, function() callback(u2) end) end end)
local function stop() if msg then which_unit:off(enums.umsg.unit_damage_calc, msg) msg = nil end end
o.msg = msg o.stop = stop
return o end, }
function event_util.register(event_name, ...) event_handlers(event_name, ...) end
function event_util.test() event_util.register('单位-冷却普攻', 'Yxsk127', 10, function(u2) on_trigger(u2) end) end
|