Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace IMJunior
- {
- class Program
- {
- static void Main(string[] args)
- {
- int age = 0, strength = 0, agility = 0, intelligence = 0, points = 25;
- string strengthVisual = string.Empty, agilityVisual = string.Empty, intelligenceVisual = string.Empty;
- Console.WriteLine("Добро пожаловать в меню выбора создания персонажа!");
- Console.WriteLine("У вас есть 25 очков, которые вы можете распределить по умениям");
- Console.WriteLine("Нажмите любую клавишу чтобы продолжить...");
- Console.ReadKey();
- while (points > 0)
- {
- Console.Clear();
- Operation2raza(ref strengthVisual, ref agilityVisual, ref intelligenceVisual, ref age, ref strength, ref agility, ref intelligence, ref points);
- Console.WriteLine("Какую характеристику вы хотите изменить?");
- string subject = Console.ReadLine();
- Console.WriteLine(@"Что вы хотите сделать? +\-");
- string operation = Console.ReadLine();
- Console.WriteLine(@"Количество поинтов которые следует {0}", operation == "+" ? "прибавить" : "отнять");
- string operandPointsRaw = string.Empty;
- int operandPoints = 0;
- do
- {
- operandPointsRaw = Console.ReadLine();
- } while (!int.TryParse(operandPointsRaw, out operandPoints));
- //СВИТЧ сделан
- switch (subject.ToLower())
- {
- case "сила":
- if (operation == "+")
- {
- OperationPlus(ref strength, ref operandPoints);
- }
- else
- {
- OperationMinus(ref strength, ref operandPoints);
- }
- OperationHZ(ref strength, ref points, ref operation, ref operandPoints);
- break;
- case "ловкость":
- if (operation == "+")
- {
- OperationPlus(ref agility, ref operandPoints);
- }
- else
- {
- OperationMinus(ref agility, ref operandPoints);
- }
- OperationHZ(ref agility, ref points, ref operation, ref operandPoints);
- break;
- case "интеллект":
- if (operation == "+")
- {
- OperationPlus(ref intelligence, ref operandPoints);
- }
- else
- {
- OperationMinus(ref intelligence, ref operandPoints);
- }
- OperationHZ(ref intelligence, ref points, ref operation, ref operandPoints);
- break;
- }
- }
- Console.WriteLine("Вы распределили все очки. Введите возраст персонажа:");
- string ageRaw = string.Empty;
- do
- {
- ageRaw = Console.ReadLine();
- if (int.TryParse(ageRaw, out age))
- break;
- } while (true);
- Console.Clear();
- Operation2raza(ref strengthVisual, ref agilityVisual, ref intelligenceVisual,ref age,ref strength,ref agility,ref intelligence,ref points);
- }
- static void OperationPlus(ref int value, ref int point)
- {
- int overhead = point - (10 - value);
- overhead = overhead < 0 ? 0 : overhead;
- point -= overhead;
- }
- static void OperationMinus(ref int value, ref int point)
- {
- int overhead = value - point;
- overhead = overhead < 0 ? overhead : 0;
- point += overhead;
- }
- static void OperationHZ(ref int value, ref int points, ref string operation, ref int operand)
- {
- if (operand <= points)
- {
- value = operation == "+" ? value + operand : value - operand;
- points = operation == "+" ? points - operand : points + operand;
- }
- }
- static void Operation2raza(ref string strV, ref string agiV, ref string intV,ref int age,ref int str,ref int agi,ref int inte,ref int points)
- {
- strV = string.Empty;
- agiV = string.Empty;
- intV = string.Empty;
- strV = strV.PadLeft(str, '#').PadRight(10, '_');
- agiV = agiV.PadLeft(agi, '#').PadRight(10, '_');
- intV = intV.PadLeft(inte, '#').PadRight(10, '_');
- Console.WriteLine("Поинтов - {0}", points);
- Console.WriteLine("Возраст - {0}\nСила - [{1}]\nЛовкость - [{2}]\nИнтеллект - [{3}]", age, strV, agiV, intV);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement