コード例 #1
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Reset()
        {
            await ReplyAsync("Reshuffling...");

            GameContext context = GameContexts.getContext(Context.Guild.Id);

            context.ResetDeck();
        }
コード例 #2
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Deck(string argument = null, params string[] deckNames)
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            switch (argument)
            {
            case "add":
                context.AddDecks(deckNames);
                context.SaveToJson();
                break;

            case "remove":
                context.RemoveDecks(deckNames);
                context.SaveToJson();
                break;

            default:
                if (context.UsedDecks.Count > 0)
                {
                    EmbedBuilder embed = new EmbedBuilder();

                    EmbedFieldBuilder usedField = new EmbedFieldBuilder();
                    usedField.WithName("Current Decks");
                    string description = string.Empty;
                    foreach (Deck deck in context.UsedDecks)
                    {
                        description += string.Format("{2} {0} - {1}" + Environment.NewLine, deck.Name, deck.Description, deck.Emoji);
                    }
                    usedField.WithValue(description);

                    EmbedFieldBuilder unusedField = new EmbedFieldBuilder();
                    unusedField.WithName("Avaliable Decks");
                    description = string.Empty;
                    List <Deck> unusedDecks = (List <Deck>)Decks.GetAllDecks();
                    unusedDecks.RemoveAll(s => context.UsedDecks.Contains(s));
                    foreach (Deck deck in unusedDecks)
                    {
                        description += string.Format("{2} {0} - {1}" + Environment.NewLine, deck.Name, deck.Description, deck.Emoji);
                    }
                    unusedField.WithValue(description);

                    embed.AddField(usedField);
                    embed.AddField(unusedField);

                    await ReplyAsync("", false, embed.Build());
                }
                else
                {
                    await ReplyAsync("You currently have no decks.");
                }

                break;
            }
        }
コード例 #3
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Draw()
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            foreach (IUser user in context.Players)
            {
                EmbedBuilder embed = new EmbedBuilder();
                embed.WithTitle("Superfight Round");
                embed.WithDescription("Respond with \'number, number\' to play cards. E.g. \'2, 1\' \n First number chooses character and second number chooses attribute");

                List <EmbedFieldBuilder> fields = new List <EmbedFieldBuilder>();

                EmbedFieldBuilder characterField = new EmbedFieldBuilder();
                characterField.WithName("Characters");
                characterField.WithIsInline(true);
                Card[] characters = new Card[3];
                for (int i = 0; i < 3; i++)
                {
                    characters[i] = context.Deck.DrawCharacter();
                }
                characterField.WithValue(string.Format("1: {1} {0} 2: {2} {0} 3: {3}", Environment.NewLine, characters[0], characters[1], characters[2]));

                embed.AddField(characterField);

                EmbedFieldBuilder attributeField = new EmbedFieldBuilder();
                attributeField.WithName("Attributes");
                attributeField.WithIsInline(true);
                Card[] attributes = new Card[3];
                for (int i = 0; i < 3; i++)
                {
                    attributes[i] = context.Deck.DrawAttribute();
                }
                attributeField.WithValue(string.Format("1: {1} {0} 2: {2} {0} 3: {3}", Environment.NewLine, attributes[0], attributes[1], attributes[2]));

                embed.AddField(attributeField);

                IDMChannel channel = await user.GetOrCreateDMChannelAsync();

                await channel.SendMessageAsync("", false, embed.Build());

                MessageUser(user, channel, Context.Channel, characters, attributes, context.Deck.DrawAttribute());
            }
        }
コード例 #4
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Players(string argument = null, params IUser[] users)
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            switch (argument)
            {
            case "add":
                context.AddPlayers(users);
                break;

            case "remove":
                context.RemovePlayers(users);
                break;

            case "clear":
                context.Players.Clear();
                break;

            default:
                if (context.Players.Count > 0)
                {
                    EmbedBuilder embed = new EmbedBuilder();
                    embed.WithTitle("Superfight Players");
                    string description = string.Empty;
                    foreach (IUser user in context.Players)
                    {
                        description += ((IGuildUser)user).Nickname + Environment.NewLine;
                    }
                    embed.WithDescription(description);
                    await ReplyAsync("", false, embed.Build());
                }
                else
                {
                    await ReplyAsync("There are currently no players playing Superfight");
                }

                break;
            }
        }
コード例 #5
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Scenario()
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            await ReplyAsync(string.Format("{0} pulled scenario **{1}**", ((IGuildUser)Context.User).Nickname, context.Deck.DrawScenario()));
        }
コード例 #6
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Location()
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            await ReplyAsync(string.Format("{0} pulled location **{1}**", ((IGuildUser)Context.User).Nickname, context.Deck.DrawLocation()));
        }
コード例 #7
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Character()
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            await ReplyAsync(string.Format("{0} pulled character **{1}**", ((IGuildUser)Context.User).Nickname, context.Deck.DrawCharacter()));
        }
コード例 #8
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Attribute()
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            await ReplyAsync(string.Format("{0} pulled attribute **{1}**", ((IGuildUser)Context.User).Nickname, context.Deck.DrawAttribute()));
        }
コード例 #9
0
ファイル: Commands.cs プロジェクト: Laton95/Superfight-Bot
        public async Task Random()
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            await ReplyAsync(string.Format("{0} pulled **{1}** with attributes **{2}** and **{3}**", ((IGuildUser)Context.User).Nickname, context.Deck.DrawCharacter(), context.Deck.DrawAttribute(), context.Deck.DrawAttribute()));
        }