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

300 lines
7.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* design-card-game Prompt
*
* 引导用户设计新的卡牌游戏系统,定义卡牌模板和字段结构
*/
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;
};
}
/**
* 数据类型
*/
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: '规则确认 - 明确游戏规则相关的信息(如效果文本、触发条件等)'
};
/**
* 生成 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}"卡牌组的字段结构。
我们将通过以下步骤完成设计:
---
## 步骤 1列出卡牌属性
首先,请列出你的卡牌包含哪些属性(字段)。
**思考方向:**
- 玩家看到这张卡牌时,需要知道什么信息?
- 游戏机制需要用到哪些数据?
- 哪些信息用于区分不同的卡牌?
- 哪些信息用于游戏过程中的判断?
**示例:**
- 名称、费用、类型、效果、稀有度...
---
## 步骤 2定义每个属性的数据类型
对于每个属性,选择其数据类型:
| 类型 | 说明 | 示例 |
|------|------|------|
| word词语 | 短文本 | "火球术"、"战士"、"传说" |
| paragraph文本段落 | 长描述 | "造成 5d6 点火焰伤害,范围内的所有生物进行敏捷豁免" |
| number数字 | 可比较的数值 | 3、5、10 |
| symbol单一符号 | 图标/标记 | 🔥、⚔️、🛡️ |
| symbol_list符号列表 | 多个图标/标记 | 🔥🔥🔥、⚔️🛡️💫 |
---
## 步骤 3定义每个字段的功能
对于每个属性,说明其在游戏中的功能:
| 功能 | 说明 | 示例 |
|------|------|------|
| identify辨识 | 用于识别卡牌身份 | 名称、编号、唯一标识 |
| compare比较 | 用于游戏机制中的数值比较 | 费用、攻击力、防御力 |
| flavor游戏风味描述 | 提供背景故事/氛围 | 背景故事、引言、 lore |
| rule规则确认 | 明确游戏规则相关的信息 | 效果文本、触发条件、限制 |
---
## 步骤 4关于插画/美术设计
**默认设定:** 卡牌的背景部分视为插画或精美的装帧设计,不需要在数据中定义插画字段。
如果你需要在卡牌上显示特定的图标或符号,请使用 symbol 或 symbol_list 类型。
---
## 回复格式
请按以下格式回复(可以复制模板填写):
\`\`\`
### 属性 1[属性名称]
- **描述**[简短说明这个属性的用途]
- **数据类型**[word/paragraph/number/symbol/symbol_list]
- **字段功能**[identify/compare/flavor/rule]
- **示例值**[2-3 个示例值]
### 属性 2[属性名称]
...
\`\`\`
---
## 示例参考
### 魔法物品卡牌组
\`\`\`
### 属性 1name名称
- **描述**:物品的名称
- **数据类型**word
- **字段功能**identify
- **示例值**:火球术卷轴、治疗药水、隐形斗篷
### 属性 2cost费用
- **描述**:购买或使用该物品所需的资源
- **数据类型**number
- **字段功能**compare
- **示例值**3、5、2
### 属性 3type类型
- **描述**:物品的分类
- **数据类型**word
- **字段功能**identify
- **示例值**:武器、防具、饰品、消耗品
### 属性 4rarity稀有度
- **描述**:物品的稀有程度
- **数据类型**word
- **字段功能**compare
- **示例值**:普通、稀有、史诗、传说
### 属性 5effect效果
- **描述**:物品的效果或使用说明
- **数据类型**paragraph
- **字段功能**rule
- **示例值**:造成 5d6 点火焰伤害、恢复 2d4+2 点生命值
\`\`\`
### 塔罗牌组
\`\`\`
### 属性 1name牌名
- **描述**:塔罗牌的名称
- **数据类型**word
- **字段功能**identify
- **示例值**:愚者、魔术师、女祭司
### 属性 2number编号
- **描述**:在大阿卡纳中的序号
- **数据类型**number
- **字段功能**identify
- **示例值**0、1、2
### 属性 3element元素
- **描述**:对应的元素
- **数据类型**symbol
- **字段功能**flavor
- **示例值**:🔥、💧、💨、🌍
### 属性 4meaning含义
- **描述**:正位时的含义
- **数据类型**paragraph
- **字段功能**rule
- **示例值**:新的开始、冒险、自发性
### 属性 5reversed逆位含义
- **描述**:逆位时的含义
- **数据类型**paragraph
- **字段功能**rule
- **示例值**:鲁莽、冒险导致的失败、缺乏计划
\`\`\`
---
请开始描述你的卡牌属性吧!`
}
}
];
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
}
]
};
}