The problem is that i can’t get out of the do while loop
It should go out if dragonHealth or heroHealth is below zero or zero
any ideas ? much appreciated
do
{
Console.WriteLine("The dragon wakes up !");
Console.WriteLine("and the fight begins...");
Console.WriteLine("Press any key to continue!");
Console.ReadLine();
Found:
Console.WriteLine("Your health: {0}", heroHealth);
Console.WriteLine("Dragon health: {0}", dragonHealth);
Console.WriteLine("What are you going to do?");
Console.WriteLine("1.Use Sword does 100dmg");
Console.WriteLine("2.Use Ice spell does 50 dmg has 50/50 chance to stun");
val = Convert.ToInt32(Console.ReadLine());
Console.Clear();
switch (val)
{
case 1:
dragonHealth -= 100;
Console.WriteLine("You slash 100 dmg");
Console.WriteLine("Dragon health: {0}" , dragonHealth);
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
oracle = rng.Next(10, 21);
Console.WriteLine("Now its dragon turn");
Console.WriteLine("Dragon does {0} dmg", oracle);
heroHealth -= oracle;
Console.WriteLine("Your health: {0}", heroHealth);
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
Console.Clear();
goto Found;
case 2:
oracle = rng.Next(1, 3);
dragonHealth -= 50;
Console.WriteLine("Icespell does 50 dmg");
Console.WriteLine("Dragon health: {0}", dragonHealth);
if(oracle == 2)
{
Console.WriteLine("The dragon is stunned you get another round!");
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
Console.Clear();
goto Found;
}
else
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
oracle = rng.Next(10, 21);
Console.WriteLine("Now it dragon turn");
Console.WriteLine("Dragon does {0} dmg", oracle);
heroHealth -= oracle;
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
Console.Clear();
goto Found;
}
} while (dragonHealth != 0 || heroHealth != 0 || heroHealth < 0 || dragonHealth < 0);
if(heroHealth == 0 || heroHealth < 0)
{
Console.WriteLine("You died");
Console.ReadLine();
}
else Console.WriteLine("You've slain the mighty dragon congratz!");