public void SetAsideTheDrawnCards(IActionScope scope) { var action = DrawnCards.First(); DrawnCards.Remove(action); SetAsideCards.Add(action, scope); }
public void GainCardFromSupply(Card typeToGain, IActionScope turnScope) { Card gainedCard = turnScope.Supply.AcquireCard(typeToGain, turnScope); turnScope.Publish(new PlayerGainedCardEvent(gainedCard, turnScope)); DiscardPile.Discard(gainedCard, turnScope); }
public CardSet Draw(int cardCount, IActionScope turnScope) { var cardSet = new CardSet(); cardCount.Times(() => cardSet.Add(Draw(turnScope), turnScope)); return(cardSet); }
public void ShuffleDiscardPileIntoDeck(IActionScope turnScope) { DiscardPile.Into(Deck, turnScope); Deck = Deck.Shuffle(); turnScope.Publish(new DeckReplenishedEvent(turnScope)); }
public IEventResponse HandleGameEvent(IGameMessage @event, IActionScope scope) { var aiContext = Mapper.Map <IGameMessage, AiContext>(@event); var votes = _root.Evaluate(aiContext); votes = votes.VoteFor(@event.GetDefaultResponse(), 1); return(votes.Winner); }
public PlayerGainedCardEvent(CardType card, IActionScope turnScope) : base(turnScope) { _card = card; Description = String.Format("{0}: gained {1}", (turnScope == null || turnScope.Player == null) ? "none" : turnScope.Player.Name, card.Create().Name); }
public void Discard(Card card, DiscardPile discardPile, IActionScope scope) { if (this.Contains(card)) { InnerList.Remove(card); discardPile.Discard(card, scope); } }
public void PlayCard(Card cardToPlay, CardSet cardsInPlay, IActionScope turnScope) { if (this.Contains(cardToPlay)) { InnerList.Remove(cardToPlay); cardsInPlay.Add(cardToPlay, turnScope); } }
public SelectReplacementCardForSaboteur(IActionScope scope, Card trashedCard) : base(scope) { Description = scope.Player.Name + ", select a card to replace the trashed card (" + trashedCard.Name + ")"; GetAvailableResponses = () => scope.Supply.FindCardsCostingUpTo(scope.GetPrice(trashedCard) - 2, scope) .OrderByDescending(scope.GetPrice) .Select(c => new ReplaceCardForSaboteur(scope, c)); }
public TrashTreasureCardFromThief(IActionScope scope, IActionScope reactionScope, Card item) : base(scope, item) { Description = "Trash " + item.Name + " [Thief]"; _reactionScope = reactionScope; GetAvailableResponses = () => new List <IEventResponse> { this }; }
public void DiscardInto(DiscardPile discardPile, IActionScope turnScope) { this.ToList().ForEach(card => { Remove(card); discardPile.Discard(card, turnScope); }); }
public CardSet FindCardsCostingUpTo(Money maxCost, IActionScope scope) { var eligibleCards = this.Select(x => x.Value) .Where(t => t.Type.Create().BaseCost <= maxCost && t.Count > 0) .Select(z => z.Type.Create()); return(new CardSet(eligibleCards)); }
public ReplaceCardForSaboteur(IActionScope scope, Card card) : base(scope, card) { if (card == null) { throw new ArgumentNullException("card"); } Description = "Replace trashed card with " + card.Name + ". [Saboteur]"; }
public ChooseWhetherToGainTrashedTreasureForThief(IActionScope turnScope, Card item) : base(turnScope, item) { Description = turnScope.Player.Name + ", would you like to gain the trashed treasure: " + item.Name + " [Thief]"; GetAvailableResponses = () => new List <IEventResponse> { new GainTrashedTreasureForThief(turnScope, Item), new DoNotGainTrashedTreasureForThief(turnScope, Item) }; }
public PlayerRevealedCardEvent(IActionScope actionScope, Card card) : base(actionScope) { if (card == null) { throw new ArgumentNullException("card"); } _card = card; }
public DoYouWantToTrashMiningVillage(IActionScope scope) : base(scope) { Description = scope.Player.Name + ", trash Mining Village for (+2)?"; GetAvailableResponses = () => new List <IEventResponse> { new TrashMiningVillage(scope), new DoNotTrashMiningVillage(scope) }; }
public ChooseWhetherToPutDeckInDiscardPileFromChancellor(IActionScope scope) : base(scope) { Description = "Place deck in discard pile [Chancellor]?"; GetAvailableResponses = () => new List <IEventResponse> { new PlaceDeckInDiscardPileForChancellor(scope), new DoNotPlaceDeckInDiscardPileForChancellor(scope) }; }
public void Into(CardSet targetCardSet, IActionScope turnScope) { InnerList.ToList().ForEach( c => { targetCardSet.Add(c, turnScope); Remove(c); }); }
public IEventResponse HandleGameEvent(IGameMessage @event, IActionScope scope) { if ([email protected]().Any()) { return(@event.GetDefaultResponse()); } return(_ai.HandleGameEvent(@event, scope)); }
public void Add(Card card, IActionScope turnScope) { if (card == null) { return; } InnerList.Add(card); OnCardAdded(card, turnScope); }
public IEventResponse HandleGameEvent(IGameMessage @event, IActionScope scope) { if (@event.GetAvailableResponses().Count() == 1) { return(@event.GetDefaultResponse()); } //DisplayTurnInfo(scope); return(HandleGameEvent(@event, @event.GetAvailableResponses(), scope)); }
public Card RevealCardFromTopOfDeck(IActionScope turnScope) { var card = Deck.Draw(turnScope); if (card != null) { turnScope.Publish(new PlayerRevealedCardEvent(turnScope, card)); } return(card); }
public void Handle(IGameMessage message, IActionScope turnScope) { if (message is IPlayerScoped && turnScope.Player != this) { return; } _controller.HandleGameEvent(message, turnScope).Execute(); Hand.Handle(message, turnScope); }
public ChooseToDiscardOrReturnTopCardFromSpy(IActionScope scope, IActionScope reactionScope) : base(scope) { var card = reactionScope.RevealCardFromDeck(); Description = reactionScope.Player.Name + " revealed " + card.Name + " [Spy]"; GetAvailableResponses = () => new List <IEventResponse> { new DiscardTopCardFromSpyResponse(scope, reactionScope, card), new ReturnTopCardFromSpyResponse(scope, reactionScope, card) }; }
public Card Draw(IActionScope turnScope) { if (Count > 0) { Count--; if (Count == 0) { _eventAggregator.Publish(new SupplyPileDepletedEvent(this.Type, turnScope)); } return(Type.Create()); } throw new SupplyEmptyException(); }
public Card Draw(IActionScope turnScope) { if (!InnerList.Any()) { turnScope.Player.Handle(new DeckDepletedEvent(turnScope), turnScope); } if (InnerList.Any()) { var drawn = InnerList[0]; InnerList.RemoveAt(0); return(drawn); } return(null); }
public void ShuffleDiscardPileIntoDeck(IActionScope turnScope) { }
public void Discard(CardSet cardsToDiscard, IActionScope turnScope) { }
public void TrashCardFromHand(Card cardToTrash, IActionScope scope) { }
public void GainCardFromSupply(Card card, IActionScope turnScope) { }