Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    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);
        }
    }