Пример #1
0
            public async Task add(string type, [Remainder, Summary("Resistance name")] string resistance)
            {
                type = type.ToLower().Trim();
                CharacterNode old = findCharacter(Context.User);

                if (old == null)
                {
                    await Context.User.SendMessageAsync("You do not have an active character.");

                    return;
                }
                if (type != "res" && type != "resistance" && type != "vul" && type != "vulnerability" && type != "imm" && type != "immune")
                {
                    await Context.User.SendMessageAsync(type + " is not a valid type. Please enter resistance, vulnerability, immune, or res, vul, or imm.");

                    return;
                }
                int index = old.damageTypes(resistance);

                if (index == -1)
                {
                    await Context.User.SendMessageAsync("Please enter a valid damage type.");

                    return;
                }
                if (type == "res" || type == "resistance")
                {
                    old.addResistance(resistance);
                }
                else if (type == "vul" || type == "vulnerability")
                {
                    old.addVulnerability(resistance);
                }
                else if (type == "imm" || type == "immune")
                {
                    old.addImmunity(resistance);
                }
                await Context.User.SendMessageAsync("I added the " + type + " for you.");
            }