// Покупка аптечек private void ByeMedicineKit(Player player) { HelloPlayer(player); Console.WriteLine("Вы можете купить стандартную аптечку:\n50 единиц здоровья за 30 монет"); Console.WriteLine("Но вы можете заказать с любым числом здоровья"); Console.WriteLine("Стоить будет это 1.6 hp за 1 монету"); Console.WriteLine("S для стандартной,\nN для своей,\nEsc для выхода"); switch (Console.ReadKey(true).Key) { case ConsoleKey.S: MainGameStructures.MedicineKit medicineKit = new MainGameStructures.MedicineKit { HpToAdd = 50 }; if (player.HaveMoney(30)) { player.MedicineKits.Add(medicineKit); } break; case ConsoleKey.N: Console.WriteLine("Введите нужную емкость"); int t = Program.Parse(Console.ReadLine()); if (player.HaveMoney((int)(t / 1.6))) { player.MedicineKits.Add(new MainGameStructures.MedicineKit { HpToAdd = t }); } break; case ConsoleKey.Escape: return; } }
// Магазин,где игрок может приобрести комплект брони public void ArmorShopPay(Player player) { HelloPlayer(player); int i = 0; foreach (var t in Program.ArmorComplects) { Console.WriteLine("{5}: {0}, {1}, {2}, {3}, {4}", t.Head.Name, t.Body.Name, t.Arms.Name, t.Leggs.Name, t.Boots.Name, ++i); } Console.WriteLine(); ArmorComplect armor = GetChoice(); if (armor.GetCost(RealCosts["armor"]) == 0) { return; } if (player.HaveMoney(armor.GetCost(RealCosts["armor"]))) { player.AddArmor(armor); Console.WriteLine("вы купили комплект брони"); } else { Console.WriteLine("у вас недостаточно средств для покупки"); } }
// Здесь можно купить лук private void BowStore(Player player) { HelloPlayer(player); PrintForShops(); for (int i = 0; i < Program.Bows.Count; i++) { Console.Clear(); WriteCharacteristics(Program.Bows[i].GetCharacteristics(true, RealCosts["bow"])); switch (Console.ReadKey(true).Key) { case ConsoleKey.Y: if (player.Level >= Program.Bows[i].MinLevelToUse && player.HaveMoney((int)(Program.Bows[i].Cost * RealCosts["bow"]))) { Console.WriteLine("Вы приобрели {0}", Program.Bows[i].Name); player.Bow = Program.Bows[i]; return; } break; case ConsoleKey.Escape: return; } } }
// Здесь можно купить защитные предметы private void ProtectionStore(Player player) { Console.Clear(); HelloPlayer(player); PrintForShops(); foreach (var protection in Program.ProtectionThings) { WriteCharacteristics(protection.GetCharacteristics()); switch (Console.ReadKey(true).Key) { case ConsoleKey.Y: if (player.HaveMoney((int)((protection.Cost * RealCosts["armor"])))) { Console.WriteLine("Вы приобрели {0}", protection.Name); player.TryOnProtection(protection); return; } break; case ConsoleKey.Escape: return; } Console.Clear(); } }
// Личебница, игрок может здесь восстановить здоровье public void Hospital(Player player) { Console.WriteLine("Ваш баланс: {0}", player.Money); Console.WriteLine("Вы можете восстановить {0} здоровья", player.MaxHealth - player.CurrentHealth); Console.WriteLine("Цена: 1 монета за {0} единиц здоровья", this.OneCoinCountHP * RealCosts["health"]); Console.WriteLine("Сколько вы хотите восстановить?"); int hp = Program.Parse(Console.ReadLine()); if (player.HaveMoney(hp / (int)(this.OneCoinCountHP * RealCosts["health"]))) { player.AddHP(hp); } Console.WriteLine("Ваше здоровье теперь составляет {0}", player.CurrentHealth); }
// Кузница, здесь игрок может починить свою броню public void ForgeArmor(Player player) { HelloPlayer(player); Console.WriteLine("Вы можете восстановить {0} единиц брони по стоимости 1 монета за {1} брони.", player.Armor.GetHealthToAdd(), player.Armor.GetOnHPCost() * RealCosts["armor"]); Console.WriteLine("Введите число единиц, которое вы хотите восстановить."); int additionCount = Program.Parse(Console.ReadLine(), 0, 1e18); if (player.HaveMoney((int)(additionCount / (player.Armor.GetOnHPCost() * RealCosts["armor"])))) { player.Armor.Repair(additionCount); Console.WriteLine("Вы восстановили {0} единиц", additionCount); WriteCharacteristics(player.Armor.GetCharacteristics()); } else { Console.WriteLine("У вас недостаточно средств"); } }