@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,59 +0,0 @@
|
|
|
1
|
-
import type { GameState, TaskInfo } from '../../sdk/types.js';
|
|
2
|
-
import { Action } from '../../sdk/action.js';
|
|
3
|
-
import {
|
|
4
|
-
dist,
|
|
5
|
-
firstAvailableTask,
|
|
6
|
-
patrolStrategyIntent,
|
|
7
|
-
PATROL_REACHED_DISTANCE,
|
|
8
|
-
PatrolState,
|
|
9
|
-
setStrategyIntent,
|
|
10
|
-
strategyDecision,
|
|
11
|
-
taskMoveDecision,
|
|
12
|
-
} from '../game-utils.js';
|
|
13
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
14
|
-
import { Goal } from './goal.js';
|
|
15
|
-
|
|
16
|
-
export type TaskPredicate = (task: TaskInfo) => boolean;
|
|
17
|
-
const NON_CRAB: TaskPredicate = t => t.faction !== 'crab';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 好人虾的默认劳作循环:有可做任务(含紧急任务,由 firstAvailableTask 自动优先)就去做,
|
|
21
|
-
* 没任务就按房间顺序巡逻。抽自 task-report.tryTask,供 task-report / 武士虾共用
|
|
22
|
-
* (进阶普通虾用其安全选任务变体 SafeTaskOrPatrolGoal)。
|
|
23
|
-
*
|
|
24
|
-
* 直接产出 move/doTask 决策、不挂子目标,因此既能作为子目标接入 GoalManager,
|
|
25
|
-
* 也能被编排型 Goal 持有并直接 tick(见 WarriorShrimpTop)。
|
|
26
|
-
* 自身不发进度通知,进度由调用方按场景统一播报。
|
|
27
|
-
*/
|
|
28
|
-
export class TaskOrPatrolGoal extends Goal {
|
|
29
|
-
private readonly patrol = new PatrolState();
|
|
30
|
-
|
|
31
|
-
constructor(private readonly predicate: TaskPredicate = NON_CRAB) {
|
|
32
|
-
super();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
36
|
-
if (state.you.doing_task) return [];
|
|
37
|
-
|
|
38
|
-
const task = firstAvailableTask(ctx.taskData, this.predicate, ctx.emergency, ctx.blockedMoveTarget);
|
|
39
|
-
if (task) return [taskMoveDecision(state, ctx, task)];
|
|
40
|
-
|
|
41
|
-
let room = this.patrol.nextRoom(ctx);
|
|
42
|
-
if (!room) {
|
|
43
|
-
setStrategyIntent(ctx, {
|
|
44
|
-
activity: 'waiting',
|
|
45
|
-
summary: `当前没有可执行任务或可巡逻房间,正在${state.you.room || '当前位置'}等待。`,
|
|
46
|
-
...(state.you.room ? { room: state.you.room } : {}),
|
|
47
|
-
});
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
if (dist(state.you.x, state.you.y, room.x, room.y) <= PATROL_REACHED_DISTANCE) {
|
|
51
|
-
this.patrol.advance(ctx);
|
|
52
|
-
const next = this.patrol.nextRoom(ctx);
|
|
53
|
-
if (next) room = next;
|
|
54
|
-
}
|
|
55
|
-
const intent = patrolStrategyIntent(room);
|
|
56
|
-
setStrategyIntent(ctx, intent);
|
|
57
|
-
return [strategyDecision(Action.move({ x: room.x, y: room.y }), intent)];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { GameState } from '../../sdk/types.js';
|
|
2
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
3
|
-
import { firstAvailableTask, reportCorpseDecision, PROGRESS_INTERVAL_MS } from '../game-utils.js';
|
|
4
|
-
import { GreetingTracker } from '../greeting.js';
|
|
5
|
-
import { Goal } from './goal.js';
|
|
6
|
-
import { TaskOrPatrolGoal } from './task-or-patrol-goal.js';
|
|
7
|
-
|
|
8
|
-
export class TaskReportTop extends Goal {
|
|
9
|
-
private readonly taskGoal = new TaskOrPatrolGoal();
|
|
10
|
-
private readonly greeting: GreetingTracker;
|
|
11
|
-
|
|
12
|
-
constructor(greetingPhrases: string[]) {
|
|
13
|
-
super();
|
|
14
|
-
this.greeting = new GreetingTracker(greetingPhrases);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
18
|
-
const decisions: BehaviorDecision[] = [];
|
|
19
|
-
|
|
20
|
-
const greetingDecision = this.greeting.tryGreeting(state);
|
|
21
|
-
if (greetingDecision) decisions.push(greetingDecision);
|
|
22
|
-
|
|
23
|
-
const reportDecision = reportCorpseDecision(state, ctx, { respectBlock: true });
|
|
24
|
-
if (reportDecision) {
|
|
25
|
-
decisions.unshift(reportDecision);
|
|
26
|
-
return decisions;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
decisions.push(...this.taskGoal.tick(state, ctx));
|
|
30
|
-
|
|
31
|
-
this.emitProgress(state, ctx);
|
|
32
|
-
return decisions;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private emitProgress(state: GameState, ctx: StrategyContext): void {
|
|
36
|
-
const now = Date.now();
|
|
37
|
-
if (now - ctx.lastProgressNotifyAt < PROGRESS_INTERVAL_MS) return;
|
|
38
|
-
ctx.lastProgressNotifyAt = now;
|
|
39
|
-
|
|
40
|
-
const completed = ctx.taskData.filter(t => t.status === 'completed').length;
|
|
41
|
-
const total = ctx.taskData.filter(t => t.faction !== 'crab').length;
|
|
42
|
-
const current = firstAvailableTask(ctx.taskData, t => t.faction !== 'crab', ctx.emergency, ctx.blockedMoveTarget);
|
|
43
|
-
const room = state.you.room ?? '未知';
|
|
44
|
-
|
|
45
|
-
let msg = `[进度] 当前在${room}`;
|
|
46
|
-
if (current) {
|
|
47
|
-
msg += `,正在前往${current.room}做任务「${current.task_name}」`;
|
|
48
|
-
}
|
|
49
|
-
msg += `。已完成 ${completed}/${total} 个任务。`;
|
|
50
|
-
|
|
51
|
-
if (state.emergency) {
|
|
52
|
-
msg += ` 紧急任务进行中!`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ctx.notifications.push(msg);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { GameState, TaskInfo } from '../../sdk/types.js';
|
|
2
|
-
import { approachOrDoTaskStep, patrolStep, PatrolState } from '../game-utils.js';
|
|
3
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
4
|
-
import { Goal } from './goal.js';
|
|
5
|
-
|
|
6
|
-
export type TaskPicker = (state: GameState, ctx: StrategyContext) => TaskInfo | null;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 任务伪装 + 巡逻子目标(叶子,由上层以 WANDER 优先级挂载):先按 pickTask 取一个任务靠近 / 提交,
|
|
10
|
-
* 没有可做任务、或到点暂不可提交,就按房间巡逻,绝不停在原地。供 lone-kill-task / crab-sabotage 复用,
|
|
11
|
-
* pickTask 决定做哪类任务,stopOnPlayer 通常接 LoneKillCore.patrolStopOnPlayer(),patrol 由上层注入以共享巡逻进度。
|
|
12
|
-
*/
|
|
13
|
-
export class WanderTaskGoal extends Goal {
|
|
14
|
-
constructor(
|
|
15
|
-
private readonly pickTask: TaskPicker,
|
|
16
|
-
private readonly stopOnPlayer: () => boolean,
|
|
17
|
-
private readonly patrol: PatrolState,
|
|
18
|
-
) {
|
|
19
|
-
super();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
23
|
-
if (state.you.doing_task) return [];
|
|
24
|
-
|
|
25
|
-
const task = this.pickTask(state, ctx);
|
|
26
|
-
if (task) {
|
|
27
|
-
const decision = approachOrDoTaskStep(state, ctx, task, this.stopOnPlayer());
|
|
28
|
-
if (decision) return decision;
|
|
29
|
-
// 到点却暂时无法提交 → 转巡逻,避免卡在任务点
|
|
30
|
-
}
|
|
31
|
-
return patrolStep(state, ctx, this.patrol, this.stopOnPlayer());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import type { GameState, PlayerInfo } from '../../sdk/types.js';
|
|
2
|
-
import { Action } from '../../sdk/action.js';
|
|
3
|
-
import {
|
|
4
|
-
canUseKill,
|
|
5
|
-
corpseAtScene,
|
|
6
|
-
dist,
|
|
7
|
-
firstAvailableTask,
|
|
8
|
-
hasKnownCorpse,
|
|
9
|
-
killCooldownSecs,
|
|
10
|
-
killCommitRange,
|
|
11
|
-
matchesAnyTarget,
|
|
12
|
-
nonTeammatesVisible,
|
|
13
|
-
PROGRESS_INTERVAL_MS,
|
|
14
|
-
reportCorpseDecision,
|
|
15
|
-
SHRIMP_VISION_RANGE,
|
|
16
|
-
SHRIMP_VISION_RELEASE_RANGE,
|
|
17
|
-
taskMoveDecision,
|
|
18
|
-
playerStrategyIntent,
|
|
19
|
-
strategyDecision,
|
|
20
|
-
} from '../game-utils.js';
|
|
21
|
-
import type { BehaviorDecision, StrategyContext } from '../types.js';
|
|
22
|
-
import { Goal } from './goal.js';
|
|
23
|
-
import { KeepAwayGoal, type KeepAwayGoalOptions } from './keep-away-goal.js';
|
|
24
|
-
import { KillVisibleTargetGoal } from './kill-target-goal.js';
|
|
25
|
-
import { SafeTaskOrPatrolGoal } from './safe-task-goal.js';
|
|
26
|
-
|
|
27
|
-
const SUB_PRIORITY = 0.5;
|
|
28
|
-
const STRANGER_TRIGGER_RADIUS = SHRIMP_VISION_RANGE;
|
|
29
|
-
const STRANGER_RELEASE_RADIUS = SHRIMP_VISION_RELEASE_RANGE;
|
|
30
|
-
const WITNESS_MEMORY_MS = 0;
|
|
31
|
-
const WITNESS_EXEMPT_COUNT = 2;
|
|
32
|
-
const TASK_RETURN_INERTIA_MS = 2_000;
|
|
33
|
-
const FLEE_KEY = 'warrior-flee';
|
|
34
|
-
const STRANGER_KEY = 'warrior-stranger-distance';
|
|
35
|
-
// 尸体现场灭口开关:false=站在尸体旁也绝不因「身边有未报警的身份不明者」先手灭口,只报警(hostile/启动目标仍按 P1 追杀);
|
|
36
|
-
// true=刀可用时先击杀尸体旁最近的非 trusted 非队友。关掉是为根治「把尸体边未报警的无辜虾当凶手灭口」的误杀。
|
|
37
|
-
const CORPSE_SCENE_KILL_ENABLED: boolean = false;
|
|
38
|
-
|
|
39
|
-
type ProgressTier = 'flee-bad' | 'keep-distance' | 'task';
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 带刀虾·记忆进阶版(武士虾/枪虾,带刀好人)。好人阵营但能出刀,按行为表的优先级逐条判断:
|
|
43
|
-
*
|
|
44
|
-
* - P0 发现尸体:旁边是 hostile/启动猎杀目标且刀可用 → 现场先手击杀;未报警的身份不明者默认不灭口
|
|
45
|
-
* (CORPSE_SCENE_KILL_ENABLED,根治误杀);否则报警(靠近至可报距离)。
|
|
46
|
-
* - P1 处理危险:**只对 huntTargets 出刀**——刀好就追杀,刀冷就硬躲所有非 trustedTargets 玩家。
|
|
47
|
-
* 其余非 trustedTargets 一律按「被怀疑」处理:**只回避、绝不出刀**——无可信同伴且单个被怀疑者
|
|
48
|
-
* 贴近 → 按普通虾 B 档先拉开距离(多人互为目击者则照常做任务)。
|
|
49
|
-
* (历史上的「贴身追击判定 + 诱饵试探 + 绝境自卫反杀」整套已删除:几何上无法把「贴身跟我观察的好人」和「贴身追我的
|
|
50
|
-
* 凶手」区分开,自卫出刀迟早误杀同阵营好人、触发 warrior_shrimp_self_destruct 直接崩盘,代价远大于收益。)
|
|
51
|
-
* - P2 紧急任务:无危险时优先处理。
|
|
52
|
-
* - P3 兜底:做任务 / 巡逻
|
|
53
|
-
* (SafeTaskOrPatrolGoal:测地最近、威胁旁/途经威胁的任务硬排除、带粘性)。
|
|
54
|
-
*
|
|
55
|
-
* 谁算「猎杀目标」「可信同伴」来自策略参数,其他人默认被怀疑;队友由游戏事实判定。
|
|
56
|
-
*/
|
|
57
|
-
export class WarriorShrimpTop extends Goal {
|
|
58
|
-
private readonly taskGoal = new SafeTaskOrPatrolGoal(
|
|
59
|
-
// 威胁点 = 坏人(始终算),或未被目击者豁免的被怀疑者;可信同伴不算。
|
|
60
|
-
(s, c) => nonTeammatesVisible(s, c)
|
|
61
|
-
.filter(p => !this.isTrusted(p, c))
|
|
62
|
-
.filter(p => this.isHuntTarget(p, c) || !this.witnessExempt)
|
|
63
|
-
.map(p => ({ x: p.x, y: p.y })),
|
|
64
|
-
);
|
|
65
|
-
private readonly strangerSeenAt = new Map<string, number>();
|
|
66
|
-
private witnessExempt = false;
|
|
67
|
-
|
|
68
|
-
constructor(
|
|
69
|
-
private readonly huntTargets: number[] = [],
|
|
70
|
-
private readonly trustedTargets: number[] = [],
|
|
71
|
-
) {
|
|
72
|
-
super();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
tick(state: GameState, ctx: StrategyContext): BehaviorDecision[] {
|
|
76
|
-
const visible = nonTeammatesVisible(state, ctx);
|
|
77
|
-
this.updateWitnessMemory(visible, ctx);
|
|
78
|
-
const killReady = canUseKill(state);
|
|
79
|
-
|
|
80
|
-
// ── P0 发现尸体 ──
|
|
81
|
-
// 只在「此刻就在命案现场」(当帧视野有尸体)时考虑现场出刀——记忆里某处有尸体不算现场。
|
|
82
|
-
if (corpseAtScene(state) && killReady) {
|
|
83
|
-
// 尸体旁的【已确认敌对 / 启动猎杀目标】始终先手击杀,不受灭口开关影响、且排在报尸之前——凶手就在身边时照杀。
|
|
84
|
-
// 仅「未报警的身份不明者」(非 trusted、非 hostile)才受 CORPSE_SCENE_KILL_ENABLED 控制:默认关,
|
|
85
|
-
// 根治「把尸体边未报警的无辜虾当凶手灭口」的误杀。
|
|
86
|
-
const victim = this.nearestKillable(state, ctx, visible, true)
|
|
87
|
-
?? (CORPSE_SCENE_KILL_ENABLED ? this.nearestKillable(state, ctx, visible, false) : null);
|
|
88
|
-
if (victim) {
|
|
89
|
-
this.clearSub();
|
|
90
|
-
if (victim.seat == null || victim.seat <= 0) return [];
|
|
91
|
-
return [strategyDecision(Action.kill(victim.seat), playerStrategyIntent(victim, '追杀', 'acting'))];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// 权威状态已确认任务正在执行时,除明确 hunt target 外不再发任何动作:避免重复提交任务,也避免
|
|
96
|
-
// 报尸、被怀疑者回避、普通任务或巡逻的 move 打断任务。明确 hostile 仍保持最高优先级,可追杀或逃离。
|
|
97
|
-
if (state.you.doing_task) {
|
|
98
|
-
const huntTargets = visible.filter(p => !this.isTrusted(p, ctx) && this.isHuntTarget(p, ctx));
|
|
99
|
-
if (huntTargets.length > 0) {
|
|
100
|
-
if (killReady) {
|
|
101
|
-
this.setHunt(this.nearestByDistance(state, huntTargets));
|
|
102
|
-
} else {
|
|
103
|
-
this.taskGoal.planTask(state, ctx, { holdUnsafeCurrentForMs: TASK_RETURN_INERTIA_MS });
|
|
104
|
-
this.setFlee();
|
|
105
|
-
this.emitProgress(state, ctx, visible, 'flee-bad');
|
|
106
|
-
}
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
this.clearSub();
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// 报尸 / 前往报尸:可以追着记忆里看见过、已离开视野的尸体走回去报告。
|
|
114
|
-
if (hasKnownCorpse(ctx)) {
|
|
115
|
-
const report = reportCorpseDecision(state, ctx, { respectBlock: true });
|
|
116
|
-
if (report) {
|
|
117
|
-
this.clearSub();
|
|
118
|
-
return [report];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// ── P1 处理危险:非 trusted 即潜在威胁(坏人 + 被怀疑) ──
|
|
123
|
-
const threats = visible.filter(p => !this.isTrusted(p, ctx));
|
|
124
|
-
if (threats.length > 0) {
|
|
125
|
-
const huntTargets = threats.filter(p => this.isHuntTarget(p, ctx));
|
|
126
|
-
// P1-A 坏人/启动目标且刀好 → 主动追杀。
|
|
127
|
-
if (killReady && huntTargets.length > 0) {
|
|
128
|
-
this.setHunt(this.nearestByDistance(state, huntTargets));
|
|
129
|
-
return [];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// P1-B 有坏人/启动目标但刀冷(杀不了)→ 硬躲所有非好人。
|
|
133
|
-
if (huntTargets.length > 0) {
|
|
134
|
-
this.taskGoal.planTask(state, ctx, { holdUnsafeCurrentForMs: TASK_RETURN_INERTIA_MS });
|
|
135
|
-
this.setFlee();
|
|
136
|
-
this.emitProgress(state, ctx, visible, 'flee-bad');
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// P1-C 只剩被怀疑者(无已确认坏人):无可信同伴且单个贴近、且未被目击者豁免 → 按普通虾 B 档拉开距离(只回避,绝不出刀);
|
|
141
|
-
// 多个被怀疑者互为目击者(witnessExempt)则不后撤,落到下面照常做任务。
|
|
142
|
-
const trustedVisible = visible.some(p => this.isTrusted(p, ctx));
|
|
143
|
-
const worker = this.subGoal;
|
|
144
|
-
const suspectedClose = threats.some(p =>
|
|
145
|
-
(p.distance ?? dist(p.x, p.y, state.you.x, state.you.y)) <= STRANGER_TRIGGER_RADIUS);
|
|
146
|
-
const stillBackingOff = worker instanceof KeepAwayGoal && worker.key === STRANGER_KEY && !worker.isFinish(state, ctx);
|
|
147
|
-
if (!trustedVisible && !this.witnessExempt && (suspectedClose || stillBackingOff)) {
|
|
148
|
-
this.taskGoal.planTask(state, ctx, { holdUnsafeCurrentForMs: TASK_RETURN_INERTIA_MS });
|
|
149
|
-
this.setStrangerKeepAway();
|
|
150
|
-
this.emitProgress(state, ctx, visible, 'keep-distance');
|
|
151
|
-
return [];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// ── P2 紧急任务 ──
|
|
156
|
-
const emergency = firstAvailableTask([], t => t.faction !== 'crab', ctx.emergency, ctx.blockedMoveTarget);
|
|
157
|
-
if (emergency) {
|
|
158
|
-
this.clearSub();
|
|
159
|
-
return [taskMoveDecision(state, ctx, emergency)];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// ── P3 普通任务 / 巡逻 ──
|
|
163
|
-
this.clearSub();
|
|
164
|
-
this.emitProgress(state, ctx, visible, 'task');
|
|
165
|
-
return this.taskGoal.tick(state, ctx);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/** 目击者豁免:当前只按本轮可见玩家判断,见到 2 个以上被怀疑者时不对其后撤(多人互为目击者,蟹不敢当众动手)。 */
|
|
169
|
-
private updateWitnessMemory(visible: PlayerInfo[], ctx: StrategyContext): void {
|
|
170
|
-
const now = Date.now();
|
|
171
|
-
for (const p of visible) {
|
|
172
|
-
if (!this.isSuspected(p, ctx)) continue;
|
|
173
|
-
const key = p.name || String(p.seat ?? '');
|
|
174
|
-
if (key) this.strangerSeenAt.set(key, now);
|
|
175
|
-
}
|
|
176
|
-
for (const [key, at] of this.strangerSeenAt) {
|
|
177
|
-
if (now - at > WITNESS_MEMORY_MS) this.strangerSeenAt.delete(key);
|
|
178
|
-
}
|
|
179
|
-
this.witnessExempt = this.strangerSeenAt.size >= WITNESS_EXEMPT_COUNT;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/** 被怀疑者:非 trusted(好人)且非坏人/启动目标——未标记的默认就落这档,对应 B 档保持距离(只回避、绝不出刀)。 */
|
|
183
|
-
private isSuspected(p: PlayerInfo, ctx: StrategyContext): boolean {
|
|
184
|
-
return !this.isTrusted(p, ctx) && !this.isHuntTarget(p, ctx);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/** trustedTargets 中的玩家:可信同伴,永不击杀。 */
|
|
188
|
-
private isTrusted(p: PlayerInfo, ctx: StrategyContext): boolean {
|
|
189
|
-
return matchesAnyTarget(p, this.trustedTargets, ctx);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/** huntTargets 中且不在 trustedTargets 中的玩家;其余被怀疑者不在这里。 */
|
|
193
|
-
private isHuntTarget(p: PlayerInfo, ctx: StrategyContext): boolean {
|
|
194
|
-
return !this.isTrusted(p, ctx)
|
|
195
|
-
&& matchesAnyTarget(p, this.huntTargets, ctx);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/** 潜在威胁 = 任何非 trusted(坏人 + 被怀疑);刀冷遇坏人时硬躲这一整组。 */
|
|
199
|
-
private isThreat(p: PlayerInfo, ctx: StrategyContext): boolean {
|
|
200
|
-
return !this.isTrusted(p, ctx);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/** 尸体场景出刀目标 = 视野内最近、在出刀范围内的非 trusted 非队友。hostileOnly=true 只取已确认敌对/启动猎杀目标
|
|
204
|
-
* (hostile / hunt 参数),用于「尸体旁敌对照杀、不受灭口开关限制」;false 含未报警的身份不明者(受开关控制)。 */
|
|
205
|
-
private nearestKillable(
|
|
206
|
-
state: GameState,
|
|
207
|
-
ctx: StrategyContext,
|
|
208
|
-
visible: PlayerInfo[],
|
|
209
|
-
hostileOnly: boolean,
|
|
210
|
-
): PlayerInfo | null {
|
|
211
|
-
return visible
|
|
212
|
-
.filter(p => !this.isTrusted(p, ctx))
|
|
213
|
-
.filter(p => !hostileOnly || this.isHuntTarget(p, ctx))
|
|
214
|
-
.map(p => ({ p, d: p.distance ?? dist(state.you.x, state.you.y, p.x, p.y) }))
|
|
215
|
-
.filter(x => x.d <= killCommitRange(state.you.role))
|
|
216
|
-
.sort((a, b) => a.d - b.d)[0]?.p ?? null;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
private nearestByDistance(state: GameState, players: PlayerInfo[]): PlayerInfo {
|
|
220
|
-
return players
|
|
221
|
-
.map(p => ({ p, d: p.distance ?? dist(state.you.x, state.you.y, p.x, p.y) }))
|
|
222
|
-
.sort((a, b) => a.d - b.d)[0].p;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
private setHunt(target: PlayerInfo): void {
|
|
226
|
-
if (target.seat == null) {
|
|
227
|
-
this.clearSub();
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
const worker = this.subGoal;
|
|
231
|
-
if (worker instanceof KillVisibleTargetGoal && worker.targetSeat === target.seat) return;
|
|
232
|
-
if (this.subGoal) this.removeSubGoal();
|
|
233
|
-
this.setSubGoal(new KillVisibleTargetGoal(target.seat, this.trustedTargets, true), SUB_PRIORITY);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
private setFlee(): void {
|
|
237
|
-
const worker = this.subGoal;
|
|
238
|
-
if (worker instanceof KeepAwayGoal && worker.key === FLEE_KEY) return;
|
|
239
|
-
if (this.subGoal) this.removeSubGoal();
|
|
240
|
-
this.setSubGoal(new KeepAwayGoal(
|
|
241
|
-
FLEE_KEY,
|
|
242
|
-
(s, c) => nonTeammatesVisible(s, c).filter(p => this.isThreat(p, c)),
|
|
243
|
-
// 行为不变(仍躲所有非 trusted);措辞按真实身份逐个标注,免得把一起躲的被怀疑者也叫成「认定坏人」。
|
|
244
|
-
{ threatRadius: Infinity, noun: (p, c) => this.isHuntTarget(p, c) ? '认定坏人' : '被怀疑者' } satisfies KeepAwayGoalOptions,
|
|
245
|
-
), SUB_PRIORITY);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
private setStrangerKeepAway(): void {
|
|
249
|
-
const worker = this.subGoal;
|
|
250
|
-
if (worker instanceof KeepAwayGoal && worker.key === STRANGER_KEY) return;
|
|
251
|
-
if (this.subGoal) this.removeSubGoal();
|
|
252
|
-
this.setSubGoal(new KeepAwayGoal(
|
|
253
|
-
STRANGER_KEY,
|
|
254
|
-
(s, c) => nonTeammatesVisible(s, c).filter(p => this.isSuspected(p, c)),
|
|
255
|
-
{
|
|
256
|
-
threatRadius: STRANGER_RELEASE_RADIUS,
|
|
257
|
-
noun: '被怀疑者',
|
|
258
|
-
planOpts: { steps: 4 },
|
|
259
|
-
} satisfies KeepAwayGoalOptions,
|
|
260
|
-
), SUB_PRIORITY);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
private clearSub(): void {
|
|
264
|
-
if (this.subGoal) this.removeSubGoal();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private emitProgress(state: GameState, ctx: StrategyContext, visible: PlayerInfo[], tier: ProgressTier): void {
|
|
268
|
-
const now = Date.now();
|
|
269
|
-
if (now - ctx.lastProgressNotifyAt < PROGRESS_INTERVAL_MS) return;
|
|
270
|
-
ctx.lastProgressNotifyAt = now;
|
|
271
|
-
|
|
272
|
-
const room = state.you.room ?? '未知';
|
|
273
|
-
const cd = killCooldownSecs(state);
|
|
274
|
-
const killsRemaining = state.you.kills_remaining;
|
|
275
|
-
|
|
276
|
-
let msg = `[进度] 当前在${room}`;
|
|
277
|
-
if (visible.length === 0) {
|
|
278
|
-
msg += ',附近无人,做任务/巡逻。';
|
|
279
|
-
} else if (tier === 'keep-distance') {
|
|
280
|
-
msg += ',被怀疑者靠得太近,先拉开距离再做任务。';
|
|
281
|
-
} else {
|
|
282
|
-
const bad = visible.filter(p => this.isHuntTarget(p, ctx)).map(p => p.name);
|
|
283
|
-
if (bad.length > 0) msg += `,发现坏人${bad.join('、')}`;
|
|
284
|
-
else if (this.witnessExempt) msg += `,附近有${visible.length}个被怀疑者互为目击者,正常做任务`;
|
|
285
|
-
else msg += `,附近有${visible.length}人,正常做任务`;
|
|
286
|
-
if (tier === 'flee-bad') msg += killCooldownSecs(state) > 0 ? ',刀在冷却,正在回避' : ',正在处理';
|
|
287
|
-
if (cd > 0) msg += `(攻击冷却${cd}s)`;
|
|
288
|
-
if (killsRemaining === 0) msg += '(出刀次数已用完)';
|
|
289
|
-
msg += '。';
|
|
290
|
-
}
|
|
291
|
-
ctx.notifications.push(msg);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Action } from '../sdk/action.js';
|
|
2
|
-
import type { GameState } from '../sdk/types.js';
|
|
3
|
-
import type { BehaviorDecision } from './types.js';
|
|
4
|
-
import { stripRoleIds } from './player-targets.js';
|
|
5
|
-
|
|
6
|
-
export const MAX_GREETING_PHRASES = 3;
|
|
7
|
-
export const GREETING_TEXT_MAX_LENGTH = 100;
|
|
8
|
-
export const GREETING_COOLDOWN_MS = 120_000;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 解析「打招呼话术」启动参数:剥掉 role-id 噪声与空串,校验条数(≤3)与单条长度。
|
|
12
|
-
* 供 task-report / corpse-patrol / shrimp-memory / paradise-fish 共用——它们的启动参数语义都是「打招呼话术」。
|
|
13
|
-
*
|
|
14
|
-
* @param strategyId 仅用于错误文案。
|
|
15
|
-
*/
|
|
16
|
-
export function parseGreetingArgs(args: string[] | undefined, strategyId: string): string[] {
|
|
17
|
-
if (!args || args.length === 0) return [];
|
|
18
|
-
|
|
19
|
-
const phrases = args.map(a => stripRoleIds(a)).filter(a => a.length > 0);
|
|
20
|
-
if (phrases.length === 0) return [];
|
|
21
|
-
|
|
22
|
-
if (phrases.length > MAX_GREETING_PHRASES) {
|
|
23
|
-
throw new Error(`${strategyId}策略最多配置${MAX_GREETING_PHRASES}条打招呼话术,当前有${phrases.length}条。`);
|
|
24
|
-
}
|
|
25
|
-
for (const phrase of phrases) {
|
|
26
|
-
if (phrase.length > GREETING_TEXT_MAX_LENGTH) {
|
|
27
|
-
throw new Error(`打招呼话术过长:当前${phrase.length}个字符,最多${GREETING_TEXT_MAX_LENGTH}个字符。`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return phrases;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 打招呼节流器:视野内有人时随机发一条话术,之后 GREETING_COOLDOWN_MS 内不再发。
|
|
35
|
-
* 被多个编排型 Top Goal(TaskReportTop / NormalShrimpTop 等)持有复用。
|
|
36
|
-
*/
|
|
37
|
-
export class GreetingTracker {
|
|
38
|
-
private lastGreetingAt: number | null = null;
|
|
39
|
-
|
|
40
|
-
constructor(private readonly phrases: string[]) {}
|
|
41
|
-
|
|
42
|
-
tryGreeting(state: GameState): BehaviorDecision | null {
|
|
43
|
-
if (this.phrases.length === 0) return null;
|
|
44
|
-
if (state.players.length === 0) return null;
|
|
45
|
-
|
|
46
|
-
const now = Date.now();
|
|
47
|
-
if (this.lastGreetingAt !== null && now - this.lastGreetingAt < GREETING_COOLDOWN_MS) return null;
|
|
48
|
-
|
|
49
|
-
const text = this.phrases[Math.floor(Math.random() * this.phrases.length)];
|
|
50
|
-
this.lastGreetingAt = now;
|
|
51
|
-
return {
|
|
52
|
-
action: Action.speech(text),
|
|
53
|
-
intent: {
|
|
54
|
-
activity: 'acting',
|
|
55
|
-
summary: `正在${state.you.room || '当前位置'}向附近玩家打招呼。`,
|
|
56
|
-
...(state.you.room ? { room: state.you.room } : {}),
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
package/src/strategies/hide.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type BehaviorDecision,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorReadApi,
|
|
5
|
-
ClawclawBehavior,
|
|
6
|
-
} from '../sdk/behavior-plugin/index.js';
|
|
7
|
-
import {
|
|
8
|
-
OfficialGoalBehavior,
|
|
9
|
-
clawclawStrategyString,
|
|
10
|
-
} from '../runtime/clawclaw/plugins/behavior/official-goal-behavior.js';
|
|
11
|
-
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
12
|
-
import { HideTop } from './goals/hide-top.js';
|
|
13
|
-
|
|
14
|
-
function controlledKillWhenCornered(parameters: Readonly<Record<string, unknown>>): boolean | null {
|
|
15
|
-
const value = clawclawStrategyString(parameters, 'killWhenCornered');
|
|
16
|
-
if (value === 'on') return true;
|
|
17
|
-
if (value === 'off') return false;
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class HideStrategy extends ClawclawBehavior {
|
|
22
|
-
static readonly manifest = {
|
|
23
|
-
apiVersion: 3,
|
|
24
|
-
id: 'hide',
|
|
25
|
-
name: '躲藏',
|
|
26
|
-
description: '躲藏策略:在离线从地图算好的若干「非走廊、≥2 出口可逃、远离任务点/出生点」的藏身角落里潜伏;视野里出现非队友就保持距离甩开并重算藏点。killWhenCornered 控制被单个对手逼进出刀距离且无路可逃时是否出刀自保;auto 按角色决定。',
|
|
27
|
-
execution: 'serial',
|
|
28
|
-
produces: ['strategy_alert', 'robot_speak_rule'],
|
|
29
|
-
inputs: [{
|
|
30
|
-
id: 'killWhenCornered',
|
|
31
|
-
type: 'enum',
|
|
32
|
-
description: '被单个对手逼入死角时是否出刀自保;auto 按角色决定。',
|
|
33
|
-
values: ['auto', 'on', 'off'],
|
|
34
|
-
default: 'auto',
|
|
35
|
-
}],
|
|
36
|
-
} as const;
|
|
37
|
-
|
|
38
|
-
private readonly goal = new OfficialGoalBehavior({
|
|
39
|
-
id: 'hide',
|
|
40
|
-
routeEvidenceTargets: ['hide'],
|
|
41
|
-
create: (values) => new GoalRootStrategy(
|
|
42
|
-
'hide',
|
|
43
|
-
() => new HideTop(controlledKillWhenCornered(values)),
|
|
44
|
-
{ resetOnMeetingResume: false },
|
|
45
|
-
),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
override decide(input: BehaviorInput, api: BehaviorReadApi): Promise<BehaviorDecision> {
|
|
49
|
-
return this.goal.decide(input, api);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type BehaviorDecision,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorReadApi,
|
|
5
|
-
ClawclawBehavior,
|
|
6
|
-
} from '../sdk/behavior-plugin/index.js';
|
|
7
|
-
import { OfficialGoalBehavior } from '../runtime/clawclaw/plugins/behavior/official-goal-behavior.js';
|
|
8
|
-
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
9
|
-
import { KillFrenzyTop } from './goals/kill-frenzy-top.js';
|
|
10
|
-
|
|
11
|
-
export default class KillFrenzyStrategy extends ClawclawBehavior {
|
|
12
|
-
static readonly manifest = {
|
|
13
|
-
apiVersion: 3,
|
|
14
|
-
id: 'kill-frenzy',
|
|
15
|
-
name: '屠夫',
|
|
16
|
-
description: '疯狂砍人:见谁杀谁(除队友外所有可见玩家),多人在场也照杀。按房间顺序巡逻,视野里只要有非队友就冲向最近的那个,50内且冷却好就出刀,冷却中保持10距离贴身跟随等冷却。与 kill-lone 不同,不会因为周围人多而暂停攻击。永不停手。',
|
|
17
|
-
execution: 'serial',
|
|
18
|
-
produces: ['strategy_alert', 'robot_speak_rule'],
|
|
19
|
-
inputs: [],
|
|
20
|
-
} as const;
|
|
21
|
-
|
|
22
|
-
private readonly goal = new OfficialGoalBehavior({
|
|
23
|
-
id: 'kill-frenzy',
|
|
24
|
-
create: () => new GoalRootStrategy('kill-frenzy', () => new KillFrenzyTop(), {
|
|
25
|
-
resetOnMeetingResume: false,
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
override decide(input: BehaviorInput, api: BehaviorReadApi): Promise<BehaviorDecision> {
|
|
30
|
-
return this.goal.decide(input, api);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type BehaviorDecision,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorReadApi,
|
|
5
|
-
ClawclawBehavior,
|
|
6
|
-
} from '../sdk/behavior-plugin/index.js';
|
|
7
|
-
import {
|
|
8
|
-
OfficialGoalBehavior,
|
|
9
|
-
} from '../runtime/clawclaw/plugins/behavior/official-goal-behavior.js';
|
|
10
|
-
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
11
|
-
import { KillLoneTop } from './goals/kill-lone-top.js';
|
|
12
|
-
import { strategySeatList } from './player-targets.js';
|
|
13
|
-
|
|
14
|
-
export default class KillLoneStrategy extends ClawclawBehavior {
|
|
15
|
-
static readonly manifest = {
|
|
16
|
-
apiVersion: 3,
|
|
17
|
-
id: 'kill-lone',
|
|
18
|
-
name: '猎独',
|
|
19
|
-
description: '按照房间顺序巡逻。视野里只有一个非队友且不在 protectedTargets 内就靠近,进入50距离出刀;冷却中贴近等待。视野里出现两人以上时暂停普通攻击,但 huntTargets 中的玩家仍会被主动追杀;与 protectedTargets 重叠时保护优先。',
|
|
20
|
-
execution: 'serial',
|
|
21
|
-
produces: ['strategy_alert', 'robot_speak_rule'],
|
|
22
|
-
inputs: [
|
|
23
|
-
{
|
|
24
|
-
id: 'protectedTargets',
|
|
25
|
-
type: 'player_seats',
|
|
26
|
-
description: '禁止击杀的玩家座位号列表;与 huntTargets 重叠时保护优先。',
|
|
27
|
-
default: [],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'huntTargets',
|
|
31
|
-
type: 'player_seats',
|
|
32
|
-
description: '主动猎杀的玩家座位号列表;看见后可越过落单人数限制追杀。',
|
|
33
|
-
default: [],
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
} as const;
|
|
37
|
-
|
|
38
|
-
private readonly goal = new OfficialGoalBehavior({
|
|
39
|
-
id: 'kill-lone',
|
|
40
|
-
create: (values) => {
|
|
41
|
-
const protectedTargets = strategySeatList(values, 'protectedTargets');
|
|
42
|
-
const huntTargets = strategySeatList(values, 'huntTargets');
|
|
43
|
-
return new GoalRootStrategy('kill-lone', () => new KillLoneTop(protectedTargets, huntTargets), {
|
|
44
|
-
resetOnMeetingResume: false,
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
override decide(input: BehaviorInput, api: BehaviorReadApi): Promise<BehaviorDecision> {
|
|
50
|
-
return this.goal.decide(input, api);
|
|
51
|
-
}
|
|
52
|
-
}
|