Hey, I'm working on a Samurai Fighting Game for my Online C++ Class, this is a unfinished source code but for some reason when I try to do combat it messes up. Try running my code please and help me out, I don't want to go way ahead without fixing this first.
Code:
// Final Project
// 'Way of the Samurai'
// Version 1.0
// By Dillan Cobb
// 11-27-2007
// -----------------------------------------------------------------------------
// Includes
#include<iostream>
#include<cctype>
using namespace std;
// -----------------------------------------------------------------------------
// Variables
// Stats
int strength;
int dexterity;
int health;
int maxhealth;
int yen;
int experience;
int maxexperience;
int level;
char rank;
char stat;
char fighthelpfight;
char retryfighthelp;
// Areas
void menu();
void storyline();
void storylinetwo();
void tutorial();
void fighthelp();
// Enemys
void enemybinds();
// Enemy Stats
// Lord Niwazuka Tsunori
int lntstr;
int lntdex;
int lnthp;
int lntmhp;
// Samurai Adept
int sastr;
int sadex;
int sahp;
int samhp;
// Samurai
int sstr;
int sdex;
int shp;
int smhp;
// Samurai Veteran
int svstr;
int svdex;
int svhp;
int svmhp;
// Guard
int gstr;
int gdex;
int ghp;
int gmhp;
// Geisha
int gastr;
int gadex;
int gahp;
int gamhp;
// Samurai Captian
int scstr;
int scdex;
int schp;
int scmhp;
// Samurai Captain Veteran
int scvstr;
int scvdex;
int scvhp;
int scvmhp;
// Shogun
int snstr;
int sndex;
int snhp;
int snmhp;
// Emperor
int estr;
int edex;
int ehp;
int emhp;
// Clan Leader
int clstr;
int cldex;
int clhp;
int clmhp;
// Lord Niwazuka Tsunori Boss
int bstr;
int bdex;
int bhp;
int bmhp;
// -----------------------------------------------------------------------------
// Main Function
int main()
{
system("cls");
strength = 6;
dexterity = 4;
health = 20;
maxhealth = 20;
yen = 50;
experience = 0;
maxexperience = 35;
level = 1;
menu();
storyline();
storylinetwo();
tutorial();
// enemy stats
// Lord Niwazuka Tsunori
lntstr = 3;
lntdex = 5;
lnthp = 10;
lntmhp = 10;
// Samurai Adept
sastr = 4;
sadex = 3;
sahp = 7;
samhp = 7;
// Samurai
sstr = 5;
sdex = 4;
shp = 16;
smhp = 16;
// Samurai Veteran
svstr = 6;
svdex = 6;
svhp = 19;
svmhp = 19;
// Guard
gstr = 3;
gdex = 2;
ghp = 21;
gmhp = 21;
// Geisha
gastr = 4;
gadex = 7;
gahp = 27;
gamhp = 27;
// Samurai Captian
scstr = 9;
scdex = 8;
schp = 26;
scmhp = 26;
// Samurai Captain Veteran
scvstr = 9;
scvdex = 10;
scvhp = 30;
scvmhp = 30;
// Shogun
snstr = 11;
sndex = 10;
snhp = 38;
snmhp = 38;
// Emperor
estr = 4;
edex = 14;
ehp = 43;
emhp = 43;
// Clan Leader
clstr = 13;
cldex = 14;
clhp = 41;
clmhp = 41;
// Lord Niwazuka Tsunori Boss
bstr = 16;
bdex = 18;
bhp = 73;
bmhp = 73;
}
// -----------------------------------------------------------------------------
// Void Main
void menu()
{
system("cls");
cout<<"\t\t\t The Way of the Samuria \n";
cout<<"\t\t Fictional Japanese Samuria Game by Dillan Cobb \n";
cout<<"\t\t Note: Game commands are Case Sensitive! \n";
system("Pause");
return;
}
// -----------------------------------------------------------------------------
// Void Storyline
void storyline()
{
system("cls");
cout<<"\t In the chaotic days of earlier Japan known as the Muromachi \n";
cout<<"Period, when independant states were scattered along the Empire at \n";
cout<<"constant war. You are a young Samurai named Mokumada Tsunazo, under \n";
cout<<"training of the Lord Niwazuka Tsunori, a powerful Samurai leader of \n";
cout<<"the Tsunori Clan. Nearing the end of your training your dojo is \n";
cout<<"viciously attacked by your rival clan, Osuke Clan led by Kawatsuki \n";
cout<<"Osuke - another fearless and powerful leader. Unlike the Tsunori \n";
cout<<"Clan, the Osuke Clan did not fight for the Emperor Chokei, Monarch \n";
cout<<"of the Southern Court. In these darkened days of war and chaotic \n";
cout<<"hell, how will your destiny unfold? \n";
system("pause");
return;
}
// -----------------------------------------------------------------------------
// Void Storylinetwo
void storylinetwo()
{
system("cls");
cout<<" "<<'\n';
cout<<" /\\ Present Day Nagasaki Japan "<<'\n';
cout<<" /++\\ 1379 - Muromachi Period "<<'\n';
cout<<" /++++\\ Tsunori Clan Dojo "<<'\n';
cout<<" /+|''|+\\ "<<'\n';
cout<<" /++|__|++\\ "<<'\n';
cout<<" ''=========='' "<<'\n';
cout<<" /|===|===|\\ "<<'\n';
cout<<" /+|===|===|+\\ "<<'\n';
cout<<" /++|==o|o==|++\\ "<<'\n';
cout<<" /+++|===|===|+++\\ "<<'\n';
cout<<" ''================='' "<<'\n';
cout<<" /+++|===|===|+++\\ "<<'\n';
cout<<" /|+++|==o|o==|+++|\\ "<<'\n';
cout<<" / |+++|===|===|+++| \\ "<<'\n';
cout<<"'''|''|''|_____|''|''|''' "<<'\n';
cout<<" |__|__|_____|__|__| "<<'\n';
cout<<"...|..|..|_____|..|..|... "<<'\n';
cout<<".........OOOOOOO......... "<<'\n';
cout<<".........OOOOOOO......... "<<'\n';
cout<<".........OOOOOOO......... "<<'\n';
system("pause");
return;
}
// -----------------------------------------------------------------------------
// Void Tutorial
void tutorial()
{
system("cls");
cout<<"Lord Tsunori: Mokumada, you must parry! You do know I'm quicker \n";
cout<<" then you don't you? Parry, Slice! Comon! \n";
cout<<"Mokumada: Sorry my lord, hiya! \n";
cout<<"[You are about to enter combat!]\n";
cout<<"\n";
cout<<" @ +#'\n";
cout<<" @ ##+:\n";
cout<<" @ ###;\n";
cout<<" @ ##+\n";
cout<<" @ ######\n";
cout<<" @ ########\n";
cout<<" # +#########+\n";
cout<<" #+##+##########+\n";
cout<<" #+++ ##### ###\n";
cout<<" #### #\n";
cout<<" #@####\n";
cout<<" #######\n";
cout<<" ########\n";
cout<<" +##@#####\n";
cout<<" +#########\n";
cout<<" +#########\n";
cout<<" +#########\n";
cout<<" +#########\n";
cout<<" #########\n";
system("pause");
fighthelp();
}
// -----------------------------------------------------------------------------
// Void fighthelp
void fighthelp()
{
system("cls");
cout<<"[You have encountered: Lord Niwazuka Tsunori!] \n";
cout<<"Lord Tsunori's Health: "<<lnthp<<" / "<<lntmhp<<"\n"<<endl;
cout<<"Your Health: "<<health<<" / "<<maxhealth<<"\n"<<endl;
cout<<"[T]hrust Attack\n";
cout<<"[S]lash Attack\n";
cout<<"[P]arry Midway\n";
cout<<"[D]efend\n";
cin>>fighthelpfight;
if(fighthelpfight == 'T')
{
cout<<"[You attempt to Thrust the enemy.]\n";
if(lntdex > dexterity)
{
cout<<"[As you attempt to Thrust, enemy quickly slices you.]\n";
health = health - lntstr;
cout<<"[You have taken "<<lntstr<<" damage!]\n";
system("pause");
fighthelp();
}
if(lntdex < dexterity)
{
cout<<"[You Thrust the enemy.]\n";
lnthp = lnthp - strength;
cout<<"[You deal "<<strength<<" damage!]\n";
system("pause");
fighthelp();
}
system("pause");
}
if(fighthelpfight == 'S')
{
cout<<"[You attempt to Slash the enemy.]\n";
if(lntdex > dexterity)
{
cout<<"[As you attempt to Slash, enemy quickly Parry's your attack.]\n";
if(lntstr > strength)
{
cout<<"[You fail to overpower the enemy.]\n";
health = health - (lntstr - 1);
cout<<"[You have taken "<<(lntstr - 1)<<" damage!]\n";
system("pause");
fighthelp();
}
if(lntstr < strength)
{
cout<<"[You overpower the enemy.]\n";
lnthp = lnthp - (strength - 1);
cout<<"[You deal "<<(strength - 1)<<" damage!]\n";
system("pause");
fighthelp();
}
system("pause");
}
if(lntdex < dexterity)
{
cout<<"[You Slash the enemy.]\n";
lnthp = lnthp - (strength + 1);
cout<<"[You deal "<<(strength + 1)<<" damage!]\n";
system("pause");
fighthelp();
}
system("pause");
}
if(fighthelpfight == 'P')
{
cout<<"[You attempt to Parry the enemy's attack.]\n";
if(lntdex > dexterity)
{
cout<<"[As you attempt to Parry, enemy quickly slices you.]\n";
health = health - (lntstr + 1);
cout<<"[You have taken "<<(lntstr + 1)<<" damage!]\n";
system("pause");
fighthelp();
}
if(lntdex < dexterity)
{
cout<<"[You parry the enemys attack.]\n";
if(lntstr > strength)
{
cout<<"[The enemy overpowers you.]\n";
health = health - (lntstr - 1);
cout<<"[You have taken "<<(lntstr - 1)<<" damage!]\n";
system("pause");
fighthelp();
}
if(lntstr < strength)
{
cout<<"[You overpower the enemy.]\n";
lnthp = lnthp - (strength + 1);
cout<<"[You deal "<<(strength + 1)<<" damage.]\n";
system("pause");
fighthelp();
}
system("pause");
system("pause");
}
if(fighthelpfight == 'D')
{
cout<<"[You get into defensive stance.]\n";
cout<<"[The enemy attacks, but you deflect his strike.]\n";
system("pause");
fighthelp();
}
if(lnthp < 0)
{
system("cls");
cout<<"[You have defeated your opponent.]\n";
experience = experience + 30;
if(maxexperience > 30)
{
cout<<"[You have leveled up!]\n";
maxhealth = maxhealth + 3;
health = maxhealth;
level = level + 1;
cout<<"Select a Stat to add 1 point too.\n";
cout<<"[S]trength\n";
cout<<"[D]exterity\n";
cin>>stat;
if(stat == 'S')
{
cout<<"[You gain more Strength.]\n";
strength = strength + 1;
system("pause");
return;
}
if(stat == 'D')
{
cout<<"[You gain more Dexterity.]\n";
dexterity = dexterity + 1;
system("pause");
return;
}
system("pause");
system("pause");
return;
}
system("pause");
system("pause");
}
if(health < 0)
{
system("cls");
cout<<"[You have been defeated in combat.]\n";
cout<<"[Retry battle? Y/N]\n";
system("pause");
cin>>retryfighthelp;
if(retryfighthelp == 'Y')
{
fighthelp();
}
if(retryfighthelp == 'N')
{
return;
}
}
system("pause");
}
}