Пример #1
0
        public void PlayerStealCard(Player player, Card card, bool revealCard)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();
            if(!owner.RemoveCardFromHand(card))
                if(!owner.RemoveCardFromTable(card as TableCard))
                    throw new InvalidOperationException();

            player.AddCardToHand(card);
            game.Session.EventManager.OnPlayerStoleCard(player, owner, card, revealCard);
            owner.CheckEmptyHand();
        }
Пример #2
0
 public ReadOnlyCollection<Card> PlayerDrawFromGraveyard(Player player, int count)
 {
     List<Card> drawn = new List<Card>(count);
     for(int i = 0; i < count; i++)
     {
         Card card = PopCardFromGraveyard();
         player.AddCardToHand(card);
         drawn.Add(card);
     }
     game.Session.EventManager.OnPlayerDrewFromGraveyard(player, drawn);
     return new ReadOnlyCollection<Card>(drawn);
 }
Пример #3
0
 public void PlayerPickFromSelection(Player player, Card card, bool revealCard)
 {
     if(selectionOwner != null && selectionOwner != player)
         throw new InvalidOperationException();
     if(!selection.Remove(card))
         throw new InvalidOperationException();
     player.AddCardToHand(card);
     game.Session.EventManager.OnPlayerPickedFromSelection(player, card, selectionOwner == null || revealCard);
 }
Пример #4
0
 public ReadOnlyCollection<Card> PlayerDrawFromDeck(Player player, int count, bool revealCards = false)
 {
     List<Card> drawn = new List<Card>(count);
     for(int i = 0; i < count; i++)
     {
         Card card = PopCardFromDeck();
         player.AddCardToHand(card);
         drawn.Add(card);
     }
     game.Session.EventManager.OnPlayerDrewFromDeck(player, drawn, revealCards);
     return new ReadOnlyCollection<Card>(drawn);
 }