Пример #1
0
        static public bool Battle(Monster monster, CharacterClass character, int whatheading)
        {
            Console.Clear();
            bool fightContinue = true;
            bool fightOutCome  = false;

            while (fightContinue)
            {
                if (character.Health < 10)
                {
                    Console.WriteLine("You cannot continue or start a fight with lower health than 10hp \nPlease visit The Tavern or vendor and buy potion");
                    fightContinue = false;
                    fightOutCome  = false;
                }
                while (fightContinue)
                {
                    Console.Clear();
                    switch (whatheading)
                    {
                    case 1:
                        AsciiArt.WoodsArt();
                        AsciiArt.WoodsTitle();
                        break;

                    case 2:
                        AsciiArt.PitsTitle();
                        break;

                    case 3:
                        AsciiArt.MountainHeading();
                        AsciiArt.BossTitle();
                        break;
                    }
                    if (monster is Creature)
                    {
                        Creature tempCreature = (Creature)monster;
                        tempCreature.PrintMonsterInfo();
                    }
                    else if (monster is Boss)
                    {
                        Boss tempBoss = (Boss)monster;
                        tempBoss.PrintMonsterInfo();
                    }
                    character.ClassBattlePrint();

                    //make method that returns 2 values
                    Console.WriteLine("1. Standard Attack");
                    Console.WriteLine("2. Special Attack");
                    Console.WriteLine("3. Take Health Potion");
                    Console.WriteLine("4. Flee");
                    string battleInput = Console.ReadLine();
                    switch (battleInput)
                    {
                    case "1":
                        monster.TakeDmg(character.DoDmg());
                        character.TakeDmg(monster.DoDmg());
                        break;

                    case "2":
                        character.SpecialAttackdmg(monster);
                        break;

                    case "3":
                        character.TakePotion();

                        break;

                    case "4":
                        if (character.DmgUpperBound > monster.DmgHigherBound)
                        {
                            Console.WriteLine("You managed to flee the battle... you coward...");
                            fightContinue = false;
                            fightOutCome  = false;
                        }
                        else
                        {
                            Console.WriteLine("You cannot flee you must stay and face the consequences");
                        }
                        break;

                    default:
                        Console.WriteLine("There is no such alternativ, try to focus.. \nIf your nervous you can always flee..");
                        break;
                    }
                    if (monster.Health <= 0)
                    {
                        monster.MonsterDied(monster, character);

                        fightContinue = false;
                        fightOutCome  = true;
                    }
                    else if (character.Health <= 10)
                    {
                        Console.WriteLine("Your health is to low you cannot continue..");
                        fightContinue = false;
                        fightOutCome  = false;
                    }
                    Console.WriteLine("Press anykey..");
                    Console.ReadKey();
                    Console.Clear();
                }
                ;
            }
            ;
            return(fightOutCome);
        }