import { ReferenceCard } from '@firestone-hs/reference-data' ; import { CardMetaInfo } from './card-meta-info' ; export class DeckCard { readonly cardId : string ; readonly entityId : number ; readonly cardName : string ; readonly manaCost : number ; readonly cardType : string ; readonly actualManaCost : number ; readonly rarity : string ; readonly creatorCardId ? : string ; readonly lastAffectedByCardId ? : string ; readonly dormant ? : boolean ; readonly buffingEntityCardIds ? : readonly string [ ] ; readonly buffCardIds ? : readonly string [ ] ; readonly zone : 'DISCARD' | 'BURNED' | 'PLAY' | 'SETASIDE' | 'SECRET' | 'HAND' | 'REMOVEDFROMGAME' | 'GRAVEYARD' | 'TRANSFORMED_INTO_OTHER' ; readonly metaInfo : CardMetaInfo = new CardMetaInfo ( ) ; readonly inInitialDeck : boolean ; readonly temporaryCard ? : boolean ; readonly milled ? : boolean ; readonly bonusDamage ? : number ; readonly cardMatchCondition ? : ( card : ReferenceCard ) => boolean ; public static create ( base = { } as DeckCard ) { return Object . assign ( new DeckCard ( ) , base ) ; } protected constructor ( ) { } public update ( newCard ) { if ( newCard ?. cardId && ! newCard ?. cardName ) { console . warn ( 'updating deck card without name' , newCard , new Error ( ) . stack ) ; } return Object . assign ( new DeckCard ( ) , this , newCard ) ; } public isFiller ( ) { return ! this . cardId && ! this . entityId && ! this . creatorCardId && ! this . cardName ; } public getEffectiveManaCost ( ) { return this . actualManaCost ?? this . manaCost ; } }