static public async Task ActAsync(TargetSpaceCtx ctx) { // 1 fear. ctx.AddFear(1); // up to 3 Damaged Invaders do not participate in Ravage. var doNotParticipate = new SpaceAction( "up to 3 damaged Invaders do not participate in Ravage", SelectUpTo3DamagedInvadersToNotParticipate ); // Defend 1 per presence you have in target land (when this Power is used). var defend = new SpaceAction( "Defend 1 per presence you have in target land", // (when power is used) ctx => ctx.Defend(ctx.Presence.Count) ); await ctx.SelectActionOption(doNotParticipate, defend); }
static async Task TargetSpiritAction(SelfCtx ctx, bool doBoth) { // Note - not strictly following rules - altering to allow presence in any spot that has presence. // Presence placed in an illegal land will allow adding more there, although it technically shouldn't. string joinStr = doBoth ? "AND" : "OR"; var spaceCtx = await ctx.TargetLandWithPresence($"Select location to Remove Blight {joinStr} Add Presence"); var removeBlight = new SpaceAction("Remove 1 blight from one of your lands", spaceCtx => spaceCtx.RemoveBlight()); var addPresence = new SpaceAction("Add 1 presence to one of your lands", spaceCtx => spaceCtx.Presence.PlaceHere()); if (!doBoth) { await spaceCtx.SelectActionOption(removeBlight, addPresence); } else { await removeBlight.Execute(spaceCtx); await addPresence.Execute(spaceCtx); } }
public async Task EachPlayerTakesActionInALand(SpaceAction action, Func <TargetSpaceCtx, bool> filter, bool differentLands = false) { var used = new List <Space>(); foreach (var spiritCtx in Spirits) { var spaceOptions = GameState.Island.AllSpaces .Where(s => filter(spiritCtx.Target(s))) .Except(used) .ToArray(); var spaceCtx = await spiritCtx.SelectSpace(action.Description, spaceOptions); if (spaceCtx == null) { continue; } if (differentLands) { used.Add(spaceCtx.Space); } await action.Execute(spaceCtx); } }