コード例 #1
0
        /// <summary>Initializes a new instance of the <see cref="Game"/> class.</summary>
        /// <param name="gameConfig">The game configuration.</param>
        /// <param name="setupHeroes"></param>
        public Game(GameConfig gameConfig, bool setupHeroes = true)
            : base(null, Card.CardGame, new Dictionary <GameTag, int>
        {
            [GameTag.ENTITY_ID] = GAME_ENTITYID,
            [GameTag.ZONE]      = (int)Enums.Zone.PLAY,
            [GameTag.CARDTYPE]  = (int)CardType.GAME
        })
        {
            _gameConfig       = gameConfig;
            Game              = this;
            GamesEventManager = new GameEventManager(this);

            _players[0] = new Controller(this, gameConfig.Player1Name, 1, 2);
            _players[1] = new Controller(this, gameConfig.Player2Name, 2, 3);

            // add power history create game
            if (History)
            {
                PowerHistory.Add(PowerHistoryBuilder.CreateGame(this, _players));
            }

            if (setupHeroes)
            {
                _players[0].AddHeroAndPower(Cards.HeroCard(gameConfig.Player1HeroClass));
                _players[1].AddHeroAndPower(Cards.HeroCard(gameConfig.Player2HeroClass));
            }

            TaskQueue = new TaskQueue(this);
            TaskStack = new TaskStack(this);
        }
コード例 #2
0
 public void Stamp(TaskStack taskStack)
 {
     Playables = new List <IPlayable>();
     Playables = taskStack.Playables?.Select(p => Game.IdEntityDic[p.Id]).ToList();
     CardIds   = taskStack.CardIds;
     Flag      = taskStack.Flag;
     Numbers   = taskStack.Numbers;
 }
コード例 #3
0
        public TaskStack Clone(Game game)
        {
            var clone = new TaskStack()
            {
                Playables = new List <IPlayable>(),
                Flag      = Flag,
                Number    = Number,
                Number1   = Number1,
                Number2   = Number2,
                Number3   = Number3,
                Number4   = Number4
            };

            if (Playables.Count > 0)
            {
                clone.AddPlayables(Playables.Select(p => game.IdEntityDic[p.Id]));
            }

            return(clone);
        }
コード例 #4
0
ファイル: TaskStack.cs プロジェクト: Jeredian/SabberStone
        public void Stamp(TaskStack taskStack)
        {
            //Playables = taskStack.Playables?.Select(p => Game.IdEntityDic[p.Id]).ToList();
            Playables = new List <IPlayable>();
            //CardIds = new List<string>();
            Flag    = taskStack.Flag;
            Numbers = new int[5];
            Array.Copy(taskStack.Numbers, Numbers, 5);

            if (taskStack.Controller != null)
            {
                Controller = Game.ControllerById(taskStack.Controller.Id);
            }
            if (taskStack.Source != null)
            {
                Source = Game.IdEntityDic[taskStack.Source.Id];
            }
            if (taskStack.Target != null)
            {
                Target = Game.IdEntityDic[taskStack.Target.Id];
            }
        }