@myclaw163/clawclaw-cli 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/configuration.md +2 -1
- package/docs/custom-modules/behavior.md +7 -18
- package/docs/custom-modules/trigger.md +3 -4
- package/docs/runtime/short-commands-and-capabilities.md +1 -1
- package/package.json +9 -3
- package/scripts/find-hide-spots.py +2 -2
- package/skills/clawclaw/SKILL.md +17 -13
- package/skills/clawclaw/references/BEHAVIORS.md +13 -9
- package/skills/clawclaw/references/COMMANDS.md +17 -29
- package/skills/clawclaw/references/TACTICS.md +1 -1
- package/src/commands/load.ts +245 -14
- package/src/commands/trigger.ts +22 -13
- package/src/lib/capability-load-diagnostics.ts +182 -0
- package/src/lib/gameplay-config.ts +10 -0
- package/src/lib/hub-reminder.ts +3 -5
- package/src/lib/trigger-config.ts +2 -10
- package/src/runtime/clawclaw/behavior-read-api.ts +1 -1
- package/src/{strategies/pathfind → runtime/clawclaw/navigation}/astar-path.ts +1 -1
- package/src/{strategies/pathfind → runtime/clawclaw/navigation}/escape-planner.ts +1 -1
- package/src/{strategies → runtime/clawclaw/navigation}/hide-spots.ts +2 -2
- package/src/{strategies → runtime/clawclaw/navigation}/off-route-points.ts +6 -3
- package/src/{strategies/pathfind → runtime/clawclaw/navigation}/walkable-grid.ts +1 -1
- package/src/runtime/clawclaw/owner.ts +4 -6
- package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.ts +1 -1
- package/src/runtime/framework/modules/runtime-module-loader.ts +0 -54
- package/src/sdk/behavior-toolkit/escape.ts +2 -2
- package/scripts/build-official-hub-behaviors.mjs +0 -136
- package/scripts/build-official-hub-behaviors.test.mjs +0 -178
- package/scripts/compare-perception-replays.test.ts +0 -188
- package/scripts/enable_ccl_permissions.test.mjs +0 -167
- package/scripts/enable_monitor.test.mjs +0 -201
- package/scripts/sync-bundled-skill.test.mjs +0 -87
- package/scripts/watch-perception-events.test.ts +0 -43
- package/src/behaviors/official-finite/do-task.ts +0 -211
- package/src/behaviors/official-finite/evade.ts +0 -78
- package/src/behaviors/official-finite/find-player.ts +0 -50
- package/src/behaviors/official-finite/follow-player.ts +0 -70
- package/src/behaviors/official-finite/go-to.ts +0 -69
- package/src/behaviors/official-finite/hide-temporarily.ts +0 -77
- package/src/behaviors/official-finite/hold-position.ts +0 -48
- package/src/behaviors/official-finite/hunt-player.ts +0 -47
- package/src/behaviors/official-finite/index.ts +0 -44
- package/src/behaviors/official-finite/inspect-corpse.ts +0 -64
- package/src/behaviors/official-finite/patrol-area.ts +0 -80
- package/src/behaviors/official-finite/report-corpse.ts +0 -73
- package/src/behaviors/official-finite/seek-kill-opportunity.ts +0 -152
- package/src/behaviors/official-finite/shared.ts +0 -27
- package/src/hub-official-behaviors/kill-lone.ts +0 -138
- package/src/hub-official-behaviors/patrol.ts +0 -30
- package/src/hub-official-behaviors/shared.ts +0 -125
- package/src/hub-official-behaviors/task-only.ts +0 -158
- package/src/runtime/clawclaw/plugins/behavior/official-goal-behavior.ts +0 -757
- package/src/strategies/avoid-lone.ts +0 -32
- package/src/strategies/avoid-players.ts +0 -43
- package/src/strategies/corpse-patrol.ts +0 -50
- package/src/strategies/crab-sabotage.ts +0 -48
- package/src/strategies/find-player.ts +0 -49
- package/src/strategies/game-utils.ts +0 -927
- package/src/strategies/goals/anchor-linger.ts +0 -77
- package/src/strategies/goals/avoid-lone-top.ts +0 -189
- package/src/strategies/goals/avoid-players-top.ts +0 -122
- package/src/strategies/goals/conversation-goal.ts +0 -51
- package/src/strategies/goals/corpse-patrol-top.ts +0 -120
- package/src/strategies/goals/crab-octopus-reflexes.ts +0 -109
- package/src/strategies/goals/crab-sabotage-top.ts +0 -139
- package/src/strategies/goals/emergency-hunt-goal.ts +0 -40
- package/src/strategies/goals/find-player-top.ts +0 -136
- package/src/strategies/goals/flee-players-goal.ts +0 -55
- package/src/strategies/goals/follow-companion-goal.ts +0 -130
- package/src/strategies/goals/goal-manager.ts +0 -41
- package/src/strategies/goals/goal-root-strategy.ts +0 -49
- package/src/strategies/goals/goal.ts +0 -28
- package/src/strategies/goals/hide-top.ts +0 -240
- package/src/strategies/goals/keep-away-goal.ts +0 -243
- package/src/strategies/goals/kill-frenzy-top.ts +0 -90
- package/src/strategies/goals/kill-lone-top.ts +0 -166
- package/src/strategies/goals/kill-target-goal.ts +0 -69
- package/src/strategies/goals/kill-target-top.ts +0 -121
- package/src/strategies/goals/leaf-goal.ts +0 -27
- package/src/strategies/goals/linger-corpse-goal.ts +0 -43
- package/src/strategies/goals/lone-kill-core.ts +0 -86
- package/src/strategies/goals/lone-kill-goal.ts +0 -24
- package/src/strategies/goals/lone-kill-task-top.ts +0 -133
- package/src/strategies/goals/move-room-goal.ts +0 -102
- package/src/strategies/goals/normal-shrimp-top.ts +0 -248
- package/src/strategies/goals/paradise-fish-top.ts +0 -234
- package/src/strategies/goals/patrol-top.ts +0 -68
- package/src/strategies/goals/report-patrol-top.ts +0 -97
- package/src/strategies/goals/safe-task-goal.ts +0 -130
- package/src/strategies/goals/social-task-top.ts +0 -192
- package/src/strategies/goals/task-kill-report-top.ts +0 -187
- package/src/strategies/goals/task-only-top.ts +0 -64
- package/src/strategies/goals/task-or-patrol-goal.ts +0 -59
- package/src/strategies/goals/task-report-top.ts +0 -57
- package/src/strategies/goals/wander-task-goal.ts +0 -33
- package/src/strategies/goals/warrior-shrimp-top.ts +0 -293
- package/src/strategies/greeting.ts +0 -60
- package/src/strategies/hide.ts +0 -51
- package/src/strategies/kill-frenzy.ts +0 -32
- package/src/strategies/kill-lone.ts +0 -52
- package/src/strategies/kill-target.ts +0 -48
- package/src/strategies/lone-kill-task.ts +0 -48
- package/src/strategies/meeting-gate.ts +0 -28
- package/src/strategies/move-room.ts +0 -46
- package/src/strategies/paradise-fish.ts +0 -70
- package/src/strategies/patrol.ts +0 -32
- package/src/strategies/player-targets.ts +0 -18
- package/src/strategies/report-patrol.ts +0 -32
- package/src/strategies/shrimp-memory.ts +0 -87
- package/src/strategies/social-task.ts +0 -67
- package/src/strategies/speech-module.ts +0 -123
- package/src/strategies/task-kill-report.ts +0 -49
- package/src/strategies/task-only.ts +0 -34
- package/src/strategies/task-report.ts +0 -50
- package/src/strategies/types.ts +0 -116
- package/src/strategies/warrior-memory.ts +0 -54
- /package/src/{strategies/pathfind → runtime/clawclaw/navigation}/clawclaw-walkable.bin +0 -0
- /package/src/{strategies/pathfind → runtime/clawclaw/navigation}/distance-field.ts +0 -0
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import {
|
|
3
|
-
hasKillUseRemaining,
|
|
4
|
-
hasReachedRoomTarget,
|
|
5
|
-
killCooldownSecs,
|
|
6
|
-
LONE_IGNORE_MS,
|
|
7
|
-
matchesAnyTarget,
|
|
8
|
-
nearestPlayerByDistance,
|
|
9
|
-
nonTeammatesVisible,
|
|
10
|
-
PatrolState,
|
|
11
|
-
PROGRESS_INTERVAL_MS,
|
|
12
|
-
} from '../game-utils.js';
|
|
13
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
14
|
-
import { Goal } from './goal.js';
|
|
15
|
-
import { KillVisibleTargetGoal } from './kill-target-goal.js';
|
|
16
|
-
import { MoveRoomGoal } from './move-room-goal.js';
|
|
17
|
-
|
|
18
|
-
const PATROL_PRIORITY = 0.2;
|
|
19
|
-
const HUNT_PRIORITY = 0.5;
|
|
20
|
-
|
|
21
|
-
export class KillLoneTop extends Goal {
|
|
22
|
-
private readonly patrol = new PatrolState();
|
|
23
|
-
private loneIgnoreUntil = 0;
|
|
24
|
-
private patrolStopOnPlayer: boolean | null = null;
|
|
25
|
-
private lastFlaggedTarget: number | null = null;
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
private readonly protectedTargets: number[] = [],
|
|
29
|
-
private readonly huntTargets: number[] = [],
|
|
30
|
-
) {
|
|
31
|
-
super();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
35
|
-
const now = Date.now();
|
|
36
|
-
const nonTeammates = nonTeammatesVisible(state, ctx);
|
|
37
|
-
|
|
38
|
-
if (!hasKillUseRemaining(state)) {
|
|
39
|
-
this.setPatrolGoal(state, ctx, false);
|
|
40
|
-
this.emitProgress(state, ctx);
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const flagged = nearestPlayerByDistance(
|
|
45
|
-
state,
|
|
46
|
-
nonTeammates.filter(p => matchesAnyTarget(p, this.huntTargets, ctx) && !this.isProtected(p, ctx)),
|
|
47
|
-
);
|
|
48
|
-
if (flagged?.seat != null) {
|
|
49
|
-
if (flagged.seat !== this.lastFlaggedTarget) {
|
|
50
|
-
ctx.notifications.push(`根据情报,${flagged.name}被标记为目标,主动出击!`);
|
|
51
|
-
this.lastFlaggedTarget = flagged.seat;
|
|
52
|
-
}
|
|
53
|
-
this.setHuntGoal(flagged.seat, true);
|
|
54
|
-
return [];
|
|
55
|
-
} else {
|
|
56
|
-
this.lastFlaggedTarget = null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (nonTeammates.length === 0 && state.players.length > 0) {
|
|
60
|
-
this.loneIgnoreUntil = now + LONE_IGNORE_MS;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (now < this.loneIgnoreUntil || nonTeammates.length === 0) {
|
|
64
|
-
this.setPatrolGoal(state, ctx, now >= this.loneIgnoreUntil);
|
|
65
|
-
this.emitProgress(state, ctx);
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (nonTeammates.length > 1) {
|
|
70
|
-
this.loneIgnoreUntil = now + LONE_IGNORE_MS;
|
|
71
|
-
this.setPatrolGoal(state, ctx, false);
|
|
72
|
-
this.emitProgress(state, ctx);
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const target = nonTeammates[0];
|
|
77
|
-
if (this.isProtected(target, ctx)) {
|
|
78
|
-
this.loneIgnoreUntil = now + LONE_IGNORE_MS;
|
|
79
|
-
this.setPatrolGoal(state, ctx, false);
|
|
80
|
-
this.emitProgress(state, ctx);
|
|
81
|
-
return [];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (target.seat == null) {
|
|
85
|
-
this.setPatrolGoal(state, ctx, false);
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
this.setHuntGoal(target.seat);
|
|
89
|
-
this.emitProgress(state, ctx);
|
|
90
|
-
return [];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** protectedTargets 中的玩家永不击杀;与 huntTargets 重叠时保护优先。 */
|
|
94
|
-
private isProtected(p: PlayerInfo, ctx: StrategyContext): boolean {
|
|
95
|
-
return matchesAnyTarget(p, this.protectedTargets, ctx);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private setHuntGoal(targetSeat: number, ignoreCrowd = false): void {
|
|
99
|
-
const worker = this.subGoal;
|
|
100
|
-
if (worker instanceof KillVisibleTargetGoal && worker.targetSeat === targetSeat && worker.ignoreCrowd === ignoreCrowd) return;
|
|
101
|
-
if (this.subGoal) this.removeSubGoal();
|
|
102
|
-
this.setSubGoal(new KillVisibleTargetGoal(targetSeat, this.protectedTargets, ignoreCrowd), HUNT_PRIORITY);
|
|
103
|
-
this.patrolStopOnPlayer = null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private setPatrolGoal(state: GameState, ctx: StrategyContext, stopOnPlayer: boolean): void {
|
|
107
|
-
let room = this.patrol.nextRoom(ctx);
|
|
108
|
-
if (!room) {
|
|
109
|
-
this.clearGoal();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (hasReachedRoomTarget(state, room)) {
|
|
114
|
-
this.patrol.advance(ctx);
|
|
115
|
-
room = this.patrol.nextRoom(ctx);
|
|
116
|
-
if (!room) {
|
|
117
|
-
this.clearGoal();
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const worker = this.subGoal;
|
|
123
|
-
if (worker instanceof MoveRoomGoal && worker.room === room.name && this.patrolStopOnPlayer === stopOnPlayer) return;
|
|
124
|
-
if (this.subGoal) this.removeSubGoal();
|
|
125
|
-
this.setSubGoal(new MoveRoomGoal(room.name, hasReachedRoomTarget, {
|
|
126
|
-
emitProgress: false,
|
|
127
|
-
stopOnPlayer,
|
|
128
|
-
purpose: '巡逻寻找落单目标',
|
|
129
|
-
}), PATROL_PRIORITY);
|
|
130
|
-
this.patrolStopOnPlayer = stopOnPlayer;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
private clearGoal(): void {
|
|
134
|
-
if (this.subGoal) this.removeSubGoal();
|
|
135
|
-
this.patrolStopOnPlayer = null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private emitProgress(state: GameState, ctx: StrategyContext): void {
|
|
139
|
-
const now = Date.now();
|
|
140
|
-
if (now - ctx.lastProgressNotifyAt < PROGRESS_INTERVAL_MS) return;
|
|
141
|
-
ctx.lastProgressNotifyAt = now;
|
|
142
|
-
|
|
143
|
-
const room = state.you.room ?? '未知';
|
|
144
|
-
const cd = killCooldownSecs(state);
|
|
145
|
-
const killsRemaining = state.you.kills_remaining;
|
|
146
|
-
const nonTeammates = nonTeammatesVisible(state, ctx);
|
|
147
|
-
|
|
148
|
-
let msg = `[进度] 当前在${room}`;
|
|
149
|
-
if (nonTeammates.length === 0) {
|
|
150
|
-
msg += ',视野内没有目标,继续巡逻寻找落单猎物。';
|
|
151
|
-
} else if (nonTeammates.length === 1) {
|
|
152
|
-
const target = nonTeammates[0];
|
|
153
|
-
if (this.isProtected(target, ctx)) {
|
|
154
|
-
msg += `,视野内发现保护目标${target.name},不动手。`;
|
|
155
|
-
} else {
|
|
156
|
-
msg += `,视野内发现落单目标${target.name}。`;
|
|
157
|
-
}
|
|
158
|
-
if (cd > 0) msg += `攻击冷却中(${cd}s)。`;
|
|
159
|
-
if (killsRemaining === 0) msg += '出刀次数已用完。';
|
|
160
|
-
} else {
|
|
161
|
-
msg += `,视野内有${nonTeammates.length}人,不适合动手,暂时回避。`;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
ctx.notifications.push(msg);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import { Action } from '../../sdk/action.js';
|
|
3
|
-
import {
|
|
4
|
-
canUseKill,
|
|
5
|
-
dist,
|
|
6
|
-
hasKillUseRemaining,
|
|
7
|
-
killCommitRange,
|
|
8
|
-
LONE_FOLLOW_DISTANCE,
|
|
9
|
-
matchesAnyTarget,
|
|
10
|
-
nonTeammatesVisible,
|
|
11
|
-
playerStrategyIntent,
|
|
12
|
-
setStrategyIntent,
|
|
13
|
-
strategyDecision,
|
|
14
|
-
strategyPlayerLabel,
|
|
15
|
-
} from '../game-utils.js';
|
|
16
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
17
|
-
import { Goal } from './goal.js';
|
|
18
|
-
|
|
19
|
-
export class KillVisibleTargetGoal extends Goal {
|
|
20
|
-
constructor(
|
|
21
|
-
public readonly targetSeat: number,
|
|
22
|
-
private readonly protectedTargets: number[],
|
|
23
|
-
public readonly ignoreCrowd = false,
|
|
24
|
-
) {
|
|
25
|
-
super();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
29
|
-
const target = this.target(state, ctx);
|
|
30
|
-
if (!target) return [];
|
|
31
|
-
if (!hasKillUseRemaining(state)) return [];
|
|
32
|
-
|
|
33
|
-
const d = target.distance ?? dist(state.you.x, state.you.y, target.x, target.y);
|
|
34
|
-
|
|
35
|
-
if (d <= killCommitRange(state.you.role)) {
|
|
36
|
-
if (canUseKill(state)) {
|
|
37
|
-
if (target.seat == null || target.seat <= 0) return [];
|
|
38
|
-
ctx.notifications.push(`发现追杀目标${target.name},出刀!`);
|
|
39
|
-
return [strategyDecision(Action.kill(target.seat), playerStrategyIntent(target, '追杀', 'acting'))];
|
|
40
|
-
}
|
|
41
|
-
if (d > LONE_FOLLOW_DISTANCE) {
|
|
42
|
-
return [strategyDecision(Action.move({ x: target.x, y: target.y }), playerStrategyIntent(target, '追杀', 'moving'))];
|
|
43
|
-
}
|
|
44
|
-
setStrategyIntent(ctx, {
|
|
45
|
-
activity: 'waiting',
|
|
46
|
-
summary: `正在${target.room || state.you.room || '当前位置'}贴近${strategyPlayerLabel(target)},等待击杀冷却。`,
|
|
47
|
-
...(target.room ? { room: target.room } : {}),
|
|
48
|
-
targetPlayer: target.name,
|
|
49
|
-
});
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
ctx.notifications.push(`发现追杀目标${target.name},正在靠近!`);
|
|
54
|
-
return [strategyDecision(Action.move({ x: target.x, y: target.y }), playerStrategyIntent(target, '追杀', 'moving'))];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
isFinish(state: GameState, ctx: StrategyContext): boolean {
|
|
58
|
-
return this.target(state, ctx) == null;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private target(state: GameState, ctx: StrategyContext): PlayerInfo | null {
|
|
62
|
-
const visible = nonTeammatesVisible(state, ctx);
|
|
63
|
-
if (!this.ignoreCrowd && visible.length !== 1) return null;
|
|
64
|
-
const target = visible.find(p => p.seat === this.targetSeat) ?? null;
|
|
65
|
-
if (!target) return null;
|
|
66
|
-
if (matchesAnyTarget(target, this.protectedTargets, ctx)) return null;
|
|
67
|
-
return target;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import type { GameState } from '../../sdk/types.js';
|
|
2
|
-
import {
|
|
3
|
-
dist,
|
|
4
|
-
killCooldownSecs,
|
|
5
|
-
isTargetAlive,
|
|
6
|
-
isRecentlyKilledTarget,
|
|
7
|
-
killCommitRange,
|
|
8
|
-
LONE_FOLLOW_DISTANCE,
|
|
9
|
-
LONE_IGNORE_MS,
|
|
10
|
-
matchesTarget,
|
|
11
|
-
nearestVisibleTarget,
|
|
12
|
-
patrolStep,
|
|
13
|
-
PatrolState,
|
|
14
|
-
PROGRESS_INTERVAL_MS,
|
|
15
|
-
pursueVisibleTarget,
|
|
16
|
-
setStrategyIntent,
|
|
17
|
-
strategyPlayerLabel,
|
|
18
|
-
} from '../game-utils.js';
|
|
19
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
20
|
-
import { Goal } from './goal.js';
|
|
21
|
-
|
|
22
|
-
export class KillTargetTop extends Goal {
|
|
23
|
-
private readonly patrol = new PatrolState();
|
|
24
|
-
private skipStopUntil = 0;
|
|
25
|
-
private completedAfterKill = false;
|
|
26
|
-
private completedNotified = false;
|
|
27
|
-
|
|
28
|
-
constructor(private readonly targets: number[]) {
|
|
29
|
-
super();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
onMeetingResume(): void {
|
|
33
|
-
this.skipStopUntil = Date.now() + LONE_IGNORE_MS;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
37
|
-
if (this.completedAfterKill) return this.completedPatrol(state, ctx);
|
|
38
|
-
|
|
39
|
-
const recentlyKilledAnyTarget = this.targets.some(t => isRecentlyKilledTarget(t, ctx));
|
|
40
|
-
const allTargetsDead = this.allTargetsDeadInState(state, ctx);
|
|
41
|
-
const validTargets = this.targets.filter(t => this.isValidTarget(t, state, ctx));
|
|
42
|
-
if (validTargets.length === 0) {
|
|
43
|
-
if (recentlyKilledAnyTarget || allTargetsDead || this.completedAfterKill) {
|
|
44
|
-
this.completedAfterKill = true;
|
|
45
|
-
return this.completedPatrol(state, ctx);
|
|
46
|
-
}
|
|
47
|
-
ctx.notifications.push('所有目标都已死亡或为队友');
|
|
48
|
-
setStrategyIntent(ctx, {
|
|
49
|
-
activity: 'idle',
|
|
50
|
-
summary: '没有可追杀的目标,正在等待下一步指令。',
|
|
51
|
-
});
|
|
52
|
-
this.emitProgress(state, ctx);
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const target = nearestVisibleTarget(state, ctx, validTargets);
|
|
57
|
-
if (target) {
|
|
58
|
-
const decision = pursueVisibleTarget(state, target, { kill: true, followDistance: LONE_FOLLOW_DISTANCE });
|
|
59
|
-
if (decision?.action.type === 'kill') {
|
|
60
|
-
ctx.notifications.push(`发现目标${target.name}在攻击范围内,出刀!`);
|
|
61
|
-
} else {
|
|
62
|
-
const d = target.distance ?? dist(state.you.x, state.you.y, target.x, target.y);
|
|
63
|
-
if (d > killCommitRange(state.you.role)) ctx.notifications.push(`发现目标${target.name},正在靠近!`);
|
|
64
|
-
}
|
|
65
|
-
if (!decision) {
|
|
66
|
-
setStrategyIntent(ctx, {
|
|
67
|
-
activity: 'waiting',
|
|
68
|
-
summary: `正在${target.room || state.you.room || '当前位置'}贴近${strategyPlayerLabel(target)},等待击杀冷却。`,
|
|
69
|
-
...(target.room ? { room: target.room } : {}),
|
|
70
|
-
targetPlayer: target.name,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
this.emitProgress(state, ctx);
|
|
74
|
-
return decision ? [decision] : [];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (state.players.length > 0 || ctx.emergency) {
|
|
78
|
-
this.skipStopUntil = Date.now() + LONE_IGNORE_MS;
|
|
79
|
-
}
|
|
80
|
-
this.emitProgress(state, ctx);
|
|
81
|
-
return patrolStep(state, ctx, this.patrol, Date.now() >= this.skipStopUntil, '巡逻寻找追杀目标');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private completedPatrol(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
85
|
-
if (!this.completedNotified) {
|
|
86
|
-
ctx.notifications.push('击杀目标已完成,切换巡逻离开现场。');
|
|
87
|
-
ctx.forcePatrolAdvance = true;
|
|
88
|
-
this.completedNotified = true;
|
|
89
|
-
}
|
|
90
|
-
return patrolStep(state, ctx, this.patrol, false, '离开现场巡逻');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private isValidTarget(t: number, state: GameState, ctx: StrategyContext): boolean {
|
|
94
|
-
if (!isTargetAlive(state, t, ctx)) return false;
|
|
95
|
-
return !ctx.teammates.has(String(t));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private allTargetsDeadInState(state: GameState, ctx: StrategyContext): boolean {
|
|
99
|
-
return this.targets.length > 0 && this.targets.every(target => this.targetDeadInState(target, state, ctx));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private targetDeadInState(target: number, state: GameState, ctx: StrategyContext): boolean {
|
|
103
|
-
const player = state.all_players?.find(p => matchesTarget(target, p, ctx));
|
|
104
|
-
if (player) return player.is_alive === false;
|
|
105
|
-
return (ctx.knownCorpses ?? []).some(corpse => matchesTarget(target, corpse, ctx));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private emitProgress(state: GameState, ctx: StrategyContext): void {
|
|
109
|
-
const now = Date.now();
|
|
110
|
-
if (now - ctx.lastProgressNotifyAt < PROGRESS_INTERVAL_MS) return;
|
|
111
|
-
ctx.lastProgressNotifyAt = now;
|
|
112
|
-
|
|
113
|
-
const room = state.you.room ?? '未知';
|
|
114
|
-
const cd = killCooldownSecs(state);
|
|
115
|
-
const killsRemaining = state.you.kills_remaining;
|
|
116
|
-
let msg = `[进度] 当前在${room},正在寻找目标: ${this.targets.join(', ')}。`;
|
|
117
|
-
if (cd > 0) msg += `攻击冷却中(${cd}s)。`;
|
|
118
|
-
if (killsRemaining === 0) msg += '出刀次数已用完。';
|
|
119
|
-
ctx.notifications.push(msg);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { BehaviorDecision } from '../types.js';
|
|
2
|
-
import { Goal } from './goal.js';
|
|
3
|
-
|
|
4
|
-
export const URGENT_GOAL_PRIORITY = 1;
|
|
5
|
-
/** 残局抢修紧急任务:高于游走任务、低于落单猎杀/反射(URGENT),故对发言仍可被打断(< URGENT)。 */
|
|
6
|
-
export const EMERGENCY_GOAL_PRIORITY = 0.6;
|
|
7
|
-
export const WANDER_GOAL_PRIORITY = 0.2;
|
|
8
|
-
|
|
9
|
-
export class LeafGoal extends Goal {
|
|
10
|
-
constructor(private readonly decisions: BehaviorDecision[]) {
|
|
11
|
-
super();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
tick(): BehaviorDecision[] {
|
|
15
|
-
return this.decisions;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function setBehavior(parent: Goal, child: Goal, priority: number): BehaviorDecision[] {
|
|
20
|
-
if (parent.subGoal) parent.removeSubGoal();
|
|
21
|
-
parent.setSubGoal(child, priority);
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function emitLeaf(parent: Goal, decisions: BehaviorDecision[], priority: number): BehaviorDecision[] {
|
|
26
|
-
return setBehavior(parent, new LeafGoal(decisions), priority);
|
|
27
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import { Action } from '../../sdk/action.js';
|
|
3
|
-
import { nearestKnownCorpse, nearestKnownCorpseNav, strategyDecision } from '../game-utils.js';
|
|
4
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
5
|
-
import { AnchorLinger } from './anchor-linger.js';
|
|
6
|
-
import { Goal } from './goal.js';
|
|
7
|
-
|
|
8
|
-
export class LingerCorpseGoal extends Goal {
|
|
9
|
-
private readonly wander = new AnchorLinger();
|
|
10
|
-
|
|
11
|
-
constructor(private readonly avoidResolver?: (state: GameState, ctx: StrategyContext) => PlayerInfo[]) {
|
|
12
|
-
super();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
16
|
-
const body = nearestKnownCorpse(state, ctx);
|
|
17
|
-
if (!body) {
|
|
18
|
-
// 还没拿到尸体坐标:朝尸体所在房间靠近,人进视野后坐标自然补全,再切到下面的贴尸游走。
|
|
19
|
-
this.wander.reset();
|
|
20
|
-
const nav = nearestKnownCorpseNav(state, ctx);
|
|
21
|
-
return nav ? [strategyDecision(Action.move({ x: nav.x, y: nav.y }), {
|
|
22
|
-
activity: 'moving',
|
|
23
|
-
summary: `正在前往${nav.room || '尸体所在区域'}寻找${nav.name ? `${nav.name}的尸体` : '尸体'}。`,
|
|
24
|
-
...(nav.room ? { room: nav.room } : {}),
|
|
25
|
-
})] : [];
|
|
26
|
-
}
|
|
27
|
-
// 有坐标:在尸体周围 40-100 粘性徘徊(AnchorLinger 负责粘住游走点、按 avoid 偏到对侧)。
|
|
28
|
-
const key = body.name ?? `${Math.round(body.x)},${Math.round(body.y)}`;
|
|
29
|
-
const avoid = this.avoidResolver?.(state, ctx) ?? [];
|
|
30
|
-
return [strategyDecision(Action.move(this.wander.step(state, key, body, avoid)), {
|
|
31
|
-
activity: 'moving',
|
|
32
|
-
summary: `正在${body.room || state.you.room || '当前位置'}的${body.name ? `${body.name}的尸体` : '尸体'}附近徘徊。`,
|
|
33
|
-
...(body.room ? { room: body.room } : {}),
|
|
34
|
-
})];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Nav / 非 Nav 的不对称是有意的:tick 取坐标用严格的 nearestKnownCorpse(没坐标无法定点游走),
|
|
38
|
-
// 但只要还记得尸体在某房间(nearestKnownCorpseNav 非空)就不该 finish——此时应继续走向房间锚点,
|
|
39
|
-
// 等人进视野把坐标补全,否则尸体一离开视野就提前结束、再也走不回去。
|
|
40
|
-
isFinish(state: GameState, ctx: StrategyContext): boolean {
|
|
41
|
-
return nearestKnownCorpseNav(state, ctx) == null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import { Action } from '../../sdk/action.js';
|
|
3
|
-
import {
|
|
4
|
-
canUseKill,
|
|
5
|
-
dist,
|
|
6
|
-
killCommitRange,
|
|
7
|
-
LONE_IGNORE_MS,
|
|
8
|
-
nonTeammatesVisible,
|
|
9
|
-
playerStrategyIntent,
|
|
10
|
-
strategyDecision,
|
|
11
|
-
} from '../game-utils.js';
|
|
12
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
13
|
-
|
|
14
|
-
export interface LoneKillOptions {
|
|
15
|
-
/** 紧急期调用方可无视「刚遇到人群」后的短暂停手窗口。 */
|
|
16
|
-
bypassIgnoreWindow?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type LoneKillAssessment =
|
|
20
|
-
| { kind: 'hunt'; target: PlayerInfo }
|
|
21
|
-
| { kind: 'idle' };
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* crab-sabotage 与 lone-kill-task 共享的落单猎杀状态机。
|
|
25
|
-
* 刀在冷却(或出刀用完)时一律返回 idle,让上层下沉去做低优先级任务,而不是追/原地等刀。
|
|
26
|
-
*/
|
|
27
|
-
export class LoneKillCore {
|
|
28
|
-
private loneIgnoreUntil = 0;
|
|
29
|
-
private suppressStop = false;
|
|
30
|
-
|
|
31
|
-
reset(): void {
|
|
32
|
-
this.loneIgnoreUntil = 0;
|
|
33
|
-
this.suppressStop = false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** 兜底任务/巡逻移动是否应 stop_on_player。 */
|
|
37
|
-
patrolStopOnPlayer(): boolean {
|
|
38
|
-
return !this.suppressStop;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
assess(state: GameState, ctx: StrategyContext, opts: LoneKillOptions = {}): LoneKillAssessment {
|
|
42
|
-
const now = Date.now();
|
|
43
|
-
this.suppressStop = false;
|
|
44
|
-
const nonTeammates = nonTeammatesVisible(state, ctx);
|
|
45
|
-
|
|
46
|
-
if (nonTeammates.length === 0) {
|
|
47
|
-
if (state.players.length > 0) {
|
|
48
|
-
this.loneIgnoreUntil = now + LONE_IGNORE_MS;
|
|
49
|
-
this.suppressStop = true;
|
|
50
|
-
}
|
|
51
|
-
return { kind: 'idle' };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (nonTeammates.length > 1) {
|
|
55
|
-
this.loneIgnoreUntil = now + LONE_IGNORE_MS;
|
|
56
|
-
this.suppressStop = true;
|
|
57
|
-
return { kind: 'idle' };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (!opts.bypassIgnoreWindow && now < this.loneIgnoreUntil) {
|
|
61
|
-
this.suppressStop = true;
|
|
62
|
-
return { kind: 'idle' };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!canUseKill(state)) {
|
|
66
|
-
// 刀在冷却或出刀已用完:不追不等,下沉做低优先级伪装任务,冷却好再下手
|
|
67
|
-
//(贴脸反射刀 immediateLoneKillDecision 仍会在冷却结束瞬间生效,不丢顺手的杀)。
|
|
68
|
-
this.suppressStop = true;
|
|
69
|
-
return { kind: 'idle' };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return { kind: 'hunt', target: nonTeammates[0] };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
pursue(state: GameState, ctx: StrategyContext, target: PlayerInfo): BehaviorDecision {
|
|
76
|
-
const d = target.distance ?? dist(state.you.x, state.you.y, target.x, target.y);
|
|
77
|
-
if (d <= killCommitRange(state.you.role) && canUseKill(state)) {
|
|
78
|
-
ctx.notifications.push(`发现落单目标${target.name},出刀!`);
|
|
79
|
-
if (target.seat != null && target.seat > 0) {
|
|
80
|
-
return strategyDecision(Action.kill(target.seat), playerStrategyIntent(target, '追杀', 'acting'));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (d > killCommitRange(state.you.role)) ctx.notifications.push(`发现落单目标${target.name},正在靠近!`);
|
|
84
|
-
return strategyDecision(Action.move({ x: target.x, y: target.y }), playerStrategyIntent(target, '追杀', 'moving'));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
3
|
-
import { Goal } from './goal.js';
|
|
4
|
-
import type { LoneKillCore } from './lone-kill-core.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 落单猎杀子目标(叶子,由上层以 URGENT 优先级挂载):对上层经 {@link LoneKillCore.assess} 选中、
|
|
8
|
-
* 并经 setTarget() 注入的目标产出追击 / 出刀决策。判定逻辑在 core/上层,本叶子只负责产出动作。
|
|
9
|
-
*/
|
|
10
|
-
export class LoneKillGoal extends Goal {
|
|
11
|
-
private target: PlayerInfo | null = null;
|
|
12
|
-
|
|
13
|
-
constructor(private readonly core: LoneKillCore) {
|
|
14
|
-
super();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
setTarget(target: PlayerInfo): void {
|
|
18
|
-
this.target = target;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
22
|
-
return this.target ? [this.core.pursue(state, ctx, this.target)] : [];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import {
|
|
3
|
-
emergencyRushDecision,
|
|
4
|
-
firstAvailableTask,
|
|
5
|
-
killCooldownSecs,
|
|
6
|
-
killYieldsToEmergencyRepair,
|
|
7
|
-
nonTeammatesVisible,
|
|
8
|
-
PatrolState,
|
|
9
|
-
PROGRESS_INTERVAL_MS,
|
|
10
|
-
} from '../game-utils.js';
|
|
11
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
12
|
-
import { Goal } from './goal.js';
|
|
13
|
-
import { LoneKillCore } from './lone-kill-core.js';
|
|
14
|
-
import { LoneKillGoal } from './lone-kill-goal.js';
|
|
15
|
-
import { WanderTaskGoal } from './wander-task-goal.js';
|
|
16
|
-
import { emitLeaf, EMERGENCY_GOAL_PRIORITY, setBehavior, URGENT_GOAL_PRIORITY, WANDER_GOAL_PRIORITY } from './leaf-goal.js';
|
|
17
|
-
import { corpseReportWithNonTeammate, immediateLoneKillDecision } from './crab-octopus-reflexes.js';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 章鱼(中立带刀)的「落单猎杀 + 任务伪装」编排 top。本身不产决策,每 tick 只判定该走哪个行为、
|
|
21
|
-
* 把对应**叶子子目标**挂为唯一子目标(产出动作的是叶子,优先级标注紧急/游走,供 ConversationGoal 判断):
|
|
22
|
-
*
|
|
23
|
-
* 0. 反射(crab-octopus-reflexes,URGENT,抢在落单猎杀编排之前):落单非队友贴脸(出刀范围内)且刀好 →
|
|
24
|
-
* 立刻出刀;否则有尸体且附近有非队友 → 报警/靠近报警(不管尸体是谁造成的)。
|
|
25
|
-
* 1. 落单猎杀(LoneKillGoal,URGENT):core.assess() 判 hunt(刀好且有落单目标)→ 叶子 pursue() 靠近 / 出刀。
|
|
26
|
-
* 刀在冷却时 assess 返回 idle,不追不等,直接下沉到任务伪装。**残局抢修期例外**:落单目标紧挨紧急维修点
|
|
27
|
-
* (同房间或避尸距离内,killYieldsToEmergencyRepair)时跳过反射刀/落单猎杀,让位给第 2 步去修——虾群都
|
|
28
|
-
* 涌向维修点,在那儿动手必被围观、还会撇下维修把破坏倒计时取胜线让给蟹;远离维修点的目标照常猎杀。
|
|
29
|
-
* 2. 残局抢修紧急任务(EMERGENCY,仅已知存活≤6):低于落单猎杀(击杀优先),高于伪装任务——
|
|
30
|
-
* 紧急任务超时则蟹阵营直接获胜,中立章鱼靠活到最后取胜,故残局抢着把维修做掉、掐断蟹的破坏取胜线。
|
|
31
|
-
* 3. 任务伪装 / 巡逻(WanderTaskGoal,WANDER):做已分配的伪装任务(排除当前紧急任务,那个走第 2 步),
|
|
32
|
-
* 跳过紧挨已知尸体(含看见过、已离开视野的)的任务,没任务就按房间巡逻,绝不停在原地。
|
|
33
|
-
*/
|
|
34
|
-
export class LoneKillTaskTop extends Goal {
|
|
35
|
-
private readonly killCore = new LoneKillCore();
|
|
36
|
-
private readonly patrol = new PatrolState();
|
|
37
|
-
private readonly loneKillGoal = new LoneKillGoal(this.killCore);
|
|
38
|
-
private readonly wanderGoal = new WanderTaskGoal(
|
|
39
|
-
// 排除当前紧急任务:它由 tick 里的残局抢修分支按 EMERGENCY 优先级处理,不在此当普通伪装任务做。
|
|
40
|
-
(state, ctx) => firstAvailableTask(
|
|
41
|
-
ctx.taskData,
|
|
42
|
-
t => t.task_name !== ctx.emergency?.task_name,
|
|
43
|
-
undefined,
|
|
44
|
-
ctx.blockedMoveTarget,
|
|
45
|
-
ctx.knownCorpses,
|
|
46
|
-
),
|
|
47
|
-
() => this.killCore.patrolStopOnPlayer(),
|
|
48
|
-
this.patrol,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
onMeetingResume(): void {
|
|
52
|
-
this.killCore.reset();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
56
|
-
// 残局抢修期:紧急维修点附近不杀人。虾群都涌向维修点,在那儿动手必被围观、还会撇下维修把破坏
|
|
57
|
-
// 倒计时取胜线让给蟹。落单目标紧挨维修点(同房间或避尸距离内)时跳过反射刀与落单猎杀,让位给下面
|
|
58
|
-
// 的抢修分支;远离维修点的目标照常猎杀(抢修仍低于猎杀的设定不变)。
|
|
59
|
-
const yieldsToRepair = (t: PlayerInfo) => killYieldsToEmergencyRepair(state, ctx, t);
|
|
60
|
-
|
|
61
|
-
const immediateKill = immediateLoneKillDecision(state, ctx, yieldsToRepair);
|
|
62
|
-
if (immediateKill) {
|
|
63
|
-
this.emitProgress(state, ctx, false);
|
|
64
|
-
return emitLeaf(this, immediateKill, URGENT_GOAL_PRIORITY);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const corpseReport = corpseReportWithNonTeammate(state, ctx);
|
|
68
|
-
if (corpseReport) {
|
|
69
|
-
this.emitProgress(state, ctx, false);
|
|
70
|
-
return emitLeaf(this, corpseReport, URGENT_GOAL_PRIORITY);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const target = this.killCore.assess(state, ctx);
|
|
74
|
-
const sparedNearRepair = target.kind === 'hunt' && yieldsToRepair(target.target);
|
|
75
|
-
if (target.kind === 'hunt' && !sparedNearRepair) {
|
|
76
|
-
this.emitProgress(state, ctx, false);
|
|
77
|
-
this.loneKillGoal.setTarget(target.target);
|
|
78
|
-
return setBehavior(this, this.loneKillGoal, URGENT_GOAL_PRIORITY);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// 残局抢修紧急任务(已知存活≤6):高于伪装任务,低于上面的落单猎杀/反射。
|
|
82
|
-
const emergency = emergencyRushDecision(state, ctx);
|
|
83
|
-
if (emergency) {
|
|
84
|
-
this.emitProgress(state, ctx, true, sparedNearRepair ? target.target.name : null);
|
|
85
|
-
return emitLeaf(this, [emergency], EMERGENCY_GOAL_PRIORITY);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.emitProgress(state, ctx, false);
|
|
89
|
-
return setBehavior(this, this.wanderGoal, WANDER_GOAL_PRIORITY);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
private emitProgress(
|
|
93
|
-
state: GameState,
|
|
94
|
-
ctx: StrategyContext,
|
|
95
|
-
emergencyRush: boolean,
|
|
96
|
-
sparedNearRepair: string | null = null,
|
|
97
|
-
): void {
|
|
98
|
-
const now = Date.now();
|
|
99
|
-
if (now - ctx.lastProgressNotifyAt < PROGRESS_INTERVAL_MS) return;
|
|
100
|
-
ctx.lastProgressNotifyAt = now;
|
|
101
|
-
|
|
102
|
-
const room = state.you.room ?? '未知';
|
|
103
|
-
if (emergencyRush) {
|
|
104
|
-
const name = ctx.emergency?.task_name ?? '紧急维修';
|
|
105
|
-
let msg = `[进度] 当前在${room},残局仅剩${state.alive_count}人,抢着去做紧急任务「${name}」,阻止蟹靠破坏倒计时取胜。`;
|
|
106
|
-
if (sparedNearRepair) {
|
|
107
|
-
msg += ` 落单目标${sparedNearRepair}就在维修点附近,先修不杀,免得在虾群涌入的维修点暴露自己。`;
|
|
108
|
-
}
|
|
109
|
-
ctx.notifications.push(msg);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const cd = killCooldownSecs(state);
|
|
113
|
-
const killsRemaining = state.you.kills_remaining;
|
|
114
|
-
const nonTeammates = nonTeammatesVisible(state, ctx);
|
|
115
|
-
|
|
116
|
-
let msg = `[进度] 当前在${room}`;
|
|
117
|
-
if (nonTeammates.length === 0) {
|
|
118
|
-
msg += ',视野内没有落单目标,继续做任务伪装。';
|
|
119
|
-
} else if (nonTeammates.length === 1) {
|
|
120
|
-
msg += `,视野内发现落单目标${nonTeammates[0].name}。`;
|
|
121
|
-
if (cd > 0) msg += `攻击冷却中(${cd}s),先做任务、冷却好再下手。`;
|
|
122
|
-
if (killsRemaining === 0) msg += '出刀次数已用完,继续做任务伪装。';
|
|
123
|
-
} else {
|
|
124
|
-
msg += `,视野内有${nonTeammates.length}人,不适合动手。`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const completed = ctx.taskData.filter(t => t.status === 'completed').length;
|
|
128
|
-
const total = ctx.taskData.length;
|
|
129
|
-
msg += ` 任务进度 ${completed}/${total}。`;
|
|
130
|
-
|
|
131
|
-
ctx.notifications.push(msg);
|
|
132
|
-
}
|
|
133
|
-
}
|