diff --git a/src/samples/slay-the-spire-like/system/combat/types.ts b/src/samples/slay-the-spire-like/system/combat/types.ts index eb0d790..32b0e0e 100644 --- a/src/samples/slay-the-spire-like/system/combat/types.ts +++ b/src/samples/slay-the-spire-like/system/combat/types.ts @@ -1,5 +1,7 @@ -import type { PlayerDeck } from "../deck/types"; +import { Part } from "@/core/part"; +import { Region } from "@/core/region"; import { + CardData, EnemyData, IntentData, ItemData, @@ -16,10 +18,20 @@ export type CombatEntity = { isAlive: boolean; }; +export interface IPlayerDeck { + cards: Record>; + regions: { + hand: Region; + discardPile: Region; + drawPile: Region; + exhaustPile: Region; + }; +} + export type PlayerEntity = CombatEntity & { energy: number; maxEnergy: number; - deck: PlayerDeck; + deck: IPlayerDeck; itemEffects: Record; }; diff --git a/src/samples/slay-the-spire-like/system/deck/factory.ts b/src/samples/slay-the-spire-like/system/deck/factory.ts index c4022af..d3a627f 100644 --- a/src/samples/slay-the-spire-like/system/deck/factory.ts +++ b/src/samples/slay-the-spire-like/system/deck/factory.ts @@ -1,8 +1,7 @@ import { moveToRegion } from "@/core/region"; import { createRegion } from "@/core/region"; -import type { GameItemMeta, GridInventory } from "../grid-inventory/types"; import type { CardData } from "../types"; -import type { DeckRegions, GameCard, PlayerDeck } from "./types"; +import type { DeckRegions, GameCard, IInventory, PlayerDeck } from "./types"; function generateCardId(itemId: string, cellIndex: number): string { return `card-${itemId}-${cellIndex}`; @@ -31,9 +30,7 @@ function createDeckRegions(): DeckRegions { }; } -function generateDeckFromInventory( - inventory: GridInventory, -): PlayerDeck { +function generateDeckFromInventory(inventory: IInventory): PlayerDeck { const cards: Record = {}; const regions = createDeckRegions(); diff --git a/src/samples/slay-the-spire-like/system/deck/types.ts b/src/samples/slay-the-spire-like/system/deck/types.ts index 31d377c..453a788 100644 --- a/src/samples/slay-the-spire-like/system/deck/types.ts +++ b/src/samples/slay-the-spire-like/system/deck/types.ts @@ -1,14 +1,26 @@ -import type { Part } from '@/core/part'; -import {CardData} from "@/samples/slay-the-spire-like/system/types"; -import {Region} from "@/core/region"; +import type { Part } from "@/core/part"; +import { CardData, ItemData } from "@/samples/slay-the-spire-like/system/types"; +import { Region } from "@/core/region"; +import { ParsedShape } from "../utils/parse-shape"; /** * Metadata for a game card. * Bridges inventory item data with the card system. */ export interface GameCardMeta { - cardData: CardData; - itemId: string; + cardData: CardData; + itemId: string; +} + +export interface IInventory { + items: Map< + string, + { + id: string; + meta?: { itemData: ItemData }; + shape: ParsedShape; + } + >; } /** @@ -21,19 +33,19 @@ export type GameCard = Part; * Player deck structure containing card pools. */ export interface PlayerDeck { - /** All cards indexed by ID */ - cards: Record; - - regions: DeckRegions; + /** All cards indexed by ID */ + cards: Record; + + regions: DeckRegions; } -export interface DeckRegions{ - /** Card IDs in the draw pile */ - drawPile: Region; - /** Card IDs in the player's hand */ - hand: Region; - /** Card IDs in the discard pile */ - discardPile: Region; - /** Card IDs in the exhaust pile (removed from combat) */ - exhaustPile: Region; -} \ No newline at end of file +export interface DeckRegions { + /** Card IDs in the draw pile */ + drawPile: Region; + /** Card IDs in the player's hand */ + hand: Region; + /** Card IDs in the discard pile */ + discardPile: Region; + /** Card IDs in the exhaust pile (removed from combat) */ + exhaustPile: Region; +}