public virtual void Apply(NamedGameModifiers namedGameModifiers) { }
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; } }