Beispiel #1
0
        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);
        }
Beispiel #2
0
            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);
            }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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;
        }