static public async Task ActAsync(TargetSpaceCtx ctx) { // 1 fear. ctx.AddFear(1); // 1 damage. await ctx.DamageInvaders(1); // You may pay 1 Energy to deal 1 Damage in an adjacent land. if (1 <= ctx.Self.Energy && await ctx.Self.UserSelectsFirstText("Pay 1 energy to deal 1 Damage in an adjacent land?", "Yes, pay 1 energy for 1 damage", "No, thank you")) { ctx.Self.Energy--; var adjInvaders = ctx.Adjacent.SelectMany(s => ctx.GameState.Tokens[s].Invaders().Select(t => new SpaceToken(s, t))).ToArray(); var adjInvader = await ctx.Decision(new Select.TokenFromManySpaces("Select invader for 1 damage", adjInvaders, Present.Always)); await ctx.Target(adjInvader.Space).Invaders.ApplyDamageTo1(1, (HealthToken)adjInvader.Token); } }
static async Task DistributeDamageToLands(TargetSpaceCtx ctx, List <Space> newDamageLands, int additionalDamage) { Space[] targetLandOptions; while (additionalDamage > 0 && (targetLandOptions = newDamageLands.Where(s => ctx.Target(s).HasInvaders).ToArray()).Length > 0 ) { var newLand = await ctx.Decision(new Select.Space($"Apply up to {additionalDamage} vengeanance damage in:", targetLandOptions, Present.Always)); if (newLand == null) { break; } int damage = await ctx.Self.SelectNumber("How many damage to apply?", additionalDamage, 0); await ctx.Target(newLand).DamageInvaders(damage); additionalDamage -= damage; } }
static public async Task Option4(TargetSpaceCtx ctx) { // In a land with blight and presence (Select a space, not necessarily the one you targetted with power (I guess...) var spacesWithPresenceAndBlight = ctx.Self.Presence.Spaces .Where(s => ctx.Target(s).HasBlight); var space = await ctx.Decision(new Select.Space($"Push all dahan, destroy invaders and beast, 1 blight", spacesWithPresenceAndBlight, Present.Always)); var spaceCtx = ctx.Target(space); // Push all Dahan await spaceCtx.PushDahan(int.MaxValue); // Destroy all invaders and Beasts var beasts = spaceCtx.Beasts; await beasts.Destroy(beasts.Count); await spaceCtx.Invaders.DestroyAny(int.MaxValue, Invader.Explorer, Invader.Town, Invader.City); // Add 1 blight await ctx.AddBlight(1); }
public static async Task ActAsync(TargetSpaceCtx ctx) { // 2 fear. 2 damage. ctx.AddFear(2); await ctx.DamageInvaders(2); // if no beasts are present, add beast. if (!ctx.Beasts.Any) { await ctx.Beasts.Add(1); } else { // otherwise, +2 Damage, await ctx.DamageInvaders(2); // and Push up to 1 beast. await ctx.PushUpTo(1, TokenType.Beast); } if (await ctx.YouHave("2 fire,3 animal")) { // 1 fear and ctx.AddFear(1); // destroy 1 explorer/town in an adjacent land with beast var tokens = ctx.Adjacent .Select(ctx.Target) .Where(x => x.Beasts.Any) .SelectMany(x => x.Tokens.OfType(Invader.Explorer) .Select(t => new SpaceToken(x.Space, t)) ) .ToArray(); var st = await ctx.Decision(new Select.TokenFromManySpaces("Destroy Explorer", tokens, Present.Always)); if (st != null) { await ctx.Target(st.Space).Invaders.Destroy(1, (HealthToken)st.Token); } } }
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(); }
static public async Task ActAsync(TargetSpaceCtx ctx) { // Choose a type of token from badlands / beast / disease / strife / wilds that exists in an adjacent land; var candidates = FindHazardTokenInAdjacentLand(ctx); if (candidates.Length == 0) { return; } var tokenChoice = (await ctx.Decision(new Select.TokenFromManySpaces("Select hazard to add to " + ctx.Space.Label, candidates, Present.Always))).Token; // choosing disease costs 1 energy. if (tokenChoice == TokenType.Disease) { ctx.Self.Energy--; } // Add 1 of that type of token to target land. if (tokenChoice is HealthToken ht && 0 < ht.StrifeCount) { await ctx.AddStrife(); }
private static async Task DoFireDamageToMultipleTargets(TargetSpaceCtx ctx, int fireDamage) { await ctx.DamageInvaders(1); // because they targetted a land, only select invaders from that land. --fireDamage; var spacesWithPresenceAndBlight = ctx.Self.Presence.Spaces .Select(s => ctx.Target(s)) .Where(x => x.HasBlight) .ToArray(); // ! don't .ToArray() this because we want it to re-execute each time. var invaderTokens = spacesWithPresenceAndBlight .SelectMany(ctx => ctx.Tokens.Invaders().Select(t => new SpaceToken(ctx.Space, t))); while (fireDamage > 0 && invaderTokens.Any()) { SpaceToken token = await ctx.Decision(new Select.TokenFromManySpaces($"Apply fire damage. ({fireDamage} remaining)", invaderTokens, Present.Always)); await ctx.Target(token.Space).Invaders.ApplyDamageTo1(1, (HealthToken)token.Token); --fireDamage; } }
static public async Task Option3b(TargetSpaceCtx ctx) { var invaders = ctx.Tokens.Invaders().ToArray(); if (invaders.Length == 0 || !ctx.Dahan.Any) { return; } var invader = (HealthToken)await ctx.Decision(new Select.TokenFrom1Space("Select invader to fight 1 dahan", ctx.Space, invaders, Present.Always)); // Calc Invader Damage var(damageFromInvader, newInvaderToken) = GetDamageFromInvader(ctx.Tokens, invader); // Calc Dahan Damage int damageFromDahan = 2; // Damage invader await ctx.Invaders.ApplyDamageTo1(damageFromDahan, newInvaderToken); // damage dahan if (damageFromInvader >= 2) { await ctx.DestroyDahan(1); } }
static public async Task ActAsync(TargetSpaceCtx ctx) { bool originallyHadInvaders = ctx.HasInvaders; // for each strife or blight in target land, int count = ctx.Tokens.Keys.OfType <HealthToken>().Sum(x => x.StrifeCount * ctx.Tokens[x]) + ctx.Blight.Count; // 1 fear ctx.AddFear(count); // and 2 damage. await ctx.DamageInvaders(count * 2); // if this destroys all invaders in target land, add 1 beast. if (originallyHadInvaders && !ctx.HasInvaders) { await ctx.Beasts.Add(1); } // if you have 4 moon, 2 fire if (await ctx.YouHave("4 moon,2 fire")) { // add 1 strife in up to 3 adjacent lands. var tokenSpaces = ctx.Adjacent .Where(s => ctx.Target(s).HasInvaders) .ToList(); for (int i = 0; tokenSpaces.Count > 0 && i < 3; ++i) { var space = await ctx.Decision(new Select.Space("Add Strife", tokenSpaces, Present.Done)); await ctx.AddStrife(); tokenSpaces.Remove(space); } } }
static async Task Apply3DamageInOneOfThese(TargetSpaceCtx ctx, Space secondTarget, string damageType) { var space = await ctx.Decision(new Select.Space("Apply 3 " + damageType + " damage to", new Space[] { ctx.Space, secondTarget }, Present.Always)); await ctx.Target(space).DamageInvaders(3); }
static async Task AddStrifeToLandWithinRange(TargetSpaceCtx ctx, int range) { var space = await ctx.Decision(new Select.Space("Add Strife", ctx.Range(range), Present.Always)); await ctx.Target(space).AddStrife(); }
static async Task AddTokenToLandWithinRange(TargetSpaceCtx ctx, Token token, int range) { var space = await ctx.Decision(new Select.Space($"Add {token.Text}", ctx.Range(range), Present.Always)); await ctx.Target(space).Tokens.Add(token, 1); }