public override void Resolve(TurnContext context, ICard source) { var estate = context.ActivePlayer.Hand.OfType <Estate>().FirstOrDefault(); Action discardAction = () => { context.AvailableSpend += 4; context.DiscardCard(context.ActivePlayer, estate); }; Action gainAction = () => new GainUtility(context, context.ActivePlayer).Gain <Estate>(); if (estate != null) { var activity = Activities.ChooseYesOrNo (context.Game.Log, context.ActivePlayer, "Discard an Estate?", source, discardAction, gainAction); _activities.Add(activity); } else { gainAction(); } }
public override void Attack(Player victim, TurnContext context, ICard source) { var copper = victim.Hand.FirstOrDefault(c => c is Copper); if (copper != null) { context.DiscardCard(victim, copper); } else { context.Game.Log.LogRevealHand(victim); } }
public override void Attack(Player victim, TurnContext context, ICard source) { var curseInHand = victim.Hand.OfType <Curse>().FirstOrDefault(); if (curseInHand == null) { GainCopperAndCurse(victim, context); } else { var activity = Activities.ChooseYesOrNo(context.Game.Log, victim, "Discard a curse?", source, () => context.DiscardCard(victim, curseInHand), () => GainCopperAndCurse(victim, context)); _activities.Add(activity); } }