ttrpg-tools/src/cli/prompts/design-card-game.ts

300 lines
7.7 KiB
TypeScript
Raw Normal View History

2026-03-18 12:12:43 +08:00
/**
* design-card-game Prompt
2026-03-18 13:02:50 +08:00
*
2026-03-18 12:12:43 +08:00
*
*/
export interface DesignCardGameOptions {
/**
*
*/
deck_name?: string;
/**
*
*/
output_dir?: string;
/**
* /
*/
game_theme?: string;
}
export interface DesignCardGameResult {
messages: PromptMessage[];
}
export interface PromptMessage {
role: 'user' | 'assistant';
content: TextContent | ImageContent | AudioContent | ResourceContent;
}
export interface TextContent {
type: 'text';
text: string;
}
export interface ImageContent {
type: 'image';
data: string;
mimeType: string;
}
export interface AudioContent {
type: 'audio';
data: string;
mimeType: string;
}
export interface ResourceContent {
type: 'resource';
resource: {
uri: string;
mimeType: string;
text?: string;
blob?: string;
};
}
2026-03-18 13:02:50 +08:00
/**
*
*/
export type DataType = 'word' | 'paragraph' | 'number' | 'symbol' | 'symbol_list';
/**
*
*/
export type FieldFunction = 'identify' | 'compare' | 'flavor' | 'rule';
/**
*
*/
export interface FieldDefinition {
name: string;
description: string;
dataType: DataType;
function: FieldFunction;
examples?: string[];
}
/**
*
*/
const DATA_TYPE_DESCRIPTIONS: Record<DataType, string> = {
word: '词语 - 短文本(如名称、类型、职业等)',
paragraph: '文本段落 - 长描述(如效果说明、背景故事等)',
number: '数字 - 可比较的数值(如费用、强度、等级等)',
symbol: '单一符号 - 图标/标记(如阵营符号、元素标志等)',
symbol_list: '符号列表 - 多个图标/标记(如属性加成列表、技能图标等)'
};
/**
*
*/
const FIELD_FUNCTION_DESCRIPTIONS: Record<FieldFunction, string> = {
identify: '辨识 - 用于识别卡牌身份(如名称、编号等)',
compare: '比较 - 用于游戏机制中的数值比较(如费用、攻击力等)',
flavor: '游戏风味描述 - 提供背景故事/氛围(如背景故事、引言等)',
rule: '规则确认 - 明确游戏规则相关的信息(如效果文本、触发条件等)'
};
2026-03-18 12:12:43 +08:00
/**
* design-card-game prompt
*/
export function designCardGame(options?: DesignCardGameOptions): DesignCardGameResult {
const deckName = options?.deck_name || '未命名卡牌组';
const outputDir = options?.output_dir || './content';
const gameTheme = options?.game_theme || '通用';
const messages: PromptMessage[] = [
{
role: 'user',
content: {
type: 'text',
text: `我想设计一个"${gameTheme}"主题的卡牌游戏,卡牌组名称为"${deckName}",输出目录为"${outputDir}"。请帮我设计卡牌的字段结构。`
}
},
{
role: 'assistant',
content: {
type: 'text',
text: `好的!我来帮你设计"${deckName}"卡牌组的字段结构。
2026-03-18 13:02:50 +08:00
---
## 1
****
-
-
-
-
****
- ...
---
## 2
| | | |
|------|------|------|
| word | | "火球术""战士""传说" |
| paragraph | | "造成 5d6 点火焰伤害,范围内的所有生物进行敏捷豁免" |
| number | | 3510 |
| symbol | / | 🔥🛡 |
| symbol_list | / | 🔥🔥🔥🛡💫 |
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
---
## 3
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
| | | |
|------|------|------|
| identify | | |
| compare | | |
| flavor | / | lore |
| rule | | |
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
---
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
## 4/
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
****
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
使 symbol symbol_list
2026-03-18 12:12:43 +08:00
---
2026-03-18 13:02:50 +08:00
##
\`\`\`
### 1[]
- ****[]
- ****[word/paragraph/number/symbol/symbol_list]
- ****[identify/compare/flavor/rule]
- ****[2-3 ]
### 2[]
...
\`\`\`
---
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
##
2026-03-18 12:12:43 +08:00
###
2026-03-18 13:02:50 +08:00
2026-03-18 12:12:43 +08:00
\`\`\`
2026-03-18 13:02:50 +08:00
### 1name
- ****
- ****word
- ****identify
- ****
2026-03-18 12:12:43 +08:00
2026-03-18 13:02:50 +08:00
### 2cost
- ****使
- ****number
- ****compare
- ****352
### 3type
- ****
- ****word
- ****identify
- ****
### 4rarity
- ****
- ****word
- ****compare
- ****
### 5effect
- ****使
- ****paragraph
- ****rule
- **** 5d6 2d4+2
2026-03-18 12:12:43 +08:00
\`\`\`
###
2026-03-18 13:02:50 +08:00
\`\`\`
### 1name
- ****
- ****word
- ****identify
- ****
### 2number
- ****
- ****number
- ****identify
- ****012
### 3element
- ****
- ****symbol
- ****flavor
- ****🔥💧💨🌍
### 4meaning
- ****
- ****paragraph
- ****rule
- ****
### 5reversed
- ****
- ****paragraph
- ****rule
- ****
\`\`\`
---
`
2026-03-18 12:12:43 +08:00
}
}
];
return { messages };
}
/**
* prompt
*/
export function getDesignCardGamePrompt() {
return {
name: 'design-card-game',
title: '设计卡牌游戏',
description: '引导用户设计新的卡牌游戏系统,定义卡牌模板和字段结构',
arguments: [
{
name: 'deck_name',
description: '卡牌组名称',
required: false
},
{
name: 'output_dir',
description: '输出目录(相对路径)',
required: false
},
{
name: 'game_theme',
description: '游戏主题/类型(如:奇幻、科幻、恐怖等)',
required: false
}
]
};
}