summaryrefslogtreecommitdiff
path: root/web/src/lib/game/stats.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/lib/game/stats.ts')
-rw-r--r--web/src/lib/game/stats.ts20
1 files changed, 4 insertions, 16 deletions
diff --git a/web/src/lib/game/stats.ts b/web/src/lib/game/stats.ts
index d842159..b5c41ed 100644
--- a/web/src/lib/game/stats.ts
+++ b/web/src/lib/game/stats.ts
@@ -9,20 +9,10 @@
import type {
CharacterItem,
+ ModifierDeck,
MonsterInstance
} from '$lib/protocol/types';
-export interface ModifierCard {
- gfx: string;
-}
-
-export interface ModifierDeckJson {
- drawPile: ModifierCard[];
- discardPile: ModifierCard[];
- removedPile?: ModifierCard[];
- [ key: string ]: unknown;
-}
-
/**
* The wire `figureId` for a standee (a monster instance or a summon): the
* reference app builds it as `name + gfx + standeeNr`.
@@ -33,7 +23,7 @@ export function standeeFigureId(standee: MonsterInstance): string {
/** Count modifier cards matching [predicate] in the draw pile. */
function countCards(
- deck: ModifierDeckJson | undefined,
+ deck: ModifierDeck | undefined,
predicate: (gfx: string) => boolean
): number {
if (!deck?.drawPile) return 0;
@@ -52,9 +42,7 @@ export function characterStatCounters(
empower: number;
enfeeble: number;
} {
- const deck = character.characterState.modifierDeck as
- | ModifierDeckJson
- | undefined;
+ const deck = character.characterState.modifierDeck;
return {
bless: countCards(deck, (g) => g === 'bless'),
curse: countCards(deck, (g) => g === 'curse'),
@@ -65,7 +53,7 @@ export function characterStatCounters(
/** The stat counters for a standee (its owner's modifier deck). */
export function standeeStatCounters(
- deck: ModifierDeckJson | undefined
+ deck: ModifierDeck | undefined
): {
bless: number;
curse: number;