public void Switch(CardId atackingCard)
        {
            string            cardName      = atackingCard.CardName;
            PlayerIndentifier choosenPlayer = atackingCard.PlayerIdentifier;

            foreach (var card in this.battlefield.cardsOnField)
            {
                if (card.GetType().Name == cardName)
                {
                    card.SwitchPosition();
                    break;
                }
            }
        }
        public void Play(CardId atackingCard)
        {
            string            cardName      = atackingCard.CardName;
            PlayerIndentifier choosenPlayer = atackingCard.PlayerIdentifier;

            var hand = choosenPlayer == (PlayerIndentifier)1 ? playerOne.YuGiOhCardInHand : playerTwo.YuGiOhCardInHand;
            var card = hand.FirstOrDefault(c => c.GetType().Name == cardName);

            if (card == null)
            {
                throw new ArgumentNullException("card to play needed");
            }

            this.battlefield.cardsOnField.Add(card);
            this.playerOne.SendCardToField(card);
        }
Exemplo n.º 3
0
 public CardId(string cardName, PlayerIndentifier playerIdentifier)
 {
     this.CardName         = cardName;
     this.PlayerIdentifier = playerIdentifier;
 }
Exemplo n.º 4
0
 public CardId(string cardName, PlayerIndentifier playerIdentifier)
 {
     this.CardName = cardName;
     this.PlayerIdentifier = playerIdentifier;
 }