Beispiel #1
0
        public void PlayerPlayCardOnTable(TableCard card)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();
            if(!owner.RemoveCardFromHand(card))
                throw new InvalidOperationException();

            owner.AddCardToTable(card);
            game.Session.EventManager.OnPlayerPlayedCardOnTable(owner, card);
            owner.CheckEmptyHand();
        }
Beispiel #2
0
 public bool RemoveCardFromTable(TableCard card)
 {
     return table.Remove(card);
 }
Beispiel #3
0
        public void PassTableCard(TableCard card, Player targetPlayer)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();
            if(!owner.RemoveCardFromHand(card))
                if(!owner.RemoveCardFromTable(card))
                    throw new InvalidOperationException();

            targetPlayer.AddCardToTable(card);
            game.Session.EventManager.OnPassedTableCard(owner, card, targetPlayer);
            owner.CheckEmptyHand();
        }
Beispiel #4
0
 public void AddCardToTable(TableCard card)
 {
     if(card == null)
         return;
     card.Owner = this;
     table.Add(card);
 }