public Turn(Player owner) { Owner = owner; Possessor = null; IsRepeatable = true; ActionsRemaining = BuysRemaining = 1; TreasureRemaining = 0; Phase = Phases.Action; CardsInPlay = new List<Card>(); CardsPlayed = new List<Card>(); TurnNumber = 1; }
/// <summary> /// The targeted player reveals a card /// </summary> /// <param name="revealer">The player revealing the card</param> /// <param name="card">The card being revealed</param> public void RevealCard(Player revealer, Card card) { _game.NotifyPlayers(p => p.OnRevealCard(revealer, card)); }
/// <summary> /// The targeted player puts a card on top of his deck /// </summary> /// <param name="target"></param> /// <param name="card"></param> public void PutCardOnDeck(Player target, Card card) { _game.NotifyPlayers( p => p.OnPutCardOnDeck(target, card), p => p.OnPutCardOnDeckNotVisible(target)); target.Deck.AddToTop(card); }
/// <summary> /// The targeted player gains a card /// </summary> /// <param name="target">The player gaining the card</param> /// <param name="code">The card being gained</param> /// <returns></returns> public Card GainCard(Player target, CardCode code) { if (!Supplies.HasSupply(code)) throw new ArgumentOutOfRangeException("Supply piles do not include " + code.ToString()); Card retval = null; CardContainer pile = Supplies[code]; if (pile.Count > 0) { retval = pile.Draw(); } _game.NotifyPlayers(p => p.OnGainCard(target, code)); return retval; }
/// <summary> /// Signals when a player puts a card on his/her deck /// </summary> /// <param name="player">The player moving the card to his deck</param> /// <param name="cardOnDeck">The card being moved</param> public abstract void OnPutCardOnDeck(Player player, Card cardOnDeck);
/// <summary> /// Signals when a Possession turn starts /// </summary> /// <param name="possessingPlayer">The player who is doing the possessing</param> /// <param name="possessedPlayer">The possessed</param> public abstract void OnPossessedTurnStart(Player possessingPlayer, Player possessedPlayer);
public Turn(Player owner, Player possessor, bool isRepeatable = false) : this(owner) { Possessor = possessor; IsRepeatable = isRepeatable; }
/// <summary> /// Indicated player draws cards from his own deck /// </summary> /// <param name="p"></param> /// <param name="count"></param> /// <returns></returns> public IList<Card> DrawCards(Player drawer, int count = 1) { return DrawCards(drawer, drawer.Deck, count); }
/// <summary> /// Signals when a player has drawn some cards /// </summary> /// <param name="drawingPlayer">The player drawing the cards</param> /// <param name="drawnCards">The cards drawn</param> public abstract void OnDrawCards(Player drawingPlayer, IList<Card> drawnCards);
/// <summary> /// Signals when a new turn starts /// </summary> /// <param name="activePlayer">The player who's turn it now is</param> public abstract void OnTurnStart(Player activePlayer);
/// <summary> /// Signals when a turn ends. /// </summary> /// <param name="activePlayer">The player who's turn just ended</param> public abstract void OnTurnEnd(Player activePlayer);
/// <summary> /// Signals when a player shuffles his deck /// </summary> /// <param name="shuffler">The player doing the shuffling</param> public abstract void OnShuffleDeck(Player shuffler);
/// <summary> /// Signals when a player reveals his/her hand /// </summary> /// <param name="revealingPlayer">The revealing player</param> /// <param name="revealedCards">The revealed cards</param> public abstract void OnRevealHand(Player revealingPlayer, IList<Card> revealedCards);
/// <summary> /// Signals when a player reveals a card /// </summary> /// <param name="revealingPlayer">The revealing player</param> /// <param name="revealedCard">The card revealed</param> public abstract void OnRevealCard(Player revealingPlayer, Card revealedCard);
/// <summary> /// Signals when a player puts a card on his/her deck but that card is not visible /// </summary> /// <param name="player"></param> public abstract void OnPutCardOnDeckNotVisible(Player player);
/// <summary> /// The targeted player reveals his hand /// </summary> /// <param name="target">The hand revealer</param> public void RevealHand(Player target) { _game.NotifyPlayers(p=> p.OnRevealHand(target, target.Hand.ToList())); }
/// <summary> /// The targeted player shuffles his deck /// </summary> /// <param name="target">The deck shuffler</param> public void ShuffleDeck(Player target) { target.Deck.Shuffle(); _game.NotifyPlayers(p => p.OnShuffleDeck(target)); }
/// <summary> /// Signals when a player has drawn some cards, but those cards are not visible /// </summary> /// <param name="drawingPlayer"></param> /// <param name="count"></param> public abstract void OnDrawCardsNotVisible(Player drawingPlayer, int count);
public IList<Card> DrawCards(Player drawer, CardContainer deck, int count = 1) { IList<Card> retval = deck.Draw(count); _game.NotifyPlayers( p => p.OnDrawCards(drawer, retval), p => p.OnDrawCardsNotVisible(drawer, count)); return retval; }
/// <summary> /// Signals when a player gains a card /// </summary> /// <param name="gainingPlayer">The player gaining the card</param> /// <param name="gainedCardCode">The card code gained</param> public abstract void OnGainCard(Player gainingPlayer, CardCode gainedCardCode);