Exemplo n.º 1
0
 public BoardMember(uint s_hours, uint d_hours, uint op_prep_hours)
 {
     _summonsHours       = s_hours;
     _decisionHours      = d_hours;
     _opPreparationHours = op_prep_hours;
     _summonsQueue       = new SummonsQueue();
     _decisionQueue      = new DecisionQueue();
 }
Exemplo n.º 2
0
        public void Initialize(Game game, DecisionQueue decisionQueue)
        {
            Game = game;
              _decisionQueue = decisionQueue;

              _currentHandler.Initialize(ChangeTracker);
              _currentStep.Initialize(ChangeTracker);
              _currentState.Initialize(ChangeTracker);
              _steps = CreateStepNodes();
        }
Exemplo n.º 3
0
        public void Initialize(Game game, DecisionQueue decisionQueue)
        {
            Game           = game;
            _decisionQueue = decisionQueue;

            _currentHandler.Initialize(ChangeTracker);
            _currentStep.Initialize(ChangeTracker);
            _currentState.Initialize(ChangeTracker);
            _steps = CreateStepNodes();
        }
Exemplo n.º 4
0
        public Game(GameParameters p)
        {
            ChangeTracker = new ChangeTracker();
            Stack         = new Stack();
            Turn          = new TurnInfo();
            Ai            = new SearchRunner(p.SearchParameters, this);
            Combat        = new Combat();
            Settings      = p.Settings;

            _decisionQueue = new DecisionQueue();
            _publisher     = new Publisher(changeTracker: ChangeTracker);
            _wasStopped    = new Trackable <bool>();
            _stateMachine  = new StateMachine();

            var player1 = new Player(p.Player1, p.Player1Controller);
            var player2 = new Player(p.Player2, p.Player2Controller);

            Players = new Players(player1, player2);

            _damagePreventions  = new DamagePreventions();
            _damageRedirections = new DamageRedirections();
            _namedGameModifiers = new NamedGameModifiers();
            _costModifiers      = new CostModifiers();
            _scenario           = new Scenario(this);

            if (p.IsSavedGame)
            {
                Random   = new RandomGenerator(p.SavedGame.RandomSeed);
                Recorder = new GameRecorder(this, p.SavedGame.Decisions);
            }
            else
            {
                Random   = new RandomGenerator();
                Recorder = new GameRecorder(this);
            }

            Initialize();

            if (p.IsSavedGame)
            {
                p.SavedGame.Decisions.Position = 0;

                Player looser = null;

                if (p.Looser != null)
                {
                    looser = p.Looser == 0 ? player1 : player2;
                }

                _stateMachine.Start(() =>
                {
                    if (p.RollBack > 0)
                    {
                        return((Turn.StateCount < p.SavedGame.StateCount - p.RollBack) || (_stateMachine.HasPendingDecisions));
                    }

                    return(Turn.StateCount < p.SavedGame.StateCount || Recorder.IsPlayback);
                }, skipPreGame: false, looser: looser);

                Recorder.DiscardUnloadedResults();
                _wasLoaded = true;
            }
        }