Пример #1
0
        public override async Task DoAction(Event e, Player player)
        {
            await VoopAI.gameChannel.SendMessageAsync($"You have {player.coins} coins. What would you like to buy?");

            List <Item> buyables = merchant.items.Where(x => !(x is ItemFist)).ToList();

            List <IVoteable> options = new List <IVoteable>();

            options.AddRange(buyables);

            Item chosen = (Item)await VoopAI.DoVote(options, 10);

            if (player.coins < chosen.GetValue())
            {
                await VoopAI.gameChannel.SendMessageAsync($"You attempt to buy the {chosen.GetName()}, but you cannot afford it. " +
                                                          $"{e.entity.name} sends you off, annoyed you wasted their time.");

                e.endEvent = true;
            }
            else
            {
                await VoopAI.gameChannel.SendMessageAsync($"You give {chosen.GetValue()} coins to {e.entity.name} and " +
                                                          $"they give you the {chosen.GetName()}.");

                player.coins -= chosen.GetValue();
                player.items.Add(chosen);

                merchant.items.Remove(chosen);
            }
        }
Пример #2
0
        public override async Task DoAction(Event e, Player player)
        {
            if (player.items.Count < 2)
            {
                await VoopAI.gameChannel.SendMessageAsync($"You have nothing to sell!");
            }

            await VoopAI.gameChannel.SendMessageAsync($"You have {player.coins} coins. What would you like to sell?");

            List <Item> sellables = player.items.Where(x => !(x is ItemFist)).ToList();

            List <IVoteable> options = new List <IVoteable>();

            options.AddRange(sellables);

            Item chosen = (Item)await VoopAI.DoVote(options, 10);

            await VoopAI.gameChannel.SendMessageAsync($"You give {chosen.GetName()} to {e.entity.name} and " +
                                                      $"they give you {chosen.GetValue() / 2} coins.");

            player.coins += chosen.GetValue() / 2;
            player.items.Remove(chosen);

            merchant.items.Add(chosen);
        }
Пример #3
0
        public virtual async Task PlayerTurn(Player player)
        {
            bool usedAction = false;

            while (!usedAction)
            {
                List <IVoteable> options = new List <IVoteable>();
                options.AddRange(GetActions());

                Action result = (Action)await VoopAI.DoVote(options, 15);

                if (result is AttackAction)
                {
                    Event battleEvent = new EventAmbush(location, entity);

                    await VoopAI.gameChannel.SendMessageAsync("You jump the merchant, hoping to loot him rather than pay!");

                    Thread.Sleep(5000);

                    await battleEvent.RunEvent(player, true);

                    usedAction    = true;
                    this.endEvent = true;
                }
                else
                {
                    await result.DoAction(this, player);

                    if (!result.Passive())
                    {
                        usedAction = true;
                    }
                }
            }
        }
Пример #4
0
        public virtual async Task PlayerTurn(Player player)
        {
            bool usedAction = false;

            while (!usedAction)
            {
                List <IVoteable> options = new List <IVoteable>();
                options.AddRange(GetActions());

                Action result = (Action)await VoopAI.DoVote(options, 10);

                await result.DoAction(this, player);

                if (!result.Passive())
                {
                    usedAction = true;
                }
            }
        }
Пример #5
0
        public override async Task DoAction(Event e, Player player)
        {
            List <Item> usables = player.items.Where(x => !(x is Weapon)).ToList();

            if (usables.Count == 0)
            {
                await RPG_Game.gameChannel.SendMessageAsync($"You have nothing to use!");

                return;
            }

            List <IVoteable> options = new List <IVoteable>();

            options.AddRange(usables);

            Item result = (Item)await VoopAI.DoVote(options, 10);

            await result.OnUse(player);

            Thread.Sleep(5000);
        }
Пример #6
0
        public override async Task DoAction(Event e, Player player)
        {
            await VoopAI.gameChannel.SendMessageAsync($"Please select an item for attack: ");

            List <IVoteable> options = new List <IVoteable>();

            options.AddRange(player.items.Where(x => x is Weapon).ToList());

            Weapon chosen = (Weapon)(await VoopAI.DoVote(options, 10));

            int   roll   = VoopAI.random.Next(0, 21);
            float mult   = (float)Math.Round(roll / 20.0, 1);
            float damage = (float)Math.Round(chosen.GetDamage() * mult, 1);

            //await VoopAI.gameChannel.SendMessageAsync($"Roll: {roll} \n" +
            //                                          $"Damage: {chosen.GetDamage()} x {mult} = {damage}");

            EmbedBuilder embed = new EmbedBuilder()
            {
                Color = new Color(0, 100, 255),
                Title = "Attack:"
            };

            embed.AddField("Roll 🎲", roll.ToString());
            embed.AddField($"Weapon Strength {chosen.GetEmote().Name}", chosen.GetDamage());
            embed.AddField("Damage: 💥", $"{chosen.GetDamage()} x {mult} = {damage}");

            await VoopAI.gameChannel.SendMessageAsync(embed : embed.Build());

            Thread.Sleep(2000);

            await chosen.OnUse(player);

            e.entity.health -= (int)Math.Ceiling(damage);

            await VoopAI.gameChannel.SendMessageAsync($"You {chosen.GetUseVerb()} {e.entity.name} and their health drops to {e.entity.health}.");

            Thread.Sleep(2000);
        }