Exemple #1
0
        public static int PlayerDiceRoll(Player player)
        {
            int sum        = 0;
            int diceAmount = player.Equipment.DiceAmount;
            int diceSides  = player.Equipment.DiceSides;


            for (int i = 0; i < diceAmount; i++)
            {
                sum += RandomNumGenerator.NumberBetween(1, diceSides);
            }

            return(sum);
        }
Exemple #2
0
        public static int MonsterDiceRoll(Mob mob)
        {
            int sum        = 0;
            int diceAmount = mob.AttackDiceAmount;
            int diceSides  = mob.AttackDiceSides;


            for (int i = 0; i < diceAmount; i++)
            {
                sum += RandomNumGenerator.NumberBetween(1, diceSides);
            }

            return(sum);
        }
Exemple #3
0
        public static List <InheritItem> RandomItemsDropped(int itemDrop)
        {
            List <InheritItem> newItemList = new List <InheritItem>();

            switch (itemDrop)
            {
            case 0:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(401, 413)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(301, 305)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(201, 220)));
                return(newItemList);

            case 1:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(401, 415)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(301, 310)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(212, 236)));
                return(newItemList);

            case 2:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(401, 416)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(305, 310)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(212, 252)));
                return(newItemList);

            case 3:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(401, 419)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(305, 314)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(231, 252)));
                return(newItemList);

            case 4:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(415, 419)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(310, 314)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(253, 267)));
                return(newItemList);

            case 5:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(415, 419)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(315, 319)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(253, 267)));
                return(newItemList);

            default:
                newItemList.Add(GameAttributes.PlayerItemByID(RandomNumGenerator.NumberBetween(415, 419)));
                newItemList.Add(GameAttributes.PlayerPotionByID(RandomNumGenerator.NumberBetween(320, 325)));
                newItemList.Add(GameAttributes.PlayerWeaponByID(RandomNumGenerator.NumberBetween(253, 268)));
                return(newItemList);
            }
        }
Exemple #4
0
        private int RandomXP(int xp)
        {
            switch (xp)
            {
            case 0:
                return(RandomNumGenerator.NumberBetween(1, 10));

            case 1:
                return(RandomNumGenerator.NumberBetween(5, 15));

            case 2:
                return(RandomNumGenerator.NumberBetween(15, 25));

            case 3:
                return(RandomNumGenerator.NumberBetween(25, 35));

            case 4:
                return(RandomNumGenerator.NumberBetween(35, 50));

            case 5:
                return(RandomNumGenerator.NumberBetween(100, 100));

            case 6:
                return(RandomNumGenerator.NumberBetween(150, 200));

            case 7:
                return(RandomNumGenerator.NumberBetween(225, 250));

            case 8:
                return(RandomNumGenerator.NumberBetween(250, 275));

            case 9:
                return(RandomNumGenerator.NumberBetween(275, 300));

            case 10:
                return(RandomNumGenerator.NumberBetween(400, 400));

            default:
                return(0);
            }
        }
Exemple #5
0
        private int RandomGold(int gold)
        {
            switch (gold)
            {
            case 0:
                return(RandomNumGenerator.NumberBetween(10, 20));

            case 1:
                return(RandomNumGenerator.NumberBetween(20, 30));

            case 2:
                return(RandomNumGenerator.NumberBetween(30, 50));

            case 3:
                return(RandomNumGenerator.NumberBetween(50, 75));

            case 4:
                return(RandomNumGenerator.NumberBetween(100, 150));

            case 5:
                return(RandomNumGenerator.NumberBetween(500, 600));

            case 6:
                return(RandomNumGenerator.NumberBetween(600, 700));

            case 7:
                return(RandomNumGenerator.NumberBetween(700, 800));

            case 8:
                return(RandomNumGenerator.NumberBetween(800, 900));

            case 9:
                return(RandomNumGenerator.NumberBetween(900, 1000));

            case 10:
                return(RandomNumGenerator.NumberBetween(1500, 1500));

            default:
                return(0);
            }
        }
Exemple #6
0
 // Constructor to assign information gathered
 public Room(int id, string roomName, string description, int north, int south, int east, int west, int up, int down, int mobRoll)
 {
     ID          = id;
     RoomName    = roomName;
     Description = description;
     North       = north;
     South       = south;
     East        = east;
     West        = west;
     Up          = up;
     Down        = down;
     // Allows for the mob to be randomly generated.
     if (mobRoll > -1)
     {
         if (mobRoll < 1)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(0, 6);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll < 2)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(7, 14);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll < 3)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(15, 24);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll < 4)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(25, 32);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll < 5)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(33, 39);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll < 6)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(40, 40);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll == 7)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(41, 41);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll == 8)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(42, 42);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else if (mobRoll == 9)
         {
             int rolledMob = RandomNumGenerator.NumberBetween(43, 43);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
         else
         {
             int rolledMob = RandomNumGenerator.NumberBetween(44, 44);
             CurrentMob = new Mob(GameAttributes.mobs[rolledMob]);
         }
     }
 }
Exemple #7
0
        public static void RunCombat(Player player, string noun)
        {
            bool exit = false;
            int  playerDamage;
            int  mobDamage;
            Mob  mob = player.CurrentRoom.CurrentMob;

            // Keeps the do while going as long as the mob/player hasn't died.
            do
            {
                if (player.CurrentRoom.CurrentMob != null)
                {
                    if (noun == mob.Name.ToLower())
                    {
                        // Checks to make sure the mob isn't dead
                        if (mob.IsDead == false)
                        {
                            // Rolls the players attack
                            Console.ForegroundColor = ConsoleColor.Green;
                            int playerAttack = RandomNumGenerator.NumberBetween(1, 20);
                            Console.WriteLine($"You attack with a {player.Equipment.Name} and roll a {playerAttack}");

                            if (playerAttack >= mob.AC)
                            {
                                playerDamage = RollDice.PlayerDiceRoll(player);

                                Console.WriteLine($"You hit {mob.Name} for {playerDamage} damage!");
                                mob.HP -= playerDamage;
                                Console.WriteLine($"The {mob.Name} has {mob.HP} HP!");
                                // Once mob dies all items are automatically given to player //TODO add a display of what the player gained (xp, gold, items, etc)
                                if (mob.HP <= 0)
                                {
                                    Console.ForegroundColor = ConsoleColor.Cyan;
                                    CombatResults(player, mob);
                                    exit = true;
                                    Console.ForegroundColor = ConsoleColor.White;
                                }
                            }
                            else
                            {
                                Console.WriteLine("You Missed!!!");
                            }
                            Console.ForegroundColor = ConsoleColor.Red;

                            // Mobs turn to attack if it is still alive, rolls the mobs attacks and continues combat until the player or mob dies
                            if (mob.IsDead == false)
                            {
                                int monsterAttack = RandomNumGenerator.NumberBetween(1, 20);

                                if (monsterAttack > player.AC)
                                {
                                    mobDamage = RollDice.MonsterDiceRoll(mob);

                                    Console.WriteLine($"The {mob.Name} attacks and rolls a {monsterAttack}");
                                    Console.WriteLine($"The {mob.Name} hits for {mobDamage} damage!");
                                    player.HP -= mobDamage;
                                    Console.WriteLine($"The {player.PlayerName} has {player.HP} HP!");
                                    if (player.HP < 0)
                                    {
                                        Console.ForegroundColor = ConsoleColor.DarkGreen;
                                        Console.WriteLine("You have died!");
                                        LoadPlayerFromFile.LoadPlayer(player.PlayerName);
                                        exit = true;
                                        Console.ForegroundColor = ConsoleColor.White;
                                    }
                                }
                                else
                                {
                                    Console.WriteLine($"The {mob.Name} Missed!");
                                }
                            }
                            else
                            {
                                Console.ForegroundColor = ConsoleColor.Magenta;
                                Console.WriteLine($"You have won!");
                                exit = true;
                            }

                            Console.ForegroundColor = ConsoleColor.White;
                            Console.WriteLine($"Press enter to continue!");
                            Console.ReadLine();
                        }
                        else
                        {
                            Console.WriteLine($"The monster is dead");
                            exit = true;
                        }
                    }
                    else
                    {
                        Console.WriteLine($"You do not see a {noun}");
                        exit = true;
                    }
                }
                else
                {
                    Console.WriteLine("There is nothing to attack here.");
                    exit = true;
                }
            } while (exit == false);
        }