import { GameEvent } from '../../../../../models/game-event' ; import { RealTimeStatsState } from '../real-time-stats' ; import { EventParser } from './_event-parser' ; export class RTStatTurnStartParser implements EventParser { applies ( gameEvent , currentState ) { return gameEvent . type === GameEvent . TURN_START ; } parse ( gameEvent , currentState ) { const newCurrentTurn = Math . ceil ( gameEvent . additionalData . turnNumber / 2 ) ; return currentState . update ( { currentTurn : newCurrentTurn , } as RealTimeStatsState ) ; } name ( ) { return 'RTStatTurnStartParser' ; } }