薛之猫大王
2026-02-22 3b98d982bed635e986ab09f8185cfa9b9b2c33bb
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
local CONST     = require 'config.const'
local Suspicion = require 'systems.suspicion'
local Base      = require 'profession.base'
 
Base.register('mimic', function(unit, ability)
    unit:storage_set('mimic_active', true)
 
    local nearby_area = clicli.area.create_circle_area(unit:get_point(), 10)
    local units       = nearby_area:get_all_unit_in_area()
    nearby_area:remove()
 
    local nearest_npc = nil
    for _, u in ipairs(units) do
        if u:has_tag('npc') and u:is_alive() then
            nearest_npc = u
            break
        end
    end
 
    if nearest_npc then
        unit:follow(nearest_npc, 0.5, 2.0, 4.0, 0, false)
    end
 
    local mimic_timer = clicli.timer.loop(1.0, function(timer, count)
        if count > 10 or not unit:storage_get('mimic_active') then
            timer:remove()
            unit:stop()
            unit:storage_set('mimic_active', false)
            return
        end
        Suspicion.add(unit, -5)
    end, '完美模仿', true)
 
    unit:storage_set('mimic_timer', mimic_timer)
end)
 
return Base