import { DeckState } from '../../../models/decktracker/deck-state' ; import { GameState } from '../../../models/decktracker/game-state' ; import { GameEvent } from '../../../models/game-event' ; import { EventParser } from './event-parser' ; export class GameStartParser implements EventParser { applies ( gameEvent ) { return gameEvent . type === GameEvent . GAME_START ; } async parse ( currentState , gameEvent ) { console . debug ( '[debug] gameStart' ) ; return Object . assign ( new GameState ( ) , { gameStarted : true , playerDeck : DeckState . create ( { isFirstPlayer : false , } as DeckState ) , opponentDeck : DeckState . create ( { isFirstPlayer : false , isOpponent : true , } as DeckState ) , spectating : gameEvent . additionalData . spectating , } as GameState ) ; } event ( ) { return GameEvent . GAME_START ; } }