refactor(slay-the-spire-like): update card effect and intent schemas
Refactor the data schemas for desert card effects and intents to use dedicated type aliases for triggers, targets, and effect lists. This improves type safety and consistency across the sample data.
This commit is contained in:
parent
888b7b822d
commit
dbbbba14e2
|
|
@ -5,7 +5,7 @@
|
|||
id,card,trigger,target,effects
|
||||
string,@card,CardEffectTrigger,CardEffectTarget,CardEffectList
|
||||
sword,sword,onPlay,eachTarget,[attack;2];[attack;2]
|
||||
greataxe,greataxe,onPlay,all,[attack;5]
|
||||
greataxe,greataxe,onPlay,eachTarget,[attack;5]
|
||||
spear,spear,onPlay,eachTarget,[attack;2];[attack;2];[attack;2]
|
||||
dagger,dagger,onPlay,eachTarget,[attack;3];[attack;3]
|
||||
dart,dart,onPlay,eachTarget,[attack;1]
|
||||
|
|
|
|||
|
|
|
@ -1,12 +1,16 @@
|
|||
import type { Card } from './card.csv';
|
||||
import type { Effect } from './effect.csv';
|
||||
|
||||
type CardEffectTrigger = "onPlay" | "onDraw" | "onDiscard";
|
||||
type CardEffectTarget = "user" | "eachTarget" | "eachEnemy" | "randomEnemy" | "player";
|
||||
type CardEffectList = [effect: Effect, stacks: number][];
|
||||
|
||||
type CardEffectTable = readonly {
|
||||
readonly id: string;
|
||||
readonly card: Card;
|
||||
readonly trigger: "onPlay" | "onDraw" | "onDiscard";
|
||||
readonly target: "self" | "target" | "all" | "random";
|
||||
readonly effects: [Effect, number][];
|
||||
readonly trigger: CardEffectTrigger;
|
||||
readonly target: CardEffectTarget;
|
||||
readonly effects: CardEffectList;
|
||||
}[];
|
||||
|
||||
export type CardEffect = CardEffectTable[number];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import type { Enemy } from './enemy.csv';
|
||||
import type { Effect } from './effect.csv';
|
||||
import type { Enemy } from "./enemy.csv";
|
||||
import type { Effect } from "./effect.csv";
|
||||
|
||||
type IntentEffectTarget = "user" | "eachEnemy" | "randomEnemy" | "player";
|
||||
type IntentEffectList = [IntentEffectTarget, Effect, number][];
|
||||
|
||||
type IntentTable = readonly {
|
||||
readonly id: string;
|
||||
|
|
@ -7,7 +10,7 @@ type IntentTable = readonly {
|
|||
readonly initialIntent: boolean;
|
||||
readonly nextIntents: Intent[];
|
||||
readonly brokenIntent: Intent[];
|
||||
readonly effects: ["self" | "player" | "team", Effect, number][];
|
||||
readonly effects: IntentEffectList;
|
||||
}[];
|
||||
|
||||
export type Intent = IntentTable[number];
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
import {
|
||||
CardData,
|
||||
CardEffectTarget,
|
||||
CardTargetType,
|
||||
EffectData,
|
||||
EffectTarget,
|
||||
} from "@/samples/slay-the-spire-like/system/types";
|
||||
|
|
|
|||
Loading…
Reference in New Issue