예제 #1
0
        private void ArmorsAvaliableForSell(Player customer)
        {
            var listOfArmorNames = armorsToSell.Keys.ToList();
            var listOfArmorPrices = armorsToSell.Values.ToList();
            int choice;
            bool parseSuccessfull;
            do
            {
                ;
                PrintDesign.WriteLineInGreen($"\nGold in wallet: {customer.Gold}");
                PrintDesign.PrintShop(armorsToSell);
                Console.Write("Number: ");

                parseSuccessfull = int.TryParse(Console.ReadLine(), out choice);

                if (choice <= 0)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Chosen number to small!");
                }
                else if (parseSuccessfull == false)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Something went wrong!");
                }
                else if (choice >= 4)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Chosen number to high!");
                }

            } while (choice >= 4 || choice <= 0 || parseSuccessfull == false);

            if (listOfArmorPrices[choice - 1] > customer.Gold)
            {
                Console.Clear();
                PrintDesign.WriteLineInRed($"You dont have enough money to buy {listOfArmorNames[choice - 1]}!");
            }

            else if (customer.Armor.Contains(listOfArmorNames[choice - 1]))
            {
                Console.Clear();
                PrintDesign.WriteLineInRed($"You already {listOfArmorNames[choice - 1]}!");
            }
            else
            {
                PrintDesign.WriteLineInGreen($"\n{listOfArmorNames[choice - 1]} bought and equipped!");
                customer.Armor = listOfArmorNames[choice - 1];
                customer.Gold -= listOfArmorPrices[choice - 1];

                if (choice == 1)
                {
                    customer.MaxBlock -= ExtraDefenceFromArmor; // tar bort nuvarande bonusen från armor
                    ExtraDefenceFromArmor = 3;
                    customer.MaxBlock += ExtraDefenceFromArmor; // addrar bonusen från den nyköpta armor
                }
                if (choice == 2)
                {
                    customer.MaxBlock -= ExtraDefenceFromArmor;
                    ExtraDefenceFromArmor = 5;
                    customer.MaxBlock += ExtraDefenceFromArmor;
                }
                if (choice == 3)
                {
                    customer.MaxBlock -= ExtraDefenceFromArmor;
                    ExtraDefenceFromArmor = 7;
                    customer.MaxBlock += ExtraDefenceFromArmor;
                }

            }
        }
예제 #2
0
        private void SpecialItemsAvaliableForSell(Player customer)
        {

            var listOfItemNames = specialItemsToSell.Keys.ToList();  // hämmtar namnet på special item till salu
            var listOfItemPrices = specialItemsToSell.Values.ToList(); // hämtar värdet på special item till salu.
            int choice;
            bool parseSuccessfull;
            do
            {
                
                PrintDesign.WriteLineInGreen($"\nGold in wallet: {customer.Gold}");
                PrintDesign.PrintShop(specialItemsToSell);
                Console.Write("Number: ");

                parseSuccessfull = int.TryParse(Console.ReadLine(), out choice);

                if (choice < 0)
                {
                    PrintDesign.WriteLineInRed("Chosen number to small!");
                }
                else if (parseSuccessfull == false)
                {
                    PrintDesign.WriteLineInRed("Something went wrong!");
                }
                else if (choice > 4)
                {
                    PrintDesign.WriteLineInRed("Chosen number to high!");
                }

            } while (choice >= 4 || choice <= 0 || parseSuccessfull == false);

            if (listOfItemPrices[choice - 1] > customer.Gold)
            {
                Console.Clear();
                PrintDesign.WriteLineInRed($"You dont have enough money to buy {listOfItemNames[choice - 1]}!");
            }

            else if (customer.SpecialItem == listOfItemNames[choice - 1])
            {
                Console.Clear();
                PrintDesign.WriteLineInRed($"You already own {listOfItemNames[choice - 1]}!");
            }
            else
            {
                Console.Clear();
                PrintDesign.WriteLineInGreen($"\n{listOfItemNames[choice - 1]} bought and equipped!");
                customer.SpecialItem = listOfItemNames[choice - 1]; // adderar special item till spelaren
                customer.Gold -= listOfItemPrices[choice - 1]; // tar bort det antal guld från spelaren som den köpta varan kostar.

                if (choice == 1)
                {
                    customer.Health -= ExtraHealthFromItems;
                    ExtraHealthFromItems = 1;
                    customer.Health += ExtraHealthFromItems;
                }
                if (choice == 2)
                {
                    customer.Health -= ExtraHealthFromItems;
                    ExtraHealthFromItems = 2;
                    customer.Health += ExtraHealthFromItems;
                }
                if (choice == 3)
                {
                    customer.Health -= ExtraHealthFromItems;
                    ExtraHealthFromItems = 3;
                    customer.Health += ExtraHealthFromItems;
                }

            }
        }
예제 #3
0
        private void WeaponAvailableForSell(Player customer)
        {
            var listOfWeaponNames = weaponsToSell.Keys.ToList();
            var listOfWeaponPrices = weaponsToSell.Values.ToList();
            int choice;
            bool parseSuccessfull;

            Console.Clear();
            Console.WriteLine($"Weapons avaliable for the {customer.FightClass}:");
            do
            {
                
                PrintDesign.WriteLineInGreen($"\nGold in wallet: {customer.Gold}");
                PrintDesign.PrintShop(weaponsToSell);
                Console.Write("Number: ");

                parseSuccessfull = int.TryParse(Console.ReadLine(), out choice);

                if (choice <= 0)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Chosen number to small!");
                }
                else if (parseSuccessfull == false)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Something went wrong!");
                }
                else if (choice >= 4)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Chosen number to high!");
                }

            } while (choice >= 4 || choice <= 0 || parseSuccessfull == false);

            if (listOfWeaponPrices[choice - 1] > customer.Gold)
            {
                Console.Clear();
                PrintDesign.WriteLineInRed($"You dont have enough money to buy {listOfWeaponNames[choice - 1]}!");
            }

            else if (customer.Weapon == listOfWeaponNames[choice - 1])
            {
                Console.Clear();
                PrintDesign.WriteLineInRed($"You already own {listOfWeaponNames[choice - 1]}!");
            }
            else
            {
                Console.Clear();
                PrintDesign.WriteLineInGreen($"\n{listOfWeaponNames[choice - 1]} bought and equipped!");
                customer.Weapon = listOfWeaponNames[choice - 1];
                customer.Gold -= listOfWeaponPrices[choice - 1];

                if (choice == 1)
                {
                    customer.MaxDmg -= ExtraDamageFromWeapons;
                    ExtraDamageFromWeapons = 3;
                    customer.MaxDmg += ExtraDamageFromWeapons;
                }
                if (choice == 2)
                {
                    customer.MaxDmg -= ExtraDamageFromWeapons;
                    ExtraDamageFromWeapons = 5;
                    customer.MaxDmg += ExtraDamageFromWeapons;
                }
                if (choice == 3)
                {
                    customer.MaxDmg -= ExtraDamageFromWeapons;
                    ExtraDamageFromWeapons = 7;
                    customer.MaxDmg += ExtraDamageFromWeapons;
                }
            }
        }