Exemplo n.º 1
0
        internal static async Task Shoot(SocketUser user)
        {
            if (false == IsGameStart || 0 == NumberOfDuck)
            {
                await HunterChannel.SendMessageAsync(user.Mention + (" You can only shoot during a game."));

                return;
            }

            var CurrentUser = UserAccounts.UserAccounts.GetAccount(user);

            if (null == CurrentUser)
            {
                return;
            }

            S_ammunition PlayerAmmo = new S_ammunition();

            PlayerGetAmmo(user.Id, ref PlayerAmmo);

            /* Check that the player has the bullets */
            if (0 == PlayerAmmo.Bullets)
            {
                await HunterChannel.SendMessageAsync(user.Mention + (Utilities.GetAlert((0 == PlayerAmmo.Magazine) ? "OutofAmmoMag" : "OutofAmmo")));

                return;
            }

            /* 95 % Chance to miss */
            if (95 > Randomizer.Next(0, 100))
            {
                await HunterChannel.SendMessageAsync(user.Mention + (Utilities.GetAlert("Missed")));
            }
            else
            {
                /* Hit the Monster! */
                NumberOfDuck--;
                await HunterChannel.SendMessageAsync(user.Mention + (Utilities.GetAlert("Hit")));

                BeeBot.Core.LevelingSystem.Leveling.AddExperience((SocketGuildUser)user, HunterChannel, RewardExperience, true);
            }

            /* Update their ammo count */
            PlayerSetAmmo(user.Id, PlayerAmmo);

            /* Take a bullet from their gun */
            if (0 == (PlayerAmmo.Bullets--))
            {
                //You need to reload?
            }

            /* Update their ammo count */
            PlayerSetAmmo(user.Id, PlayerAmmo);
        }
Exemplo n.º 2
0
        public static void PlayerGetAmmo(ulong PlayerID, ref S_ammunition AmmoPack)
        {
            if (false == PlayerBulletTracker.TryGetValue(PlayerID, out AmmoPack))
            {
                Console.WriteLine("Debug: Add New Magazine");
                /* We don't have a record. Make a new one and give them 10 bullets! */
                AmmoPack.Bullets  = 5; //5 In Gun
                AmmoPack.Magazine = 1; //1 Mag

                PlayerBulletTracker.Add(PlayerID, AmmoPack);
            }
        }
Exemplo n.º 3
0
        internal static async Task Reload(SocketUser user)
        {
            var CurrentUser = UserAccounts.UserAccounts.GetAccount(user);

            if (null == CurrentUser)
            {
                return;
            }

            if (false == IsGameStart || 0 == NumberOfDuck)
            {
                await HunterChannel.SendMessageAsync(user.Mention + (" You can only reload during a game."));

                return;
            }

            S_ammunition PlayerAmmo = new S_ammunition();

            PlayerGetAmmo(user.Id, ref PlayerAmmo);

            if (0 != PlayerAmmo.Bullets)
            {
                await HunterChannel.SendMessageAsync(user.Mention + (" > You already have bullets in your gun."));
            }
            else
            {
                if (0 == PlayerAmmo.Magazine)
                {
                    await HunterChannel.SendMessageAsync(user.Mention + (Utilities.GetAlert("OutofAmmoMag")));
                }
                else
                {
                    if (25 > Randomizer.Next(0, 100))
                    {
                        await HunterChannel.SendMessageAsync(user.Mention + (Utilities.GetAlert("Jammed")));
                    }
                    else
                    {
                        /* Update their ammo count */
                        PlayerAmmo.Bullets  = 5;
                        PlayerAmmo.Magazine = 0;
                        PlayerSetAmmo(user.Id, PlayerAmmo);

                        await HunterChannel.SendMessageAsync(user.Mention + (Utilities.GetAlert("Reload")));
                    }
                }
            }
        }
Exemplo n.º 4
0
 public static void PlayerSetAmmo(ulong PlayerID, S_ammunition AmmoPack)
 {
     Console.WriteLine("Debug: Update Player Ammo {0}/{1}", AmmoPack.Bullets, AmmoPack.Magazine);
     PlayerBulletTracker[PlayerID] = AmmoPack;
 }