public static async Task ActAsync(SelfCtx ctx) { await ctx.SelectActionOption( GainEnergy, ConvertEnergyToDamage, // if you have 2 sun,3 fire: You may do both. Cmd.Multiple( "Do Both", GainEnergy, ConvertEnergyToDamage ) .FilterOption(await ctx.YouHave("2 sun,3 fire")) ); }
static Task RemoveTokenChoice(SelfCtx ctx, int count, params TokenClass[] interiorGroup) { // !! It would be easier on the player if we could 'flatten' this to just the 'remove' step so they don't have to analyze what is on a beast space or adjacent to one. var landsWithBeasts = ctx.GameState.Island.AllSpaces .Where(s => ctx.GameState.Tokens[s].Beasts.Any) .ToArray(); return(ctx.SelectActionOption( new SelfAction("Remove 1 explorer & 1 town from a land with beast", spiritCtx => { return spiritCtx.RemoveTokenFromOneSpace(landsWithBeasts, count, Invader.Explorer, Invader.Town); }), new SelfAction("Remove 1 " + interiorGroup.Select(x => x.Label).Join("/") + " from a land adjacent to beast", spiritCtx => { var spaceOptions = landsWithBeasts .SelectMany(s => s.Adjacent) .Distinct() .Where(s => spiritCtx.GameState.Tokens[s].HasAny(interiorGroup)); return spiritCtx.RemoveTokenFromOneSpace(spaceOptions, 1, interiorGroup); }) )); }