예제 #1
0
 public static Task OnePlayer(this IActionHost host, string player, Action <IActionHost> act, bool isAttack = false)
 {
     return(host.AllPlayers(target => target.Player == player, target =>
     {
         act(target);
         return Task.CompletedTask;
     }, isAttack));
 }
예제 #2
0
 public static Task Attack(this IActionHost host, Action <IActionHost> act)
 {
     return(host.AllPlayers(target => target.Player != host.Player, target =>
     {
         act(target);
         return Task.CompletedTask;
     }, true));
 }
예제 #3
0
 public static Task OtherPlayers(this IActionHost host, Action <IActionHost> act, bool isAttack = false)
 {
     return(host.AllPlayers(target => target.Player != host.Player, host =>
     {
         act(host);
         return Task.CompletedTask;
     }, isAttack));
 }
예제 #4
0
파일: Spy.cs 프로젝트: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(1);
            host.AddActions(1);

            await host.AllPlayers(async target =>
            {
                var revealed = target.Reveal(Zone.DeckTop(1)).SingleOrDefault();
                if (revealed != null)
                {
                    var subject = host == target ? "<run>Do you want</run>" : $"<run>Force</run><player>{target.Player}</player>";
                    if (await host.YesNo("Spy", $@"{subject}
                        <run>to discard</run>
                        <card suffix='?'>{revealed.Name}</card>"))
                    {
                        target.Discard(revealed, Zone.Deck);
                    }
                }
            }, isAttack : true);
        }
예제 #5
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(2);

            var selections = new Dictionary <IActionHost, string>();
            await host.AllPlayers(async player =>
            {
                var selected       = await player.SelectCard("Choose a card to pass to your left.", Zone.Hand);
                selections[player] = selected.Name;
            });

            foreach (var kvp in selections)
            {
                kvp.Key.PassCard(kvp.Key.GetPlayerToLeft(), kvp.Value);
            }

            var trashed = await host.SelectCards("Choose up to one card to trash.", Zone.Hand, 0, 1);

            if (trashed.Any())
            {
                host.Trash(trashed);
            }
        }
예제 #6
0
 public static Task Attack(this IActionHost host, Func <IActionHost, Task> act)
 {
     return(host.AllPlayers(target => target.Player != host.Player, act, true));
 }
예제 #7
0
 public static Task OnePlayer(this IActionHost host, string player, Func <IActionHost, Task> act, bool isAttack = false)
 {
     return(host.AllPlayers(target => target.Player == player, act, isAttack));
 }
예제 #8
0
 public static Task OtherPlayers(this IActionHost host, Func <IActionHost, Task> act, bool isAttack = false)
 {
     return(host.AllPlayers(target => target.Player != host.Player, act, isAttack));
 }