I've decided to pause work on the actual game base, and work on a secondary component of the game... which is the monsters database, which will look something like this
class monster {
int experience;
int health;
int damage;
char name;
public:
void set_health(int hp) { health = hp; }
int get_health() { return health; }
void set_experience(int exp) { experience = exp; }
int get_experience() { return experience; }
void set_damage(int dmg) { damage = dmg; }
int get_damage() { return damage; }
};
class frog : public monster {
string name;
public:
void set_name(string mon) { name = mon; }
string get_name() { return name; }
void show();
};
void frog::show()
{
cout << get_name() << "\n";
cout << get_damage() << "\n";
cout << get_experience() << "\n";
cout << get_health() << "\n";
}
I will be building on that so that it includes all the monsters and all the details of the monsters.
Heres the source again, as you can see the fight system has been taken out since it will be redone to include the new flexible monster database.
#include <iostream.h>
#include <Monsters.h>
#include "mersenne.cpp"
#include <time.h>
#include <string.h>
using std::string;
using namespace std;
void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}
double mHealth, mMana, mSpeed, experience;
int32 seed = time(0);
TRandomMersenne rg(seed);
int main()
{
/*
frog frog1;
frog1.set_health(34);
frog1.set_damage(5);
frog1.set_experience(22); Just a test for the monster database
frog1.set_name("monkey");
frog1.show();
*/
int reset = 0;
rect.mEncounter = 0;
rect.mPoints = 20;
cout << "~=~Welcome to Monster fighter version 0.01!~=~\n\nThe basics of the game will be created in this portion of the text based game \ncalled 'Monster Fighter'. Although the name of the game may vary during the\nprocess, I would still appreciate you call it by the appropriate name.\n\nPress enter proceed to the character creation process...";
cin.get();
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
system("cls");
cout << "First of all, you must name your character: ";
getline (cin,rect.mName);
do {
rect.mPoints = 20;
system("cls");
cout << "You have 20 skill points to create your character.\n";
cout << endl << "Enter strength: ";
do {
cin.clear ();
if (cin.sync ());
rect.mStrength = 0;
cin >> rect.mStrength;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (rect.mStrength >= rect.mPoints - 2 || rect.mStrength < 1) cout << "Enter a value between 1 and " << rect.mPoints - 2 << ": ";
} while ( rect.mStrength > rect.mPoints - 2 || rect.mStrength < 1 );
rect.mPoints = rect.mPoints - rect.mStrength;
system("cls");
cout << "You have " << rect.mPoints << " left.\n";
cout << endl << "Enter agility: ";
do {
cin.clear ();
if (cin.sync ());
cin >> rect.mAgility;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (rect.mAgility > rect.mPoints -1 || rect.mAgility < 1) cout << "Enter a value between 1 and " << rect.mPoints - 1 << ": ";
} while ( rect.mAgility > rect.mPoints - 1 || rect.mAgility < 1 );
rect.mPoints = rect.mPoints - rect.mAgility;
system("cls");
cout << "You have " << rect.mPoints << " left.\n";
cout << endl << "Enter intelligence: ";
do {
cin.clear ();
if (cin.sync ());
cin >> rect.mIntelligence;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (rect.mIntelligence >= rect.mPoints || rect.mIntelligence < 1) cout << "Enter a value between 1 and " << rect.mPoints << ": ";
} while ( rect.mIntelligence > rect.mPoints || rect.mIntelligence < 1 );
rect.mPoints = rect.mPoints - rect.mIntelligence;
cout << "You have " << rect.mPoints << " left.";
system ("cls");
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
mHealth = rect.mStrength * 14;
mMana = rect.mIntelligence * 12;
mSpeed = rect.mAgility * 18;
cout << "Congratulations, you have created your character successfully!\n\nHere is your character:\n\nCharacter name: " << rect.mName << "\nStrength: " << rect.mStrength << "\nAgility: " << rect.mAgility << "\nIntelligence: " << rect.mIntelligence << "\n";
cout << "Health: " << mHealth << "\nMana: " << mMana << "\nAttack/Move speed:" << mSpeed << "\n\n\n\n";
cout << "Enter either 1 to reselect hero skill points, or 0 to finish.";
do {
cin >> reset;
if ( reset > 1 || reset < 0 ) {
system ("CLS");
cout << "To reselect hero skill points enter\n1 = Yes, reselect skills.\n0 = No, they're fine.\n\n";
}
} while ( reset > 1 || reset < 0 );
system ("CLS");
}while ( reset == 1 );
system("PAUSE");
cin.get();
}