Basically what I'm trying to do is simple.
My main problem is the random numbers, but in the comments i have some other issues...
if you know how to fix them that would be great the other two main ones im having trouble with are:
the do loop until the monsters health is 0,
and once the code ran, having the user press any key to go back to the starting fight menu.
back to the main problem:
based on the "monsters" level it will do a random amount of damage..
for example:
the monsters level is 3.
void fightd () {
dwarf = 500;
// do loop here, until the monsters health is <= 0
system ("cls");
if (health <= 0){
cout << "You have died." << endl;
cout << "Returning to Main menu." << endl;
mainmenu();
}
else {
cout << "Your health is: " << health << endl << endl;
cout << "The Dwarf's heath is: " << dwarf << endl << endl << endl;
cout << "Do you want to: " << endl;
cout << "1. Fight." << endl;
cout << "2. Heal." << endl;
cout << "3. Go to Main menu." << endl;
cin >> choice;
if (choice == 1){
system ("cls");
cout << "You hit your enemy for: " << endl;
// will put random numbers between 1 and 20
// multiply this random number Strength
cout << "Your enemy hit you for:" << endl;
// will do random between 1 and 10
// multiply this by the monsters level
cout << "To continue fighing press any key." << endl;
// press any key code to go back to the main fighting menu.
}
else if (choice == 2){
system ("cls") ;
cout << "You have chosen to heal." << endl;
// random healing between 1 and 10
// mana devided by 10
// random healing multiplied by the 1/10th mana
// add that number to health
cout << "Your enemy hit you for:" << endl;
// will do random between 1 and 10
// multiply this by the monsters level
// minus this from the health
cout << "Your health is now: " << health << endl;
cout << endl << endl;
cout << "To continue fighing press any key." << endl;
// press any key code to go back to the main fighting menu.
}
else if (choice == 3) mainmenu ();
else {
cout << "That is not a choice. please try again." << endl;
// will go back to the start of the loop again.
}
}
}
it would be the same thing for the players damage against the monster.