static public async Task Act(TargetSpaceCtx ctx) { // "Drown 1 explorer, 1 town, 1 dahan" // find Ocean's Hungry Grasp spirit var ocean = ctx.Self as Ocean ?? ctx.GameState.Spirits.Single(x => x is Ocean); // find place to drown then var drowningOcean = ocean.Presence .Spaces.First() // find any space the ocean has presnece .Board.Ocean; // find the Ocean space on that board // drown 1 explorer, 1 town, and 1 dahan // drown 1 explorer ( drop 1 explorer in the ocean to drown ) var explorerToDrown = ctx.Tokens.OfType(Invader.Explorer).Cast <HealthToken>().OrderBy(x => x.StrifeCount).FirstOrDefault(); if (explorerToDrown != null) { await ctx.Move(explorerToDrown, ctx.Space, drowningOcean); } // drop town in the ocean to drown var townToDrown = ctx.Tokens.OfType(Invader.Town).Cast <HealthToken>() .OrderByDescending(x => x.FullHealth) // items with most health - usually are all the same .ThenBy(x => x.Damage) // pick least damaged .FirstOrDefault(); if (townToDrown != null) { await ctx.Move(townToDrown, ctx.Space, drowningOcean); } await ctx.DestroyDahan(1); // destroying dahan is the same as drowning them }
static async Task PushAllTokensTo(TargetSpaceCtx ctx, TargetSpaceCtx destination, params HealthTokenClass[] groups) { while (ctx.Tokens.HasAny(groups)) { await ctx.Move(ctx.Tokens.OfAnyType( groups ).First(), ctx.Space, destination.Space); } }
async Task Gather_Inner(Present present) { SpaceToken[] options; while (0 < (options = GetOptions(RemainingTypes)).Length) { var source = await ctx.Decision(Select.TokenFromManySpaces.ToGather(sharedGroupCounts.Where(g => g.count > 0), ctx.Space, options, present)); if (source == null) { break; } await ctx.Move(source.Token, source.Space, ctx.Space); --sharedGroupCounts[indexLookupByClass[source.Token.Class]].count; } }
static public async Task ActAsync(TargetSpaceCtx ctx) { // 1 fear if invaders are present. if (ctx.HasInvaders) { ctx.AddFear(1); } // For each disease, Push 2 explorer / town / dahan. await ctx.Pusher .AddGroup(ctx.Disease.Count, Invader.Explorer, Invader.Town, TokenType.Dahan) .AddCustomMoveAction(async(_, from, to) => { // 1 disease may move with each Pushed piece. var option = new SpaceToken(from, TokenType.Disease); var diseaseToken = await ctx.Decision(Select.TokenFromManySpaces.ToGather(1, to, new[] { option }, Present.Done)); if (diseaseToken != null) { await ctx.Move(option.Token, option.Space, to); } }) .MoveN(); }