规则、卡包与测试放在同一套核心里,避免表现层自行结算。 Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.4 KiB
JSON
51 lines
1.4 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://cardgame.local/schemas/card.json",
|
|
"title": "Card",
|
|
"type": "object",
|
|
"required": ["id", "name", "type", "cost", "effects"],
|
|
"properties": {
|
|
"id": { "type": "string", "minLength": 1 },
|
|
"name": { "type": "string", "minLength": 1 },
|
|
"type": { "enum": ["Creature", "Spell", "Field"] },
|
|
"cost": { "type": "integer", "minimum": 0 },
|
|
"tags": {
|
|
"type": "array",
|
|
"items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" }
|
|
},
|
|
"attack": { "type": "integer" },
|
|
"health": { "type": "integer" },
|
|
"countdown": { "type": "integer", "minimum": 0 },
|
|
"effects": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/effect" }
|
|
},
|
|
"triggers": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["when", "effects"],
|
|
"properties": {
|
|
"when": { "enum": ["TurnStart", "OnDestroyed"] },
|
|
"effects": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/effect" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"$defs": {
|
|
"effect": {
|
|
"type": "object",
|
|
"required": ["op"],
|
|
"properties": {
|
|
"op": { "type": "string" },
|
|
"amount": { "type": "integer" },
|
|
"target": { "type": "string" },
|
|
"customEffect": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
}
|