At this point I am not supposed to get class involved. In this case, I want the player to continuously fight with enemies of different races until his health is 0. Though, after a fight, player would get to heal. just like attack power and defense, user will have to input a number and that number will be calculated for an output that will be subtracted/added to health. Please take a look and correct me as much as you can. I am far away from completion so there might be minor errors that I haven't fixed. Thanks!
- Code: Select all
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
void raceHuman(int a, int b, int c);
void raceOrge(int a, int b, int c);
void raceUndead(int a, int b, int c);
void raceSelect()
{
int raceSelect;
cout << "Please select your desired race" << endl;
cout << "1. Human" << endl;
cout << "2. Orge" << endl;
cout << "3. Undead" << endl;
cin >> raceSelect;
int x;
switch (raceSelect)
{
case 1:
{
int health = 20;
int strength = 6;
int armor = 4;
cout << "You have selected Human.\n";
for(x, health <= 0,health - defense());
{
}
y =
break;
}
case 2:
{
int health = 25;
int strength = 8;
int armor = 1;
cout << "You have selected Orge.\n";
raceOrge(health, strength, armor);
cout << health << strength << armor;
break;
}
case 3:
{
int health = 30;
int strength = 9;
int armor = 0;
cout << "You have selected Undead.\n";
raceUndead(health, strength, armor);
cout << health << strength << armor;
break;
}
default:
cout << "please hit either 1, 2, or 3 key . Then press enter to select your race. \n";
break;
}
}
int main()
{
string charNAME;
cout << "Please enter your character's name: ";
getline(cin,charNAME);
cout << "welcome, " << charNAME << ". Please select a map: \n";
int mapSelect;
cout << "Select a map you would like to conquer:" << endl;
cout << "1. Lalaland" << endl;
cout << "2. Go'thah" << endl;
cout << "3. Bloodthurst" << endl;
cin >> mapSelect;
switch (mapSelect)
{
case 1:
raceSelect();
break;
case 2:
raceSelect();
break;
case 3:
raceSelect();
break;
default:
cout << "please hit either 1, 2, or 3 key. Then press enter to select a map. \n";
}
char f;
cin >> f;
return 0;
}
void raceHuman(int health, int strength, int armor)
{
int heal;
}
void raceOrge(int health, int strength, int armor)
{
int heal;
}
void raceUndead(int health, int strength, int armor)
{
int heal;
}
int defense()
{
int z;
cout << "Enter a number to defend yourself: ";
cin >> z;
health -= raceOrge(strength) - (armor % z);
/*
if (health <= 0)
{
cout << "You are killed by your enemies!" << endl;
goto gameMenu()
}
else
{
cout << "Congratulations! You have killed your enemy. \n";
cout << "Next one is coming...." << endl;
}
continue; */
return x;
}
