refactor(samples): export desert data types

Export type definitions from desert CSV declaration files and
update the content module to use these exported types instead of
generic system types.
This commit is contained in:
2026-04-22 16:48:54 +08:00
parent dbbbba14e2
commit 72647a8268
8 changed files with 40 additions and 35 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
import type { CardEffect } from './cardEffect.csv';
type CardType = "item" | "status";
type CardCostType = "energy" | "uses" | "none";
type CardTargetType = "player" | "enemy" | "enemies";
export type CardType = "item" | "status";
export type CardCostType = "energy" | "uses" | "none";
export type CardTargetType = "player" | "enemy" | "enemies";
type CardTable = readonly {
readonly id: string;
@@ -1,9 +1,9 @@
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][];
export type CardEffectTrigger = "onPlay" | "onDraw" | "onDiscard";
export type CardEffectTarget = "user" | "eachTarget" | "eachEnemy" | "randomEnemy" | "player";
export type CardEffectList = [effect: Effect, stacks: number][];
type CardEffectTable = readonly {
readonly id: string;
@@ -1,4 +1,4 @@
type EffectLifecycle = "instant" | "temporary" | "lingering" | "permanent" | "posture" | "item" | "itemTemporary" | "itemUntilPlay" | "itemUntilDiscard" | "itemPermanent";
export type EffectLifecycle = "instant" | "temporary" | "lingering" | "permanent" | "posture" | "item" | "itemTemporary" | "itemUntilPlay" | "itemUntilDiscard" | "itemPermanent";
type EffectTable = readonly {
readonly id: string;
@@ -1,8 +1,8 @@
import type { Enemy } from './enemy.csv';
import type { Effect } from './effect.csv';
type EncounterType = "minion" | "elite" | "event" | "shop" | "camp" | "curio";
type EnemyList = [data: Enemy, hp: number, effects: [effect: Effect, stacks: number][]][];
export type EncounterType = "minion" | "elite" | "event" | "shop" | "camp" | "curio";
export type EnemyList = [data: Enemy, hp: number, effects: [effect: Effect, stacks: number][]][];
type EncounterTable = readonly {
readonly id: string;
@@ -1,5 +1,13 @@
import getItems, { Item } from "./item.csv";
export type * from "./card.csv";
export type * from "./cardEffect.csv";
export type * from "./effect.csv";
export type * from "./encounter.csv";
export type * from "./enemy.csv";
export type * from "./intent.csv";
export type * from "./item.csv";
export { default as getCards } from "./card.csv";
export { default as getEffects } from "./effect.csv";
export { default as getEncounters } from "./encounter.csv";
@@ -7,9 +7,11 @@
# effects: effects executed when this intent is active
# type IntentEffectTarget = 'user' | 'eachEnemy' | 'randomEnemy' | 'player'
# type IntentEffect = [IntentEffectTarget;@effect;number]
# type IntentEffectList = IntentEffect[]
id,enemy,initialIntent,nextIntents,brokenIntent,effects
string,@enemy,boolean,@intent[],@intent[],[IntentEffectTarget;@effect;number][]
string,@enemy,boolean,@intent[],@intent[],IntentEffectList
仙人掌怪-boost,仙人掌怪,true,仙人掌怪-boost;仙人掌怪-defend,,[user;spike;1];[user;defend;4]
仙人掌怪-defend,仙人掌怪,false,仙人掌怪-attack,,[user;defend;8]
仙人掌怪-attack,仙人掌怪,false,仙人掌怪-boost,,[player;attack;5]
1 # intentId: unique intent state ID (e.g. '仙人掌怪-boost')
7 # effects: effects executed when this intent is active
8 # type IntentEffectTarget = 'user' | 'eachEnemy' | 'randomEnemy' | 'player'
9 id # type IntentEffect = [IntentEffectTarget;@effect;number]
10 # type IntentEffectList = IntentEffect[]
11 id
12 string
13 仙人掌怪-boost
14 仙人掌怪-defend
15 仙人掌怪-attack
16 蛇-poison
17 蛇-attack
@@ -1,8 +1,9 @@
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][];
export type IntentEffectTarget = "user" | "eachEnemy" | "randomEnemy" | "player";
export type IntentEffect = ["user" | "eachEnemy" | "randomEnemy" | "player", Effect, number];
export type IntentEffectList = ["user" | "eachEnemy" | "randomEnemy" | "player", Effect, number][];
type IntentTable = readonly {
readonly id: string;
+9 -15
View File
@@ -1,22 +1,16 @@
import { LoadResult as YarnDialogues } from "yarn-spinner-loader";
import {
CardData,
EffectData,
EncounterData,
EnemyData,
IntentData,
ItemData,
} from "../system/types";
import { Triggers } from "../system/combat/triggers";
import type * as desert from "./desert";
export type ContentModule = {
getCards: () => CardData[];
getEffects: () => EffectData[];
getEncounters: () => EncounterData[];
getEnemies: () => EnemyData[];
getIntents: () => IntentData[];
getItems: () => ItemData[];
getStartingItems: () => ItemData[];
getCards: () => desert.Card[];
getEffects: () => desert.Effect[];
getEncounters: () => desert.Encounter[];
getEnemies: () => desert.Enemy[];
getIntents: () => desert.Intent[];
getItems: () => desert.Item[];
getStartingItems: () => desert.Item[];
dialogues: YarnDialogues;
addTriggers: (triggers: Triggers) => void;