@myclaw163/clawclaw-cli 0.6.95 → 0.6.100
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/package.json +1 -1
- package/skills/clawclaw/SKILL.md +26 -10
- package/skills/clawclaw/references/CLAUDE-CODE-MONITOR.md +1 -1
- package/skills/clawclaw/references/COMMANDS.md +17 -5
- package/skills/clawclaw/references/STREAM.md +15 -12
- package/src/commands/account.test.ts +20 -0
- package/src/commands/account.ts +16 -0
- package/src/commands/do.test.ts +27 -1
- package/src/commands/do.ts +61 -0
- package/src/commands/events.test.ts +21 -3
- package/src/commands/events.ts +8 -2
- package/src/commands/game-start-plan.test.ts +158 -0
- package/src/commands/game.ts +670 -64
- package/src/commands/history-player.test.ts +3 -0
- package/src/commands/knowledge.ts +41 -4
- package/src/commands/strategy.ts +11 -0
- package/src/commands/watch.test.ts +272 -0
- package/src/commands/watch.ts +185 -25
- package/src/lib/game-client.ts +34 -0
- package/src/lib/room.test.ts +74 -0
- package/src/lib/room.ts +129 -0
- package/src/lib/server-registry.test.ts +54 -0
- package/src/lib/server-registry.ts +35 -2
- package/src/perception/player-history-store.test.ts +92 -2
- package/src/perception/player-history-store.ts +68 -0
- package/src/pipeline/event-format.test.ts +61 -1
- package/src/pipeline/event-format.ts +88 -0
- package/src/pipeline/event-hints.ts +10 -1
- package/src/runtime/event-daemon.test.ts +43 -0
- package/src/runtime/event-daemon.ts +8 -4
- package/src/runtime/room-lobby-runtime.test.ts +95 -0
- package/src/runtime/room-lobby-runtime.ts +367 -0
- package/src/sdk/index.ts +8 -3
- package/src/strategies/avoid-lone.ts +2 -0
- package/src/strategies/avoid-players.ts +2 -0
- package/src/strategies/corpse-patrol.ts +2 -0
- package/src/strategies/crab-sabotage.ts +2 -0
- package/src/strategies/find-player.ts +2 -0
- package/src/strategies/hide.ts +2 -0
- package/src/strategies/kill-frenzy.ts +2 -0
- package/src/strategies/kill-lone.ts +2 -0
- package/src/strategies/kill-target.ts +2 -0
- package/src/strategies/knowledge-contract.ts +85 -0
- package/src/strategies/lone-kill-task.ts +2 -0
- package/src/strategies/move-room.ts +2 -0
- package/src/strategies/paradise-fish.ts +2 -0
- package/src/strategies/patrol.ts +2 -0
- package/src/strategies/report-patrol.ts +2 -0
- package/src/strategies/shrimp-memory.ts +2 -0
- package/src/strategies/social-task.ts +2 -0
- package/src/strategies/task-kill-report.ts +2 -0
- package/src/strategies/task-only.ts +2 -0
- package/src/strategies/task-report.ts +2 -0
- package/src/strategies/types.ts +37 -1
- package/src/strategies/warrior-memory.ts +2 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 官方策略共享的「知识契约」helper。
|
|
3
|
+
*
|
|
4
|
+
* 每个策略通过在其 `StrategyEntry` 里 spread 本模块返回的对象,声明自己能读取
|
|
5
|
+
* 哪些 `ccl knowledge` 写入的知识:
|
|
6
|
+
* - `noKnowledgeContract` —— 无记忆策略(不读 `ctx.knowledge`):拒绝一切写入、
|
|
7
|
+
* 切换到它时把现有知识全部标为失效。
|
|
8
|
+
* - `playerMarkContract` —— 只读玩家两档标记(hostile/trusted)的记忆策略;
|
|
9
|
+
* `extraTags` 声明额外认可的自定义玩家标签。
|
|
10
|
+
*
|
|
11
|
+
* 自定义策略无需引用本模块:不实现 `validateKnowledge`/`reviewKnowledge` 即默认放行。
|
|
12
|
+
*/
|
|
13
|
+
import type { StrategyEntry, KnowledgeValidation, KnowledgeReview } from './types.js';
|
|
14
|
+
import type { KnowledgeSetInput, KnowledgeView, SubjectEntry, SubjectRef } from '../lib/knowledge-store.js';
|
|
15
|
+
|
|
16
|
+
/** `StrategyEntry` 上与知识契约相关的两个可选方法。 */
|
|
17
|
+
export type KnowledgeContract = Pick<StrategyEntry, 'validateKnowledge' | 'reviewKnowledge'>;
|
|
18
|
+
|
|
19
|
+
const PLAYER_MARKS = ['hostile', 'trusted'] as const;
|
|
20
|
+
|
|
21
|
+
const refOf = (s: SubjectEntry): SubjectRef => ({ type: s.type, selector: s.selector });
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 无记忆策略的契约:不读取任何知识库,写入一律警告、切换时提示全部失效。
|
|
25
|
+
*/
|
|
26
|
+
export function noKnowledgeContract(displayName: string): KnowledgeContract {
|
|
27
|
+
return {
|
|
28
|
+
validateKnowledge(): KnowledgeValidation {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
message: `「${displayName}」不读取任何知识库标记,此条写入不会影响它的行为;若要让标记生效,请切换到带记忆的策略(如 shrimp-memory / warrior-memory)。`,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
reviewKnowledge(view: KnowledgeView): KnowledgeReview {
|
|
35
|
+
const subjects = view.query({});
|
|
36
|
+
if (subjects.length === 0) return {};
|
|
37
|
+
return {
|
|
38
|
+
stale: subjects.map(refOf),
|
|
39
|
+
notes: [`「${displayName}」不使用知识库,现有 ${subjects.length} 条标记在本策略下都不会生效。`],
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 只读玩家两档标记(hostile/trusted)的记忆策略契约。
|
|
47
|
+
* - `opts.extraTags`:额外认可的自定义玩家标签(如 shrimp-memory 认的 `paradise_fish`)。
|
|
48
|
+
* - `role` 作为纯身份事实一律放行(契约:role 不直接控制策略,仅供参考)。
|
|
49
|
+
*/
|
|
50
|
+
export function playerMarkContract(displayName: string, opts: { extraTags?: string[] } = {}): KnowledgeContract {
|
|
51
|
+
const allowedTags = new Set<string>([...PLAYER_MARKS, ...(opts.extraTags ?? [])]);
|
|
52
|
+
const allowedDesc = [...allowedTags].join(' / ');
|
|
53
|
+
|
|
54
|
+
// 一条 player subject 是否整体可用:type 为 player、所有标签合法、且无非 role 的 fact。
|
|
55
|
+
const subjectUsable = (s: SubjectEntry): boolean => {
|
|
56
|
+
if (s.type !== 'player') return false;
|
|
57
|
+
if (Object.keys(s.tags ?? {}).some(t => !allowedTags.has(t))) return false;
|
|
58
|
+
if (Object.keys(s.facts ?? {}).some(k => k !== 'role')) return false;
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
validateKnowledge(input: KnowledgeSetInput): KnowledgeValidation {
|
|
64
|
+
if (input.type !== 'player') {
|
|
65
|
+
return { ok: false, message: `「${displayName}」只读取玩家标记(type=player),type='${input.type}' 的知识不会被使用。` };
|
|
66
|
+
}
|
|
67
|
+
const badTag = (input.tags ?? []).find(t => !allowedTags.has(t));
|
|
68
|
+
if (badTag) {
|
|
69
|
+
return { ok: false, message: `「${displayName}」只认玩家标记 ${allowedDesc},标签 '${badTag}' 不会生效。` };
|
|
70
|
+
}
|
|
71
|
+
if (input.key != null && input.key !== 'role') {
|
|
72
|
+
return { ok: false, message: `「${displayName}」不读取玩家的 '${input.key}' 事实,只按 ${allowedDesc} 标记行动(role 仅作身份参考)。` };
|
|
73
|
+
}
|
|
74
|
+
return { ok: true };
|
|
75
|
+
},
|
|
76
|
+
reviewKnowledge(view: KnowledgeView): KnowledgeReview {
|
|
77
|
+
const stale = view.query({}).filter(s => !subjectUsable(s));
|
|
78
|
+
if (stale.length === 0) return {};
|
|
79
|
+
return {
|
|
80
|
+
stale: stale.map(refOf),
|
|
81
|
+
notes: [`「${displayName}」只读取玩家 ${allowedDesc} 标记,以下 ${stale.length} 条知识切换后不会生效。`],
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { LoneKillTaskTop } from './goals/lone-kill-task-top.js';
|
|
4
5
|
import { ConversationGoal } from './goals/conversation-goal.js';
|
|
@@ -7,6 +8,7 @@ import { SpeechModule, getSpeechConfigForRole } from './speech-module.js';
|
|
|
7
8
|
export const strategy: StrategyEntry = {
|
|
8
9
|
id: 'lone-kill-task',
|
|
9
10
|
name: '潜伏猎手',
|
|
11
|
+
...noKnowledgeContract('潜伏猎手'),
|
|
10
12
|
description: '视野里只有一个非队友且冷却可用就靠近,进入50距离就立刻出刀;刀在冷却时不追不等、改做低优先级任务伪装,冷却好且目标仍落单可见再出刀(贴脸且刀好仍会立刻出刀)。发现尸体且附近有非队友、但当前不能原地出刀时,会靠近并报告尸体。视野里出现两人以上时,暂停攻击10秒并做任意阵营的真实任务伪装;选任务时会跳过紧挨已知尸体(含看见过、已离开视野的)的任务,不在命案现场做任务。没有可做任务时按房间巡逻,绝不停在原地。残局(已知存活≤6)出现紧急维修任务时,会高优先级抢着去做(仍低于击杀落单),阻止蟹靠破坏倒计时取胜。(章鱼默认)',
|
|
11
13
|
create(args?: string[]) {
|
|
12
14
|
const role = args?.[0] ?? 'neutral_octopus';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { MoveRoomGoal } from './goals/move-room-goal.js';
|
|
4
5
|
|
|
5
6
|
export const strategy: StrategyEntry = {
|
|
6
7
|
id: 'move-room',
|
|
7
8
|
name: '前往',
|
|
9
|
+
...noKnowledgeContract('前往'),
|
|
8
10
|
description: '前往指定房间,到达后停下。参数为目标房间名(如 酒吧)。单纯走位,不做任务、不打人、不报告。',
|
|
9
11
|
create(args?: string[]) {
|
|
10
12
|
const targetRoom = args?.join(' ').trim() ?? '';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { playerMarkContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { ParadiseFishTop } from './goals/paradise-fish-top.js';
|
|
4
5
|
import { parseGreetingArgs } from './greeting.js';
|
|
@@ -14,6 +15,7 @@ class ParadiseFishStrategy extends GoalRootStrategy {
|
|
|
14
15
|
export const strategy: StrategyEntry = {
|
|
15
16
|
id: 'paradise-fish',
|
|
16
17
|
name: '天堂鱼',
|
|
18
|
+
...playerMarkContract('天堂鱼'),
|
|
17
19
|
description:
|
|
18
20
|
'天堂鱼·进阶版(中立,不报警、不做任务,靠第二轮及以后被投票出局取胜;corpse-patrol 的带记忆升级)。读取 ccl knowledge 两档标记(hostile=坏人 / trusted=好人),未标记的一律默认被怀疑:hostile 视为危险硬寻路远离,被怀疑者按目击者规则保持距离,trusted 视为可抱团的可信同伴。发现尸体绝不报警,贴着尸体游走制造嫌疑;附近有人时远离那人但仍在尸体附近活动。残局(已知存活≤6)出现紧急维修任务时,会在没有带刀坏人需要躲避时优先抢着去做(先于对陌生人保持距离/贴尸/抱团),阻止蟹靠破坏倒计时取胜。传入打招呼话术时,视野内出现人就随机发送一条,之后120秒内不再发言。',
|
|
19
21
|
create(args?: string[]) {
|
package/src/strategies/patrol.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { PatrolTop } from './goals/patrol-top.js';
|
|
4
5
|
|
|
5
6
|
export const strategy: StrategyEntry = {
|
|
6
7
|
id: 'patrol',
|
|
7
8
|
name: '巡逻',
|
|
9
|
+
...noKnowledgeContract('巡逻'),
|
|
8
10
|
description: '按地图房间顺序依次游走,到达一个房间后自动前往下一个,循环往复。卡路时会跳过当前目标换下一个房间。纯游走,不做任务、不打人、不报告尸体。',
|
|
9
11
|
create() {
|
|
10
12
|
return new GoalRootStrategy('patrol', () => new PatrolTop(), { resetOnMeetingResume: false });
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { ReportPatrolTop } from './goals/report-patrol-top.js';
|
|
4
5
|
|
|
5
6
|
export const strategy: StrategyEntry = {
|
|
6
7
|
id: 'report-patrol',
|
|
7
8
|
name: '报警',
|
|
9
|
+
...noKnowledgeContract('报警'),
|
|
8
10
|
description: '专门找尸体:达到报告距离立刻报告,看到尸体就靠近;没有尸体就巡逻各房间。不做任何任务,不打人,目标是让会议尽快开起来。',
|
|
9
11
|
create() {
|
|
10
12
|
return new GoalRootStrategy('report-patrol', () => new ReportPatrolTop(), { resetOnMeetingResume: false });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { playerMarkContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { NormalShrimpTop } from './goals/normal-shrimp-top.js';
|
|
4
5
|
import { parseGreetingArgs } from './greeting.js';
|
|
@@ -14,6 +15,7 @@ class ShrimpMemoryStrategy extends GoalRootStrategy {
|
|
|
14
15
|
export const strategy: StrategyEntry = {
|
|
15
16
|
id: 'shrimp-memory',
|
|
16
17
|
name: '精英虾',
|
|
18
|
+
...playerMarkContract('精英虾', { extraTags: ['paradise_fish'] }),
|
|
17
19
|
description:
|
|
18
20
|
'普通虾·记忆进阶版(好人、不带刀;task-report 的带记忆升级)。读取 ccl knowledge 两档标记(hostile=坏人 / trusted=好人),未标记的一律默认被怀疑:hostile 硬寻路远离,trusted 视为可信同伴,被怀疑者按目击者规则保持距离。发现尸体最优先报警,并提示复核尸体旁身份不明者;无可信同伴且单个被怀疑者贴近270内时先拉开距离到300再做任务;再处理紧急任务,最后做任务/巡逻(选测地最近、跳过威胁旁或必经威胁的任务)。永不出刀。传入打招呼话术时,视野内出现人就随机发送一条,之后120秒内不再发言。',
|
|
19
21
|
create(args?: string[]) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { SocialTaskTop, type SocialTarget } from './goals/social-task-top.js';
|
|
4
5
|
|
|
@@ -34,6 +35,7 @@ export function parseSocialArgs(args: string[]): SocialTarget[] {
|
|
|
34
35
|
export const strategy: StrategyEntry = {
|
|
35
36
|
id: 'social-task',
|
|
36
37
|
name: '社交',
|
|
38
|
+
...noKnowledgeContract('社交'),
|
|
37
39
|
description: '针对指定玩家社交(参数格式 座位=话术 或纯座位,可多人)。视野内出现目标就靠近,没打过招呼先发一次招呼;对方说话就停下等你回复,10秒没回应就转去做任务。全程见到可报告的尸体就报、见到尸体就靠近。不打人。参数:座位=话术 / 座位(可多人)。',
|
|
38
40
|
create(args?: string[]) {
|
|
39
41
|
if (!args || args.length === 0) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { TaskKillReportTop } from './goals/task-kill-report-top.js';
|
|
4
5
|
|
|
5
6
|
export const strategy: StrategyEntry = {
|
|
6
7
|
id: 'task-kill-report',
|
|
7
8
|
name: '任务刺客',
|
|
9
|
+
...noKnowledgeContract('任务刺客'),
|
|
8
10
|
description: '需传入嫌疑目标(座位号或名字,可多人)。看到目标且冷却好,50内就出刀,否则追上去;冷却中贴身跟随。目标不在视野时,遇到尸体就报告;没尸体就做普通任务。',
|
|
9
11
|
create(args?: string[]) {
|
|
10
12
|
if (!args || args.length === 0) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { TaskOnlyTop } from './goals/task-only-top.js';
|
|
4
5
|
|
|
5
6
|
export const strategy: StrategyEntry = {
|
|
6
7
|
id: 'task-only',
|
|
7
8
|
name: '纯任务',
|
|
9
|
+
...noKnowledgeContract('纯任务'),
|
|
8
10
|
description: '专心做任务。紧急任务出现时优先处理,其次按顺序完成普通任务,如果是蟹,则蟹的伪装任务也会做。没有尸体报告和战斗行为。',
|
|
9
11
|
create() {
|
|
10
12
|
return new GoalRootStrategy('task-only', () => new TaskOnlyTop(), { resetOnMeetingResume: false });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { noKnowledgeContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { TaskReportTop } from './goals/task-report-top.js';
|
|
4
5
|
import { parseGreetingArgs } from './greeting.js';
|
|
@@ -12,6 +13,7 @@ class TaskReportStrategy extends GoalRootStrategy {
|
|
|
12
13
|
export const strategy: StrategyEntry = {
|
|
13
14
|
id: 'task-report',
|
|
14
15
|
name: '尽责虾',
|
|
16
|
+
...noKnowledgeContract('尽责虾'),
|
|
15
17
|
description: '遇尸体最优先:达到报告距离立刻报告,没达到距离就靠近准备报告。紧急任务出现时优先处理,其次按顺序完成普通任务。传入打招呼话术时,视野内出现人就随机发送一条,之后120秒内不再发言。(普通虾默认;进阶版见 shrimp-memory)参数:可选:1~3 条打招呼话术。',
|
|
16
18
|
create(args?: string[]) {
|
|
17
19
|
return new TaskReportStrategy(parseGreetingArgs(args, 'task-report'));
|
package/src/strategies/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GameState, TaskInfo, TaskLocation, EmergencyInfo, CorpseInfo } from '../sdk/types.js';
|
|
2
2
|
import type { Action } from '../sdk/action.js';
|
|
3
|
-
import type { KnowledgeView } from '../lib/knowledge-store.js';
|
|
3
|
+
import type { KnowledgeView, KnowledgeSetInput, SubjectRef } from '../lib/knowledge-store.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Minimal interface for custom modules (built-in and strategy-registered).
|
|
@@ -41,6 +41,30 @@ export interface Strategy {
|
|
|
41
41
|
customModules?(): CustomModule[];
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* `ccl knowledge` 写入(set/mark)时,当前策略对单条知识做的格式校验结果。
|
|
46
|
+
* 校验由 `StrategyEntry.validateKnowledge` 提供;不实现即视为通过(兼容自定义策略)。
|
|
47
|
+
* `ok:false` 时写入照常发生,但 `message` 会作为 warning 出现在命令的返回 JSON 里,
|
|
48
|
+
* 提示玩家这条知识不会被当前策略读取。
|
|
49
|
+
*/
|
|
50
|
+
export interface KnowledgeValidation {
|
|
51
|
+
ok: boolean;
|
|
52
|
+
/** 校验不通过时给玩家的说明。 */
|
|
53
|
+
message?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 切换到某策略时,由「新策略」审视对局现有知识,指出哪些条目它读不到 / 用不上。
|
|
58
|
+
* knowledge 不随切换策略而清空(按对局作用域),故用它告知玩家哪些标记已失效。
|
|
59
|
+
* 由 `StrategyEntry.reviewKnowledge` 提供;不实现即视为「现有知识全部保留」。
|
|
60
|
+
*/
|
|
61
|
+
export interface KnowledgeReview {
|
|
62
|
+
/** 新策略读不到 / 用不上、切换后不会生效的知识条目。 */
|
|
63
|
+
stale?: SubjectRef[];
|
|
64
|
+
/** 给玩家的整理说明(每条一行)。 */
|
|
65
|
+
notes?: string[];
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
export interface StrategyEntry {
|
|
45
69
|
readonly id: string;
|
|
46
70
|
/**
|
|
@@ -52,6 +76,18 @@ export interface StrategyEntry {
|
|
|
52
76
|
readonly name: string;
|
|
53
77
|
readonly description: string;
|
|
54
78
|
create(args?: string[]): Strategy;
|
|
79
|
+
/**
|
|
80
|
+
* 可选:校验一条即将写入的 knowledge 是否符合本策略能读取的格式。
|
|
81
|
+
* 不实现视为通过(兼容所有自定义策略)。返回 `ok:false` 时 `ccl knowledge`
|
|
82
|
+
* 仍会写入,只在返回 JSON 里带上 `message` 警告玩家该条不会生效。
|
|
83
|
+
* 没有记忆功能(不读 `ctx.knowledge`)的策略应实现它并一律返回 `ok:false`。
|
|
84
|
+
*/
|
|
85
|
+
validateKnowledge?(input: KnowledgeSetInput): KnowledgeValidation;
|
|
86
|
+
/**
|
|
87
|
+
* 可选:切换到本策略时审视对局现有知识,返回哪些条目本策略用不上。
|
|
88
|
+
* 不实现视为「全部保留」。`ccl strategy` 切换成功后会把结果告知玩家。
|
|
89
|
+
*/
|
|
90
|
+
reviewKnowledge?(view: KnowledgeView): KnowledgeReview;
|
|
55
91
|
}
|
|
56
92
|
|
|
57
93
|
export interface RoomTarget {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StrategyEntry } from './types.js';
|
|
2
|
+
import { playerMarkContract } from './knowledge-contract.js';
|
|
2
3
|
import { GoalRootStrategy } from './goals/goal-root-strategy.js';
|
|
3
4
|
import { WarriorShrimpTop } from './goals/warrior-shrimp-top.js';
|
|
4
5
|
import { parseTargetArgs } from './player-targets.js';
|
|
@@ -6,6 +7,7 @@ import { parseTargetArgs } from './player-targets.js';
|
|
|
6
7
|
export const strategy: StrategyEntry = {
|
|
7
8
|
id: 'warrior-memory',
|
|
8
9
|
name: '武士虾',
|
|
10
|
+
...playerMarkContract('武士虾'),
|
|
9
11
|
description:
|
|
10
12
|
'带刀虾·记忆进阶版(武士虾/枪虾通用,好人带刀;kill-lone 的带记忆升级)。读取 ccl knowledge 两档标记(hostile=坏人 / trusted=好人),未标记的一律默认被怀疑:hostile 刀好时主动追杀、刀不好时硬回避,trusted 视为可信同伴且绝不攻击。**只对【已确认 hostile / 启动猎杀目标】出刀**——被怀疑者一律只回避、绝不出刀(无可信同伴且单个被怀疑者贴近270内时先拉开到300再做任务,多人互为目击者则照常做任务);不再有任何贴身追击判定/诱饵试探/绝境自卫(几何上分不开"贴身跟我观察的好人"和"贴身追我的凶手",自卫迟早误杀同阵营好人触发武士虾自爆,整套已删除)。发现尸体优先报警;尸体旁若是 hostile/启动猎杀目标且刀可用会现场先手击杀,但绝不会因尸体旁有未报警的身份不明者就灭口(已根治该误杀);无危险时优先紧急任务,否则做任务/巡逻。枪虾会尊重剩余出刀次数。',
|
|
11
13
|
create(args?: string[]) {
|