薛之猫大王
2026-02-23 af74b152737e345cc59908bbceb87ff82a2f79a5
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
50
51
52
53
54
55
56
57
58
59
60
local CONST     = require 'config.const'
local Suspicion = require 'systems.suspicion'
local Base      = require 'profession.base'
 
Base.register('hound', function(unit, ability)
    local scan = clicli.area.create_circle_area(unit:get_point(), 8)
    local all  = scan:get_all_unit_in_area()
    scan:remove()
 
    local target = nil
    for _, u in ipairs(all) do
        if u ~= unit and u:is_alive() then
            target = u
            break
        end
    end
    if not target then return end
 
    target:add_buff({ key = CONST.BUFF_TRACKED, source = unit, time = 20.0 })
 
    clicli.timer.loop(1.0, function(timer, count)
        if count > 20 then
            timer:remove()
            return
        end
        if not target:is_alive() then
            timer:remove()
            return
        end
 
        if target:has_tag('npc') then
            target:remove_buffs_by_key(CONST.BUFF_TRACKED)
            timer:remove()
            local abi = unit:find_ability('英雄', CONST.ABI_BLOOD_TRACK)
            if abi then
                local remaining = abi:get_cd()
                abi:set_cd(remaining * 0.5)
            end
            return
        end
 
        -- 玩家目标:通过本地特效显示脚印(仅施法者可见)
        clicli.player.with_local(function(local_player)
            if local_player == unit:get_owner() then
                local tpos = target:get_point()
                clicli.particle.create({
                    type   = CONST.SFX_FOOTPRINT,
                    target = tpos,
                    time   = 2.0,
                    scale  = 1.0,
                    angle  = 0,
                })
            end
        end)
    end, '血迹追踪')
 
    Suspicion.add(unit, 8)
end)
 
return Base