internal override void Act(Card card, TokenActionEventArgs e) { base.Act(card, e); Player player = e.Actee as Player; // Already been cancelled -- don't need to process this one if (e.Cancelled || !e.Actee.Hand.Contains(card) || e.HandledBy.Contains(card.CardType)) { return; } // Bane token/card only protects against other attackers if (player == e.Actor) { return; } Choice choice = Choice.CreateYesNoChoice(String.Format("Reveal Bane card {0} to block gaining a Curse card?", card.Name), card, e.ActingCard, player, e); ChoiceResult result = player.MakeChoice(choice); if (result.Options[0] == "Yes") { player.AddCardInto(DeckLocation.Revealed, e.Actee.RetrieveCardFrom(DeckLocation.Hand, card)); e.Cancelled = true; player.AddCardInto(DeckLocation.Hand, e.Actee.RetrieveCardFrom(DeckLocation.Revealed, card)); } e.HandledBy.Add(card.CardType); }
private void token_TokenAction(object sender, TokenActionEventArgs e) { e.Actor._Game.Table.Supplies[this].Tokens.ForEach(delegate(Token t) { if (t.ActDefined) { t.Act(this, e); } }); }
internal override void Act(Card card, TokenActionEventArgs e) { base.Act(card, e); Player player = e.Actee as Player; // Already been cancelled -- don't need to process this one if (e.Cancelled || !e.Actee.Hand.Contains(card) || e.HandledBy.Contains(card.CardType)) return; // Bane token/card only protects against other attackers if (player == e.Actor) return; Choice choice = Choice.CreateYesNoChoice(String.Format("Reveal Bane card {0} to block gaining a Curse card?", card.Name), card, e.ActingCard, player, e); ChoiceResult result = player.MakeChoice(choice); if (result.Options[0] == "Yes") { player.AddCardInto(DeckLocation.Revealed, e.Actee.RetrieveCardFrom(DeckLocation.Hand, card)); e.Cancelled = true; player.AddCardInto(DeckLocation.Hand, e.Actee.RetrieveCardFrom(DeckLocation.Revealed, card)); } e.HandledBy.Add(card.CardType); }
/// <summary> /// Fires off the TokenAction event, so any listeners can pick it up. /// </summary> /// <param name="actor">The acting player (the one playing the card)</param> /// <param name="actingCard">The card that triggered the TokenAction event</param> /// <returns>"true" if the TokenAction can proceed (wasn't blocked). "false" if the TokenAction was blocked.</returns> public Boolean TokenActOn(Player actor, Card actingCard) { if (TokenActedOn != null) { TokenActionEventArgs taea = new TokenActionEventArgs(actor, this, actingCard); TokenActedOn(this, taea); return !taea.Cancelled; } return true; }