Esempio n. 1
0
        static public void Pits(CharacterClass character)  // Done
        {
            Console.WriteLine("Now its time to display your power see how long you can last...");
            int pitsBattleCounter = 0;

            character.SpecialAttackCounter = 0;
            bool battleOutCome  = false;
            bool battleContinue = true;

            Console.ReadKey();
            Console.Clear();
            Random   monsterSizeRand = new Random();
            Creature pitsMonster;

            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = Environment.CurrentDirectory + @"\Pits.wav";
            player.PlayLooping();

            while (battleContinue)
            {
                battleOutCome = false;
                AsciiArt.PitsTitle();
                Console.WriteLine($"This is your battle no {pitsBattleCounter + 1} of max 10 in a row.");
                Console.WriteLine("Next Monster is already ready.. ");
                Console.WriteLine("Get ready to fight!");
                Console.ReadKey();
                Console.Clear();

                if (pitsBattleCounter < 9)
                {
                    pitsMonster = new Creature(monsterSizeRand.Next(4, 7), pitsBattleCounter + 1);
                }
                else
                {
                    pitsMonster = new Creature(7, 10);
                }

                battleOutCome = Battle(pitsMonster, character, 2);
                if (battleOutCome)
                {
                    pitsBattleCounter++;
                }
                else
                {
                    battleContinue = false;
                    Console.WriteLine($"You manage to beat {pitsBattleCounter} Opponents, Get some better gear and you might climb to the top.");
                }
                if (pitsBattleCounter == 10)
                {
                    Console.WriteLine($"Congratiulations {character.Name} You managed to fight your way up to the top of the pits. \nYour name will be remembered for all time!! "); // insert awesome reward
                    character.AddWeaponToInventory(new Weapon(1, 13));
                    battleContinue = false;
                }
            }
            Console.ReadKey();
            Console.Clear();
            player.Stop();
        }
Esempio n. 2
0
        public override void MonsterDied(Monster monster, CharacterClass character)
        {
            Creature temporaryCreature = (Creature)monster;
            Random   typeOfLoot        = new Random();

            Console.WriteLine($"You vanquised {Name}, and looted {monster.GoldValue} Gold and {monster.ExperienceValue}xp");
            Console.WriteLine($"And a random item .... ");
            if (typeOfLoot.Next(1, 3) == 1)
            {
                Weapon weaponLoot = RandomWeapon(QualityGenerator(monster));
                character.AddWeaponToInventory(weaponLoot);
            }
            else
            {
                Shield shieldLoot = RandomShield(QualityGenerator(monster));
                character.AddShieldToInventory(shieldLoot);
            }
            character.ExperienceGained(monster.ExperienceValue);
            character.Gold += monster.GoldValue;
        }
Esempio n. 3
0
        static public void UpgradeWeapon(CharacterClass character, Weapon currentWeapon, int weaponCraftingCost) // Done
        {
            string reRollItem = "";

            if ((int)currentWeapon.ItemQuality < 12)
            {
                if (character.Gold >= weaponCraftingCost && character.CraftingMaterial >= weaponCraftingCost)
                {
                    character.Gold             -= weaponCraftingCost;
                    character.CraftingMaterial -= weaponCraftingCost;
                    Weapon newWeapon = UpgradeWeapon(currentWeapon);

                    Console.WriteLine($"Old Weapon \n" + currentWeapon);
                    character.UserInventory.Remove(currentWeapon);
                    character.AddWeaponToInventory(newWeapon);

                    var p1 = new System.Windows.Media.MediaPlayer();
                    p1.Open(new System.Uri(Environment.CurrentDirectory + @"\cash.wav"));
                    p1.Play();
                }
                else
                {
                    Console.WriteLine("You cannot afford that... \nCheck that you have enough gold or materials");
                    Console.ReadKey();
                }
            }
            else
            {
                Console.WriteLine("You cannot upgrade that its fully upgraded.");
                Console.WriteLine("Would you like to reroll the stats for the current weapon? ");
                Console.WriteLine("Cost: 1000g");
                Console.WriteLine("1. Yes");
                Console.WriteLine("2. No");
                reRollItem = Console.ReadLine();
                switch (reRollItem)
                {
                case "1":
                    if (character.Gold >= 1000)
                    {
                        character.Gold -= 1000;
                        Weapon newWeapon = new Weapon((int)currentWeapon.TypeOfWeapon, (int)currentWeapon.ItemQuality);
                        Console.WriteLine($"Old Weapon \n" + currentWeapon);
                        character.UserInventory.Remove(currentWeapon);
                        character.AddWeaponToInventory(newWeapon);
                    }
                    else
                    {
                        Console.WriteLine("Come Back When you can pay me..");
                    }
                    break;

                case "2":
                    Console.WriteLine("(The Blacksmith) -Maybe you should, never know what can happen!!!");
                    break;

                default:
                    Console.WriteLine("(Luis) -Stop trying to ruin the game!!!");
                    break;
                }
            }
        }
Esempio n. 4
0
        public void BuyWeapons(CharacterClass character) // Done
        {
            string buyWep = "y";
            int    whatWeaponID;

            do
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.DarkYellow;

                Console.WriteLine("This is what i have for you..");
                Console.WriteLine("---------------------------------------------------------");
                Console.WriteLine("                 Weapons Inventory");
                Console.WriteLine("---------------------------------------------------------");
                for (int i = 0; i < StoreWeaponInventory.Count; i++)
                {
                    Console.WriteLine($"Id:{i + 1}. {StoreWeaponInventory[i].ItemQuality} {StoreWeaponInventory[i].TypeOfWeapon}".PadRight(25) +
                                      $"Dmg ({StoreWeaponInventory[i].DmgLowerBound} - {StoreWeaponInventory[i].DmgUpperBound})".PadRight(16) + $"Price: {StoreWeaponInventory[i].Price}");
                }
                Console.WriteLine("");
                Console.WriteLine("0. Not Interested");
                Console.WriteLine("---------------------------------------------------------");
                character.PrintInfoForShop();

                Weapon currentWeapon = character.UserInventory.OfType <Weapon>().FirstOrDefault(w => w.Equipped == true);


                if (currentWeapon != null)
                {
                    Console.WriteLine("Equipped Weapon");
                    Console.WriteLine($"{currentWeapon.ItemQuality} {currentWeapon.TypeOfWeapon} Dmg: ({currentWeapon.DmgLowerBound} - {currentWeapon.DmgUpperBound})");
                    Console.WriteLine("---------------------------------------------------------");
                }

                Console.WriteLine("What ID number would you like to purchase?");
                if (int.TryParse(Console.ReadLine(), out whatWeaponID))
                {
                    if (whatWeaponID <= StoreWeaponInventory.Count && whatWeaponID > 0)
                    {
                        if (character.Gold >= StoreWeaponInventory[whatWeaponID - 1].Price)
                        {
                            if (character.Charisma >= 10)
                            {
                                Console.WriteLine("(Vendor) -You know what I like you, i will give it to you for half price.. ");
                                Console.WriteLine("Dont tell anyone..");
                                character.Gold -= StoreWeaponInventory[whatWeaponID - 1].Price / 2;
                                Console.WriteLine($"{StoreWeaponInventory[whatWeaponID - 1].Price / 2} gold has been removed..");
                            }
                            else
                            {
                                character.Gold -= StoreWeaponInventory[whatWeaponID - 1].Price;
                                Console.WriteLine($"{StoreWeaponInventory[whatWeaponID - 1].Price} has been removed..");
                            }
                            var p1 = new System.Windows.Media.MediaPlayer();
                            p1.Open(new System.Uri(Environment.CurrentDirectory + @"\cash.wav"));
                            p1.Play();
                            Console.WriteLine("Congratulations you have bought a new Item");
                            character.AddWeaponToInventory(StoreWeaponInventory[whatWeaponID - 1]);
                            buyWep = "n";
                            StoreWeaponInventory.RemoveAt(whatWeaponID - 1);
                        }
                        else
                        {
                            Console.WriteLine("You cannot afford this.. Maybe start out with something smaller?");
                            Console.ReadKey();
                        }
                    }
                    else if (whatWeaponID == 0)
                    {
                        Console.WriteLine("Okeeeeey So what are you doing in here?????");
                        Console.ReadKey();
                        buyWep = "n";
                    }
                    else
                    {
                        Console.WriteLine($"Please try a number between 1-{StoreWeaponInventory.Count}, or 0 to exit..");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.WriteLine($"I didnt understand that, Please try a number between 1-{StoreWeaponInventory.Count}, or 0 to exit..");
                    Console.ReadKey();
                }
            } while (buyWep != "n");
        }