public FightLogic() { Heros1 = new List <Character>() { new SuperHero(1, "Logan", 70, 50, 90, 270, SuperPowrLogic.GetPowers()), new SuperHero(2, "Iron Man", 70, 50, 80, 340, SuperPowrLogic.GetPowers()), new SuperHero(3, "Wolverine", 70, 50, 80, 300, SuperPowrLogic.GetPowers()), }; Vilans1 = new List <Character>() { new Vilan(1, "Jocker", 70, 50, 90, 200, SuperPowrLogic.GetVilanPowers()), new Vilan(2, "Thanos", 70, 50, 80, 500, SuperPowrLogic.GetVilanPowers()), new Vilan(3, "Sand Man", 70, 50, 80, 450, SuperPowrLogic.GetVilanPowers()), }; }
public void AddCharacter(Character character) { Console.WriteLine("Enter character name"); character.Name = Console.ReadLine(); Console.WriteLine("Eneter Health rarting from between 1 and 100"); do { input = Console.ReadLine(); if (ValidationLogic.CheckDegit(input)) { input1 = ValidationLogic.ConvertValue(input); if (input1 > 0 && input1 <= 100) { character.Health = input1; break; } else { ValidationLogic.InvalidIpnut(); } } ValidationLogic.InvalidIpnut(); } while (true); Console.WriteLine("Eneter ability rarting from between 1 and 100"); input = Console.ReadLine(); if (input.All(Char.IsDigit)) { int.TryParse(input, out input1); if (input1 > 0 && input1 <= 100) { character.Ability = input1; } } Console.WriteLine("Eneter strength rarting from between 1 and 100"); input = Console.ReadLine(); if (input.All(Char.IsDigit)) { int.TryParse(input, out input1); if (input1 > 0 && input1 <= 100) { character.Strenght = input1; } } Console.WriteLine("Eneter 1 to add super power and 2 to finish"); input = Console.ReadLine(); input1 = ValidationLogic.ConvertValue(input); while (input1 != 2) { character.SuperPowers.Add(SuperPowrLogic.AcceptPowers()); input1 = ValidationLogic.ConvertValue(Console.ReadLine()); } if (ValidationLogic.CheckDegit(input)) { input1 = ValidationLogic.ConvertValue(input); if (input1 >= 0 && input1 <= 100) { character.Strenght = input1; } } Console.WriteLine($"\n Character created.....\n Overall Power : {character.CalcImpact()} \n Attack Power : {character.CalcImpact()}" + $"\n Defence Power : {character.Defend()} \n Super Powers :"); character.DisplayPowers(); character.TotalImpact = character.CalcImpact(); characters.Add(character); }