public void CreateCharacter()
        {
            Console.WriteLine($"\n What type of character would you like to create \n (1) Super Hero \n (2) Vilan");

            do
            {
                input = Console.ReadLine();
                if (ValidationLogic.CheckDegit(input))
                {
                    input1 = ValidationLogic.ConvertValue(input);
                    if (input1 == 1)
                    {
                        AddCharacter(superHero);
                        break;
                    }
                    else if (input1 == 2)
                    {
                        AddCharacter(vilan);
                        break;
                    }
                    else
                    {
                        ValidationLogic.InvalidOption();
                    }
                }
                else
                {
                    ValidationLogic.InvalidIpnut();
                }
            } while (true);
        }
示例#2
0
        public void GetFigthers(List <Character> fighter, List <Character> challenger)
        {
            Console.WriteLine($"\n Select your fight to with from the following :");
            ListCharacters(fighter);
            do
            {
                input = ReadLines();
                if (ValidationLogic.CheckDegit(input))
                {
                    input1 = ValidationLogic.ConvertValue(input);
                    if (!(fighter.Find(x => x.Id == input1) == null))
                    {
                        fighterId = input1;
                        Console.WriteLine($"\n Select Oponent from the following To fight with");
                        ListCharacters(challenger);

                        break;
                    }
                    else
                    {
                        ValidationLogic.InvalidOption();
                    }
                }
                //ValidationLogic.InvalidIpnut();
            } while (true);
            //after selecting fighter and oponent

            do
            {
                input = ReadLines();
                if (ValidationLogic.CheckDegit(input))
                {
                    input1 = ValidationLogic.ConvertValue(input);
                    if (!(challenger.Find(x => x.Id == input1) == null))
                    {
                        challengerId = input1;
                        //now fight can begit
                        if (GetStrenght(fighterId, fighter) < GetStrenght(challengerId, challenger))
                        {
                            Console.WriteLine("\n ---------------------------Game Over-----------------------------------------------------------------\n" +
                                              "Sorry you lost yuor challenger was more powerfull than you");
                            break;
                        }
                        else
                        {
                            Console.WriteLine($"\n ---------------------------Game Over-----------------------------------------------------------------\n " +
                                              $"Congratulations you won!!!!!!!!!!!!");
                            break;
                        }
                    }
                }
            } while (true);
        }