示例#1
0
    async Task DestroyNearbyPresence(ITokenRemovedArgs args)
    {
        if (args.Reason != RemoveReason.DestroyedInBattle)
        {
            return;
        }
        if (args.Token.Class != TokenType.Dahan)
        {
            return;
        }

        string prompt = $"{SwarnToVictory.Title}: {args.Count} dahan destroyed. Select presence to destroy.";

        int numToDestroy = args.Count;

        Space[] options;
        Space[] Calc() => args.Space.Range(1).Intersect(Presence.Spaces).ToArray();

        while (numToDestroy-- > 0 && (options = Calc()).Length > 0)
        {
            var space = await this.Action.Decision(Select.DeployedPresence.ToDestroy(prompt, options, Present.Always));

            await Presence.Destroy(space, args.GameState, DestoryPresenceCause.DahanDestroyed);
        }
    }