Program.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Collections.Generic;
  3. class Player
  4. {
  5. public string Name { get; set; }
  6. public string Hero { get; set; }
  7. public Player(string name)
  8. {
  9. Name = name;
  10. }
  11. public void Display()
  12. {
  13. Console.WriteLine($"{Name}");
  14. }
  15. public void PickHero(string hero)
  16. {
  17. Hero = hero;
  18. Console.WriteLine($"{Name} выбрал героя: {Hero}");
  19. }
  20. public void PickItems(List<Item> items)
  21. {
  22. Console.WriteLine($"{Name} пикает предметы:");
  23. foreach (var item in items)
  24. {
  25. Console.WriteLine($"- {item.ItemName}");
  26. }
  27. }
  28. public void BuyItem(Item item)
  29. {
  30. Console.WriteLine($"{Name} купил предмет: {item.ItemName}");
  31. }
  32. }
  33. class Item
  34. {
  35. public string ItemName { get; set; }
  36. public Item(string itemName)
  37. {
  38. ItemName = itemName;
  39. }
  40. public void Display()
  41. {
  42. Console.WriteLine($"{ItemName}");
  43. }
  44. }
  45. class Program
  46. {
  47. static void Main(string[] args)
  48. {
  49. Player player1 = new Player("h1mera");
  50. // Выбираем героя
  51. player1.PickHero("Invoker");
  52. // Список предметов
  53. List<Item> itemsToPick = new List<Item>
  54. {
  55. new Item("Desolator"),
  56. new Item("Daedalus"),
  57. new Item("Butterfly"),
  58. new Item("Silver Edge"),
  59. new Item("Power Treads"),
  60. new Item("Satanic"),
  61. new Item("Refresher Orb"),
  62. new Item("Scythe of Wyse"),
  63. new Item("Travel Boots"),
  64. new Item("Octarine Core"),
  65. new Item("Blink Dagger"),
  66. new Item("Bloodthorn"),
  67. new Item("Aghanim Scepter"),
  68. new Item("Bloodstone"),
  69. new Item("Abbysal Blade"),
  70. new Item("Heart of Tarrasque"),
  71. new Item("Phase Boots"),
  72. new Item("Eternal Shroud"),
  73. new Item("Boots of Bearing"),
  74. new Item("Arcane Blink"),
  75. new Item("Aghanim Bleesing"),
  76. new Item("Glimmer Cape"),
  77. new Item("Divine Rapier"),
  78. new Item("Wind Waker"),
  79. };
  80. // Покупаем предмет
  81. Item itemToBuy1 = new Item("Refresher Orb");
  82. Item itemToBuy2 = new Item("Scythe of Wyse");
  83. Item itemToBuy3 = new Item("Travel Boots");
  84. Item itemToBuy4 = new Item("Blink Dagger");
  85. Item itemToBuy5 = new Item("Octarine Core");
  86. Item itemToBuy6 = new Item("Bloodthorn");
  87. player1.BuyItem(itemToBuy1);
  88. player1.BuyItem(itemToBuy2);
  89. player1.BuyItem(itemToBuy3);
  90. player1.BuyItem(itemToBuy4);
  91. player1.BuyItem(itemToBuy5);
  92. player1.BuyItem(itemToBuy6);
  93. }
  94. }