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)); }
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)); }
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)); }
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); }
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); } }
public static Task Attack(this IActionHost host, Func <IActionHost, Task> act) { return(host.AllPlayers(target => target.Player != host.Player, act, true)); }
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)); }
public static Task OtherPlayers(this IActionHost host, Func <IActionHost, Task> act, bool isAttack = false) { return(host.AllPlayers(target => target.Player != host.Player, act, isAttack)); }