Ejemplo n.º 1
0
        public GameHandler()
        {
            this.players = new Dictionary <ulong, Player>();
            this.pool    = new CardPool();
            this.pool.FillGenericCardPool();
            //this.setHandler = new SetHandler();
            this.pairsHandler = new PairsHandler();
            //this.combatOutputCollector = new CombatOutputCollector();
            this.gameSettings = new GameSettings();

            this.outputChannel     = null;
            this.playerListMessage = null;

            this.waitingTokenSource = null;
        }
Ejemplo n.º 2
0
        public Task StartNewGame(Room room, CommandContext ctx)
        {
            this.curMaxMana  = this.gameSettings.startingMana;
            this.amountReady = 0;

            CardPool pool = new CardPool();

            pool.FillCardPoolWithSets(this.gameSettings.setAmount, BotHandler.setHandler);

            this.players.Clear();
            this.currentRound = 1;
            foreach (var id in room.players)
            {
                if (room.nicknames.ContainsKey(id))
                {
                    this.players.Add(id, new Player(room.nicknames[id]));
                }
                else
                {
                    this.players.Add(id, new Player());
                }

                this.players[id].pool    = new CardPool(pool);
                this.players[id].maxMana = this.curMaxMana;
                this.players[id].shop.Refresh(this, this.players[id].pool, this.players[id].maxMana);
                this.players[id].curMana = this.curMaxMana;
                this.players[id].lives   = this.gameSettings.startingLives;

                this.players[id].ready = false;
            }

            //calls the next pairs method
            this.pairsHandler = new PairsHandler(this);
            this.pairsHandler.NextRoundPairs(this);

            return(Task.CompletedTask);

            //do other stuff like matching later
        }