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(); }
public bool RemoveCardFromTable(TableCard card) { return table.Remove(card); }
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(); }
public void AddCardToTable(TableCard card) { if(card == null) return; card.Owner = this; table.Add(card); }