import { Card } from "./card" ; import { CardType } from "./card-type" ; import { Cost } from "./cost" ; import { SetId } from "./set-id" ; export class SupplyCard implements Card { constructor ( readonly id , readonly shortId , readonly setId , readonly name , readonly cost , readonly isAction , readonly isActionSupplier , readonly isAttack , readonly isBuySupplier , readonly isDrawer , readonly isDoom , readonly isDuration , readonly isFate , readonly isMultiDrawer , readonly isNight , readonly isReaction , readonly isReserve , readonly isTrashing , readonly isTreasure , readonly isVictory ) { } public isOfType ( cardType ) { switch ( cardType ) { case CardType . ACTION : return this . isAction ; case CardType . ACTION_SUPPLIER : return this . isActionSupplier ; case CardType . ATTACK : return this . isAttack ; case CardType . BUY_SUPPLIER : return this . isBuySupplier ; case CardType . DRAWER : return this . isDrawer ; case CardType . DOOM : return this . isDoom ; case CardType . DURATION : return this . isDuration ; case CardType . FATE : return this . isFate ; case CardType . MULTI_DRAWER : return this . isMultiDrawer ; case CardType . NIGHT : return this . isNight ; case CardType . REACTION : return this . isReaction ; case CardType . RESERVE : return this . isReserve ; case CardType . TRASHING : return this . isTrashing ; case CardType . TREASURE : return this . isTreasure ; case CardType . VICTORY : return this . isVictory ; default : throw new Error ( `Unknown card type: ${ cardType }` ) ; } } public static fromJson ( json ) { return new SupplyCard ( json [ "id" ] , json [ "shortId" ] , json [ "setId" ] , json [ "name" ] , Cost . fromJson ( json [ "cost" ] ) , json [ "isAction" ] || false , json [ "isActionSupplier" ] || false , json [ "isAttack" ] || false , json [ "isBuySupplier" ] || false , json [ "isDrawer" ] || false , json [ "isDoom" ] || false , json [ "isDuration" ] || false , json [ "isFate" ] || false , json [ "isMultiDrawer" ] || false , json [ "isNight" ] || false , json [ "isReaction" ] || false , json [ "isReserve" ] || false , json [ "isTrashing" ] || false , json [ "isTreasure" ] || false , json [ "isVictory" ] || false ) ; } }