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:
parent
dbbbba14e2
commit
72647a8268
|
|
@ -1,8 +1,8 @@
|
||||||
import type { CardEffect } from './cardEffect.csv';
|
import type { CardEffect } from './cardEffect.csv';
|
||||||
|
|
||||||
type CardType = "item" | "status";
|
export type CardType = "item" | "status";
|
||||||
type CardCostType = "energy" | "uses" | "none";
|
export type CardCostType = "energy" | "uses" | "none";
|
||||||
type CardTargetType = "player" | "enemy" | "enemies";
|
export type CardTargetType = "player" | "enemy" | "enemies";
|
||||||
|
|
||||||
type CardTable = readonly {
|
type CardTable = readonly {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import type { Card } from './card.csv';
|
import type { Card } from './card.csv';
|
||||||
import type { Effect } from './effect.csv';
|
import type { Effect } from './effect.csv';
|
||||||
|
|
||||||
type CardEffectTrigger = "onPlay" | "onDraw" | "onDiscard";
|
export type CardEffectTrigger = "onPlay" | "onDraw" | "onDiscard";
|
||||||
type CardEffectTarget = "user" | "eachTarget" | "eachEnemy" | "randomEnemy" | "player";
|
export type CardEffectTarget = "user" | "eachTarget" | "eachEnemy" | "randomEnemy" | "player";
|
||||||
type CardEffectList = [effect: Effect, stacks: number][];
|
export type CardEffectList = [effect: Effect, stacks: number][];
|
||||||
|
|
||||||
type CardEffectTable = readonly {
|
type CardEffectTable = readonly {
|
||||||
readonly id: string;
|
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 {
|
type EffectTable = readonly {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Enemy } from './enemy.csv';
|
import type { Enemy } from './enemy.csv';
|
||||||
import type { Effect } from './effect.csv';
|
import type { Effect } from './effect.csv';
|
||||||
|
|
||||||
type EncounterType = "minion" | "elite" | "event" | "shop" | "camp" | "curio";
|
export type EncounterType = "minion" | "elite" | "event" | "shop" | "camp" | "curio";
|
||||||
type EnemyList = [data: Enemy, hp: number, effects: [effect: Effect, stacks: number][]][];
|
export type EnemyList = [data: Enemy, hp: number, effects: [effect: Effect, stacks: number][]][];
|
||||||
|
|
||||||
type EncounterTable = readonly {
|
type EncounterTable = readonly {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
import getItems, { Item } from "./item.csv";
|
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 getCards } from "./card.csv";
|
||||||
export { default as getEffects } from "./effect.csv";
|
export { default as getEffects } from "./effect.csv";
|
||||||
export { default as getEncounters } from "./encounter.csv";
|
export { default as getEncounters } from "./encounter.csv";
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@
|
||||||
# effects: effects executed when this intent is active
|
# effects: effects executed when this intent is active
|
||||||
|
|
||||||
# type IntentEffectTarget = 'user' | 'eachEnemy' | 'randomEnemy' | 'player'
|
# type IntentEffectTarget = 'user' | 'eachEnemy' | 'randomEnemy' | 'player'
|
||||||
|
# type IntentEffect = [IntentEffectTarget;@effect;number]
|
||||||
|
# type IntentEffectList = IntentEffect[]
|
||||||
|
|
||||||
id,enemy,initialIntent,nextIntents,brokenIntent,effects
|
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]
|
仙人掌怪-boost,仙人掌怪,true,仙人掌怪-boost;仙人掌怪-defend,,[user;spike;1];[user;defend;4]
|
||||||
仙人掌怪-defend,仙人掌怪,false,仙人掌怪-attack,,[user;defend;8]
|
仙人掌怪-defend,仙人掌怪,false,仙人掌怪-attack,,[user;defend;8]
|
||||||
仙人掌怪-attack,仙人掌怪,false,仙人掌怪-boost,,[player;attack;5]
|
仙人掌怪-attack,仙人掌怪,false,仙人掌怪-boost,,[player;attack;5]
|
||||||
|
|
|
||||||
|
Can't render this file because it has a wrong number of fields in line 11.
|
|
|
@ -1,16 +1,17 @@
|
||||||
import type { Enemy } from "./enemy.csv";
|
import type { Enemy } from './enemy.csv';
|
||||||
import type { Effect } from "./effect.csv";
|
import type { Effect } from './effect.csv';
|
||||||
|
|
||||||
type IntentEffectTarget = "user" | "eachEnemy" | "randomEnemy" | "player";
|
export type IntentEffectTarget = "user" | "eachEnemy" | "randomEnemy" | "player";
|
||||||
type IntentEffectList = [IntentEffectTarget, Effect, number][];
|
export type IntentEffect = ["user" | "eachEnemy" | "randomEnemy" | "player", Effect, number];
|
||||||
|
export type IntentEffectList = ["user" | "eachEnemy" | "randomEnemy" | "player", Effect, number][];
|
||||||
|
|
||||||
type IntentTable = readonly {
|
type IntentTable = readonly {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly enemy: Enemy;
|
readonly enemy: Enemy;
|
||||||
readonly initialIntent: boolean;
|
readonly initialIntent: boolean;
|
||||||
readonly nextIntents: Intent[];
|
readonly nextIntents: Intent[];
|
||||||
readonly brokenIntent: Intent[];
|
readonly brokenIntent: Intent[];
|
||||||
readonly effects: IntentEffectList;
|
readonly effects: IntentEffectList;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
export type Intent = IntentTable[number];
|
export type Intent = IntentTable[number];
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,16 @@
|
||||||
import { LoadResult as YarnDialogues } from "yarn-spinner-loader";
|
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 { Triggers } from "../system/combat/triggers";
|
||||||
|
|
||||||
|
import type * as desert from "./desert";
|
||||||
|
|
||||||
export type ContentModule = {
|
export type ContentModule = {
|
||||||
getCards: () => CardData[];
|
getCards: () => desert.Card[];
|
||||||
getEffects: () => EffectData[];
|
getEffects: () => desert.Effect[];
|
||||||
getEncounters: () => EncounterData[];
|
getEncounters: () => desert.Encounter[];
|
||||||
getEnemies: () => EnemyData[];
|
getEnemies: () => desert.Enemy[];
|
||||||
getIntents: () => IntentData[];
|
getIntents: () => desert.Intent[];
|
||||||
getItems: () => ItemData[];
|
getItems: () => desert.Item[];
|
||||||
getStartingItems: () => ItemData[];
|
getStartingItems: () => desert.Item[];
|
||||||
|
|
||||||
dialogues: YarnDialogues;
|
dialogues: YarnDialogues;
|
||||||
addTriggers: (triggers: Triggers) => void;
|
addTriggers: (triggers: Triggers) => void;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue