Exemplo n.º 1
0
        public static void StartAttackEvent(long playerIndex, long sId)
        {
            if (playerIndex != _playerOnTurn)
            {
                throw new IllegalMessageReceivedException("AttackEvent recebido por jogador não permitido.");
            }

            Card attacker = CardsOnBoard[_playerOnTurn].Find(x => x.ServerId == sId);

            if (attacker == null)
            {
                throw new CardNotFoundException();
            }

            if (!attacker.CanAttack())
            {
                throw new IllegalGameEventException("Carta que não pode atacar tentou começar ataque.");
            }

            ServerSendData.SendStartSelectTarget(_playerOnTurn);
            AvailablePlaysVerifier.CheckAttackTargets(_playerOnTurn, CardsOnBoard[_playerOnTurn == 0 ? 1 : 0]);

            _cardSelectCaller       = attacker;
            OnCardSelectedCallback += StartAttackResponse;
        }
Exemplo n.º 2
0
        public static void InitializeGame()
        {
            _playerOnTurn = 0;
            ServerSendData.SendSetTurn(0, 1);
            ServerSendData.SendSetTurn(1, 0);
            CreateHeros();

            //FIXME: Temp code for testing purposes

            AddToGame(Database.GetCard(5, 0), 0);
            AddToGame(Database.GetCard(2, 0), 0);
            AddToGame(Database.GetCard(2, 0), 0);
            AddToGame(Database.GetCard(3, 0), 0);
            AddToGame(Database.GetCard(1, 0), 0);
            AddToGame(Database.GetCard(2, 0), 0);
            AddToGame(Database.GetCard(3, 0), 0);
            AddToGame(Database.GetCard(1, 0), 0);

            AddToGame(Database.GetCard(5, 1), 1);
            AddToGame(Database.GetCard(2, 1), 1);
            AddToGame(Database.GetCard(2, 1), 1);
            AddToGame(Database.GetCard(3, 1), 1);
            AddToGame(Database.GetCard(1, 1), 1);
            AddToGame(Database.GetCard(2, 1), 1);
            AddToGame(Database.GetCard(3, 1), 1);
            AddToGame(Database.GetCard(1, 1), 1);

            DrawCardTo(0, 3);
            DrawCardTo(1, 4);
            SetTotalMana(0, 1);
            SetAvailableMana(0, 1);
            SetTotalMana(1, 0);

            AvailablePlaysVerifier.CheckHandPlays(0, PlayerList[0], CardsOnHand[0]);
        }
Exemplo n.º 3
0
 public static void CheckAvailableMoves()
 {
     AvailablePlaysVerifier.CheckHandPlays(_playerOnTurn, PlayerList[_playerOnTurn], CardsOnHand[_playerOnTurn]);
     AvailablePlaysVerifier.CheckBoardPlays(_playerOnTurn, CardsOnBoard[_playerOnTurn]);
 }