public static IActivity ChooseYesOrNo(IGameLog log, Player player, string message, ICard source, Action ifYes, Action ifNo) { var choiceActivity = new ChoiceActivity(log, player, message, source, Choice.Yes, Choice.No); choiceActivity.ActOnChoice = c => { if (c == Choice.Yes) { if (ifYes != null) { ifYes(); } } else { if (ifNo != null) { ifNo(); } } }; return(choiceActivity); }
public override void Resolve(TurnContext context) { var choiceActivity = new ChoiceActivity(context, context.ActivePlayer, "Choose from: Draw 3 cards, gain 2 actions", Choice.DrawCards, Choice.GainActions); choiceActivity.ActOnChoice = c => Execute(context, c); _activities.Add(choiceActivity); }
public static IActivity GainOpponentsCardChoice(TurnContext context, Card card, Player cardOwner) { var activity = new ChoiceActivity(context, context.ActivePlayer, string.Format("Gain {0}'s {1}?", cardOwner.Name, card), Choice.Yes, Choice.No); activity.ActOnChoice = choice => { if (choice == Choice.Yes) { card.MoveTo(context.ActivePlayer.Discards); context.Game.Log.LogGain(context.ActivePlayer, card); } }; return activity; }
public static IActivity GainOpponentsCardChoice(TurnContext context, Card card, Player cardOwner, ICard source) { var activity = new ChoiceActivity(context, context.ActivePlayer, string.Format("Gain {0}'s {1}?", cardOwner.Name, card), source, Choice.Yes, Choice.No); activity.ActOnChoice = choice => { if (choice == Choice.Yes) { card.MoveTo(context.ActivePlayer.Discards); context.Game.Log.LogGain(context.ActivePlayer, card); } }; activity.Hint = ActivityHint.GainCards; return(activity); }
public static IActivity ChooseYesOrNo(IGameLog log, Player player, string message, Action ifYes, Action ifNo) { var choiceActivity = new ChoiceActivity(log, player, message, Choice.Yes, Choice.No); choiceActivity.ActOnChoice = c => { if (c == Choice.Yes) { if (ifYes != null) ifYes(); } else { if(ifNo != null) ifNo(); } }; return choiceActivity; }