コード例 #1
0
        public async Task ChomusukeTrain()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom   = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                int choice = Global.Rng.Next(1, 3);

                if (choice == 1)
                {
                    uint xpGain = (uint)Global.Rng.Next(20, 30);
                    chom.XP += xpGain;
                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(config.Id);
                    int    randomIndex  = Global.Rng.Next(yesTrainTexts.Length);
                    string text         = yesTrainTexts[randomIndex];
                    var    thumbnailurl = Context.User.GetAvatarUrl();
                    var    auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl(yesTrainLinks[Global.Rng.Next(yesTrainLinks.Length)]);
                    embed.WithDescription($"{text} \n**(+{xpGain} exp)**");
                    await SendMessage(Context, embed.Build());
                }

                if (choice == 2)
                {
                    int    randomIndex  = Global.Rng.Next(yesTrainTexts.Length);
                    string text         = noTrainTexts[randomIndex];
                    var    thumbnailurl = Context.User.GetAvatarUrl();
                    var    auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Try again!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 0, 0);
                    embed.WithThumbnailUrl(noTrainLinks[Global.Rng.Next(noTrainLinks.Length)]);
                    embed.WithDescription($"{text}");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
コード例 #2
0
ファイル: Deflect.cs プロジェクト: Phytal/Nayu
        public static AttackResult DeflectAttack(ShardedCommandContext context)
        {
            var config = GlobalUserAccounts.GetUserAccount(context.User);
            var chom   = ActiveChomusuke.GetOneActiveChomusuke(config.Id);

            string response;
            bool   success = false;
            int    dmg     = 0;

            if (chom.Effects.Contains(Effect.Blocking))
            {
                response = "You cannot block while already in blocking formation! Try again!";
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            if (chom.Effects.Contains(Effect.Deflecting))
            {
                response = "You are already in deflecting formation! Try again!";
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            chom.Effects.Add(Effect.Deflecting);
            GlobalUserAccounts.SaveAccounts(config.Id);
            response =
                $":shield:  **|** **{config.OpponentName}**, You are now in deflecting formation!\n\n**{config.OpponentName}**'s shield will deflect 50% of the damage from the next attack";
            success = true;
            return(new AttackResult {
                Success = success, Response = response, Damage = dmg
            });
        }
コード例 #3
0
ファイル: Burning.cs プロジェクト: Phytal/Nayu
        public static async Task Burned(ShardedCommandContext context)
        {
            var config = GlobalUserAccounts.GetUserAccount(context.User);
            var chom   = ActiveChomusuke.GetOneActiveChomusuke(config.Id);

            var dmg = (uint)Global.Rng.Next(2, 5);

            if (!chom.Effects.Contains(Effect.Burned))
            {
                return;
            }
            var rng = Global.Rng.Next(1, 5);

            if (rng == 4)
            {
                chom.Effects.Remove(Effect.Burned);
                GlobalUserAccounts.SaveAccounts(config.Id);
                await SendMessage(context, null, $"{chom.Name} stopped burning!");

                return;
            }

            chom.Health -= dmg;
            GlobalUserAccounts.SaveAccounts(config.Id);
            await SendMessage(context, null, $"{chom.Name} took {dmg} from being burned!");
        }
コード例 #4
0
        public static async Task ChooseActionAsync(SocketUser user, string action)
        {
            var activeChomusuke = ActiveChomusuke.GetOneActiveChomusuke(user.Id);

            if (action == "cure")
            {
                activeChomusuke.Sick  = false;
                activeChomusuke.Waste = 0;
                await ActiveChomusuke.ConvertOneActiveVariable(user.Id, activeChomusuke);
            }
        }
コード例 #5
0
        public async Task ChomusukeName([Remainder] string name)
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                chom.Name = name;
                await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                GlobalUserAccounts.SaveAccounts(Context.User.Id);
                await SendMessage(Context, null,
                                  $"✅   **|**  **{Context.User.Username}**, you successfully changed {Global.EChomusuke} {chom.Name}'s name to **{name}**!");
            }
        }
コード例 #6
0
        public async Task SellChomusukeAsync()
        {
            var config     = GlobalUserAccounts.GetUserAccount(Context.User);
            var activeChom = ActiveChomusuke.GetOneActiveChomusuke(Context.User.Id);

            if ((DateTime.Now - activeChom.BoughtDay).Days < 1)
            {
                throw new Exception("You cannot sell a Chomusuke that's under a day old!");
            }
            string shoptext =
                $":department_store:  **| Are you sure you want to sell your active Chomusuke, {activeChom.Name}? [y/n]";
            var shop = await Context.Channel.SendMessageAsync(shoptext);

            var response = await NextMessageAsync();

            if (response == null)
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity";
                });

                return;
            }

            if (response.Content.Equals("y", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                var value = GetChomusukeValue(activeChom);
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $":feet:  |  **Your {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke is worth {value} Taiyakis, do you wish to sell it? (**900** {Emote.Parse("<:taiyaki:599774631984889857>")})**\n\nType `confirm` to continue or `cancel` to cancel.\n\n**Warning: this is irreversible!**";
                });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("confirm", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    //remove chomusuke
                    config.ActiveChomusuke = 0;
                    config.Taiyaki        += value;
                    GlobalUserAccounts.SaveAccounts(Context.User.Id);
                    await SendMessage(Context, null, $"You have successfully sold your Chomusuke {activeChom.Name}");

                    return;
                }

                if (newresponse.Content.Equals("n", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $":feet:  **|**  **{Context.User.Username}**, action cancelled.";
                    });

                    return;
                }

                if (response == null)
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity";
                    });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Global.ENo}  **|** That is an invalid response. Please try again.";
                    });

                    return;
                }
            }
        }
コード例 #7
0
        public async Task ChomusukePlay()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                if (chom.Trust == 20)
                {
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Chiiiii..",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 128, 0);
                    embed.WithThumbnailUrl(NoPlayLinks[Global.Rng.Next(NoPlayLinks.Length)]);
                    embed.WithDescription(
                        $":soccer:  **|**  **{Context.User.Username}, your {Global.EChomusuke} Chomusuke is bored of playing right now!**");
                    await SendMessage(Context, embed.Build());

                    return;
                }

                {
                    int    randomIndex = Global.Rng.Next(playTexts.Length);
                    string text        = playTexts[randomIndex];
                    int    trustGain   = Global.Rng.Next(4, 9);
                    chom.Trust += (byte)trustGain;
                    if (chom.Trust > 20)
                    {
                        chom.Trust = 20;
                    }

                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(Context.User.Id);
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl(YesPlayLinks[Global.Rng.Next(YesPlayLinks.Length)]);
                    embed.WithDescription(
                        $":soccer:  **|**  **{Context.User.Username}**, {text} **(+{trustGain} trust)**");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
コード例 #8
0
        public async Task ChomusukeClean()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                if (chom.Waste == 0)
                {
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Chiiiii..",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 128, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/OtVepvM.gif");
                    embed.WithDescription(
                        $":sparkles:  **|** **{Context.User.Username}, your {Global.EChomusuke} Chomusuke's room is squeaky clean!**");
                    await SendMessage(Context, embed.Build());
                }
                else
                {
                    int    randomIndex   = Global.Rng.Next(cleanTexts.Length);
                    string text          = cleanTexts[randomIndex];
                    int    cleanedAmount = Global.Rng.Next(4, 8);
                    chom.Waste -= (byte)cleanedAmount;
                    if (chom.Waste > 20)
                    {
                        chom.Waste = 0;
                    }

                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(Context.User.Id);

                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/PI2z8rm.gif");
                    embed.WithDescription(
                        $":sparkles:  **|**  **{Context.User.Username}**, {text} **(-{cleanedAmount} waste)**");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
コード例 #9
0
        public async Task ChomusukeFeed()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                if (chom.Hunger == 20)
                {
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Chiiiii..",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 128, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/Sc4HGir.gif");
                    embed.WithDescription(
                        $":poultry_leg:  **|**  **{Context.User.Username}**, {Global.EChomusuke} {chom.Name} is full!");
                    await SendMessage(Context, embed.Build());
                }
                else
                {
                    int cost       = Global.Rng.Next(34, 87);
                    int hungerGain = Global.Rng.Next(4, 9);
                    chom.Hunger += (byte)hungerGain;
                    if (chom.Hunger > 20)
                    {
                        chom.Hunger = 20;
                    }

                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(Context.User.Id);

                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/Sc4HGir.gif");
                    embed.WithDescription(
                        $":poultry_leg:  **|**  **{Context.User.Username}**, you fill {Global.EChomusuke} {chom.Name}'s bowl with food. It looks happy! **(+{hungerGain} food [-{cost} {Global.ETaiyaki}])**");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
コード例 #10
0
ファイル: Shop.cs プロジェクト: Phytal/Nayu
        public async Task ChomusukeBuy()
        {
            var    user            = Context.User as SocketGuildUser;
            var    config          = GlobalUserAccounts.GetUserAccount(user);
            var    activeChomusuke = ActiveChomusuke.GetOneActiveChomusuke(user.Id);
            string shoptext        =
                ":department_store:  **|  Chomusuke Shop** \n ```xl\nPlease select the purchase you would like to make.\n\n[1] Capsules\n[2] Boosts\n[3] Items\n\nType the respective number beside the purchase you would like to select.\nType 'cancel' to cancel your purchase.```";
            var shop = await Context.Channel.SendMessageAsync(shoptext);

            var response = await NextMessageAsync();

            if (response == null)
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity";
                });

                return;
            }

            if (response.Content.Equals("1", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $":feet:  |  **Are you sure you want to purchase a {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke? (**900** {Emote.Parse("<:taiyaki:599774631984889857>")})**\n\nType `confirm` to continue or `cancel` to cancel.";
                });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("confirm", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    if (config.Taiyaki < 900)
                    {
                        await shop.ModifyAsync(m =>
                        {
                            m.Content =
                                $"**<:no:453716729525174273>  |  {Context.User.Username}, you don't have enough Taiyakis for that! **You require **{900 - config.Taiyaki}** more Taiyakis!";
                        });

                        return;
                    }

                    config.NormalCapsule += 1;
                    config.Taiyaki       -= 900;
                    GlobalUserAccounts.SaveAccounts(user.Id);
                    await SendMessage(Context, null,
                                      $"You have successfully bought a {Emote.Parse("<:chomusuke:601183653657182280>")} Normal Chomusuke Capsule!");

                    return;
                }

                if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $":feet: **|**  **{Context.User.Username}**, purchase cancelled.";
                    });

                    return;
                }

                if (response == null)
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity";
                    });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                    });

                    return;
                }
            }

            if (response.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content = $":feet: **|**  **{Context.User.Username}**, purchase cancelled.";
                });

                return;
            }

            //TODO: add boosts
            if (response.Content.Equals("2", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $"```xl\n[1] Medicine - cures your Chomusuke's sickness [400 {Emote.Parse("<:taiyaki:599774631984889857>")}]\n\nType the respective number beside the purchase you would like to select.\nType 'cancel' to cancel your purchase.```";
                });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("1", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await ChooseChomusuke.ChooseActionAsync(user, "cure");

                    config.Taiyaki -= 400;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    await shop.ModifyAsync(m =>
                    {
                        m.Content =
                            $":pill:  |  **{Context.User.Username}**, your {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke has been cured of it's sickness! Make sure to keep looking after it!";
                    });

                    return;
                }

                if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $":feet: **|**  **{Context.User.Username}**, purchase cancelled.";
                    });

                    return;
                }

                if (response == null)
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity";
                    });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                    });
                }
            }

            if (response.Content.Equals("3", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $"```xl\n[1] Medicine - cures your Chomusuke's sickness [400 {Emote.Parse("<:taiyaki:599774631984889857>")}]\n\nType the respective number beside the purchase you would like to select.\nType 'cancel' to cancel your purchase.```";
                });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("1", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await ChooseChomusuke.ChooseActionAsync(user, "cure");

                    config.Taiyaki -= 400;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    await shop.ModifyAsync(m =>
                    {
                        m.Content =
                            $":pill:  |  **{Context.User.Username}**, your {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke has been cured of it's sickness! Make sure to keep looking after it!";
                    });

                    return;
                }

                if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $":feet: **|**  **{Context.User.Username}**, purchase cancelled.";
                    });

                    return;
                }

                if (response == null)
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity";
                    });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                    });
                }
            }
            else
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                });
            }
        }