lolblach333

Untitled

Apr 18th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace IMJunior
  4. {
  5. class Program
  6. {
  7. private static int age = 0, strength = 0, agility = 0, intelligence = 0, points = 25;
  8. private static string strengthVisual = string.Empty, agilityVisual = string.Empty, intelligenceVisual = string.Empty;
  9.  
  10. static void Inti()
  11. {
  12.  
  13. Console.WriteLine("Добро пожаловать в меню выбора создания персонажа!");
  14. Console.WriteLine("У вас есть 25 очков, которые вы можете распределить по умениям");
  15. Console.WriteLine("Нажмите любую клавишу чтобы продолжить...");
  16. Console.ReadKey();
  17. }
  18.  
  19. static void Main(string[] args)
  20. {
  21. Inti();
  22. Hat();
  23. }
  24.  
  25. static void Hat()
  26. {
  27. while (points > 0)
  28. {
  29.  
  30. pososi();
  31. Console.WriteLine("Поинтов - {0}", points);
  32. Console.WriteLine("Какую характеристику вы хотите изменить?");
  33. string subject = Console.ReadLine();
  34.  
  35. Console.WriteLine(@"Что вы хотите сделать? +\-");
  36. string operation = Console.ReadLine();
  37.  
  38. Console.WriteLine(@"Колличество поинтов которые следует {0}", operation == "+" ? "прибавить" : "отнять");
  39.  
  40. string operandPointsRaw = string.Empty;
  41. int operandPoints = 0;
  42. do
  43. {
  44. operandPointsRaw = Console.ReadLine();
  45. } while (!int.TryParse(operandPointsRaw, out operandPoints));
  46.  
  47. switch (subject.ToLower())
  48. {
  49. case "сила":
  50. if (operation == "+")
  51. {
  52. int overhead = operandPoints - (10 - strength);
  53. overhead = overhead < 0 ? 0 : overhead;
  54. operandPoints -= overhead;
  55. }
  56. else
  57. {
  58. int overhead = strength - operandPoints;
  59. overhead = overhead < 0 ? overhead : 0;
  60. operandPoints += overhead;
  61. }
  62.  
  63. strength = operation == "+" ? strength + operandPoints : strength - operandPoints;
  64. points = operation == "+" ? points - operandPoints : points + operandPoints;
  65. break;
  66. case "ловкость":
  67. if (operation == "+")
  68. {
  69. int overhead = operandPoints - (10 - agility);
  70. overhead = overhead < 0 ? 0 : overhead;
  71. operandPoints -= overhead;
  72. }
  73. else
  74. {
  75. int overhead = agility - operandPoints;
  76. overhead = overhead < 0 ? overhead : 0;
  77. operandPoints += overhead;
  78. }
  79.  
  80. agility = operation == "+" ? agility + operandPoints : agility - operandPoints;
  81. points = operation == "+" ? points - operandPoints : points + operandPoints;
  82. break;
  83. case "интелект":
  84. if (operation == "+")
  85. {
  86. int overhead = operandPoints - (10 - intelligence);
  87. overhead = overhead < 0 ? 0 : overhead;
  88. operandPoints -= overhead;
  89. }
  90. else
  91. {
  92. int overhead = intelligence - operandPoints;
  93. overhead = overhead < 0 ? overhead : 0;
  94. operandPoints += overhead;
  95. }
  96.  
  97. intelligence = operation == "+" ? intelligence + operandPoints : intelligence - operandPoints;
  98. points = operation == "+" ? points - operandPoints : points + operandPoints;
  99. break;
  100. }
  101. }
  102.  
  103. Console.WriteLine("Вы распределили все очки. Введите возраст персонажа:");
  104. string ageRaw = string.Empty;
  105. do
  106. {
  107. ageRaw = Console.ReadLine();
  108. } while (int.TryParse(ageRaw, out age));
  109.  
  110.  
  111. pososi();
  112.  
  113. }
  114. static void pososi()
  115. {
  116. Console.Clear();
  117. strengthVisual = string.Empty;
  118. agilityVisual = string.Empty;
  119. intelligenceVisual = string.Empty;
  120. strengthVisual = strengthVisual.PadLeft(strength, '#').PadRight(10, '_');
  121. agilityVisual = agilityVisual.PadLeft(agility, '#').PadRight(10, '_');
  122. intelligenceVisual = intelligenceVisual.PadLeft(intelligence, '#').PadRight(10, '_');
  123. Console.WriteLine("Возраст - {0}\nСила - [{1}]\nЛовкость - [{2}]\nИнтелект - [{3}]", age, strengthVisual, agilityVisual, intelligenceVisual);
  124. }
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment