123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 'use strict';
- import stateMixins from './stateMixins';
- export default function initState(duelController) {
- stateMixins.call(this);
- let duelCtrl = duelController;
- this.start = (payload = null) => {
- if (payload) {
- duelCtrl.setData({
- bluePlayer: {
- name: payload.player1Name,
- color: 'blue',
- twelveHeroes: []
- },
- redPlayer: {
- name: payload.player2Name,
- color: 'red',
- twelveHeroes: []
- },
- game: {
- allHeroes: duelCtrl.getAllHeroes(),
- deckMode: payload.gameOptions.deck,
- advRules: payload.gameOptions.advRules,
- 'waitingFor/blue': false,
- 'waitingFor/red': false,
- currentPlayer: '',
- 'battleTiles/left': [{ id: 0, name: 'mine', redPoints: 3 }]
- }
- });
- // Init state just initialize game data, end it
- duelCtrl.endCurrentState();
- }
- };
- this.update = () => {};
- this.end = () => {
- switch (duelCtrl.getGameData().game.deckMode) {
- case 'faction':
- duelCtrl.setCurrentState('1_SELECT_FACTION');
- duelCtrl.startCurrentState();
- break;
- case 'tournament':
- duelCtrl.setCurrentState('1_SELECT_TOURNAMENT');
- duelCtrl.startCurrentState();
- break;
- case 'draft':
- duelCtrl.setCurrentState('1_SELECT_DRAFT');
- duelCtrl.startCurrentState();
- break;
- default:
- break;
- }
- };
- }
|