public void SeedInitialCard(CardData forCard) { PlayingCard newCard = GeneratePlayingCard(forCard); newCard.SetCoordinate(new Coordinate(0, 0), DegreesOfSpeed.Instantly); PlayedCards.Add(newCard); CurrentPlayField.SetCard(forCard, new Coordinate(0, 0)); }
public string PlayCard(int cardIndex) { var card = Hand[cardIndex]; PlayedCards.Add(WebUtility.HtmlEncode(Hand[cardIndex])); Hand.RemoveAt(cardIndex); return(card); }
public void SetCard(CardData forCard, Coordinate onCoordinate) { ValidPlayableSpacesCache = null; NotHappyCoordinatesCache.Add(onCoordinate); HappyCoordinatesAreDirty = true; if (PlayedCards.ContainsKey(onCoordinate)) { PlayedCards[onCoordinate] = forCard; } else { PlayedCards.Add(onCoordinate, forCard); } }
public void ExecuteTurn(ICardPool pool) { Hand.DiscardTo(DiscardPile); PlayedCards.DiscardTo(DiscardPile); FillHand(); while (Hand.Any()) { var card = Hand[0]; Hand.RemoveAt(0); card.Play(this, null, pool); PlayedCards.Add(card); } var availableFunds = PlayedCards.Select(c => c.EType).Concat(new [] { Element.Free }).GroupBy(e => e).ToDictionary(g => g.Key, g => g.Count()); DiscardPile.AddRange(pool.BuyAll(availableFunds)); Console.WriteLine("Own {0} Cards:{1}", Collection.Count(), string.Join(", ", Collection.OrderBy(c => c.CardId).Select(c => c.ToString()))); }
public void Play(ICard card) { RunTriggeredAbilities(PlayerAction.Play, card.Name); Hand.Remove(card.Name); PlayedCards.Add(new PlayedCard(card)); switch (card) { case IAction a: NumberOfActions--; break; case ITreasure t: if (t is ITreasureAbilityHolder h) { h.ResolveTreasureAbilities(this); } MoneyPlayed += t.Value; break; } }
public void PlayWithoutCost(ICard card) { RunTriggeredAbilities(PlayerAction.Play, card.Name); Hand.Remove(card.Name); PlayedCards.Add(new PlayedCard(card)); }
public void PlayCard(Card card) { card.PeggingRound = PeggingRound; TurnPlayer.Alert = ""; if (PrevTurnPlayer != null) { PrevTurnPlayer.Alert = ""; } Count += card.Value; if (Count == 15) { TurnPlayer.TotalScore += 2; TurnPlayer.Alert = "Fifteen for 2"; Console.WriteLine(TurnPlayer.Name + ": Fifteen for 2"); } else if (Count == 31) { TurnPlayer.TotalScore += 2; TurnPlayer.Alert = "Thirty One for 2"; Console.WriteLine(TurnPlayer.Name + ": Thirty-One for 2"); EndOfRound(); } //TODO: Fix bug where scores happen between rounds (ie I finished a round with an 8 and the next card is an 8 in the following round, that shouldn't give you 2 points) if (PlayedCards.Count > 2 && card.Ordinal == PlayedCards[PlayedCards.Count - 3].Ordinal && card.Ordinal == PlayedCards[PlayedCards.Count - 2].Ordinal && card.Ordinal == PlayedCards[PlayedCards.Count - 1].Ordinal) { TurnPlayer.TotalScore += 12; TurnPlayer.Alert = TurnPlayer.Alert == ""? "Quads for 12!" : ", Quads for 12!"; Console.WriteLine(TurnPlayer.Name + ": Quads for 12"); } else if (PlayedCards.Count > 1 && card.Ordinal == PlayedCards[PlayedCards.Count - 2].Ordinal && card.Ordinal == PlayedCards[PlayedCards.Count - 1].Ordinal) { TurnPlayer.TotalScore += 6; TurnPlayer.Alert = TurnPlayer.Alert == "" ? "Trips for 6!" : ", Trips for 6!"; Console.WriteLine(TurnPlayer.Name + ": Trips for 6"); } else if (PlayedCards.Count > 0 && card.Ordinal == PlayedCards[PlayedCards.Count - 1].Ordinal) { TurnPlayer.TotalScore += 2; TurnPlayer.Alert = TurnPlayer.Alert == "" ? "Pair for 2!" : ", Pair for 2!"; Console.WriteLine(TurnPlayer.Name + ": Pair for 2"); } //TODO:runs if (PlayedCards.Count > 2) { } Console.WriteLine(TurnPlayer.Name + " played " + card.Name + " - Count: " + Count); PlayedCards.Add(card); if (PlayedCards.Count == 8 && Count != 31) { TurnPlayer.TotalScore += 1; TurnPlayer.Alert = "Last card for 1"; Console.WriteLine(TurnPlayer.Name + ": Last card for 1"); EndOfRound(); } //TODO: Win scenario //if(PrevTurnPlayer.TotalScore > 120) }