both errors are supposed to be in the player.cpp and player.h
here are the two other files in the program:
#include <iostream>
#include "monster.h"
#include <time.h>
#include "player.h"
using namespace std;
monster::monster()
{
this->strength = 0;
this->agility = 0;
this->constitution = 0;
this->gold = 0;
this->exp = 0;
this->bonus_damage = 0;
this->armor = 0;
this->health = 0;
this->max_health = 0;
}
monster::~monster()
{
}
void monster::set_strength (unsigned int strength)
{
this->strength = strength;
this->update_stats();
}
void monster::set_agility (unsigned int agility)
{
this->agility = agility;
this->update_stats();
}
void monster::set_constitution (unsigned int constitution)
{
this->constitution = constitution;
this->update_stats();
}
void monster::set_gold (unsigned int gold)
{
this->gold = gold;
}
void monster::set_exp (unsigned int exp)
{
this->exp = exp;
}
unsigned int monster::get_strength ()
{
return this->strength;
}
unsigned int monster::get_agility ()
{
return this->agility;
}
unsigned int monster::get_constitution ()
{
return this->constitution;
}
unsigned int monster::get_gold ()
{
return this->gold;
}
unsigned int monster::get_exp ()
{
return this->exp;
}
unsigned int monster::get_health ()
{
return this->health;
}
string monster::get_name ()
{
return this->name;
}
void monster::text_dump ()
{
cout << this->get_name() << endl;
cout << "Strength = " << this->strength << endl;
cout << "Agility = " << this->agility << endl;
cout << "Constitution = " << this->constitution << endl;
cout << "Health = " << this->health << "/" << this->max_health << endl;
cout << "Armor = " << this->armor << endl;
cout << "Bonus damage = " << this->bonus_damage << endl;
cout << "Gold = " << this->gold << endl;
cout << "Experience = " << this->exp << endl;
}
void monster::update_stats()
{
this->max_health = this->constitution * 3 + this->strength * 1;
this->armor = this->agility / 8 + this->constitution / 12;
this->bonus_damage = this->strength / 8 + this->agility / 12;
}
int monster::roll(int dice, int size)
{
srand(time(NULL));
int n = 0;
int i;
for(i = 0; i < dice; i++){
n = n + ((rand() % size) + 1);
}
return n;
}
void monster::set_monster1_stats()
{
this->name = "Goblin";
this->desc = "A scrawny little green monster.";
this->strength = 10;
this->agility = 15;
this->constitution = 10;
this->gold = 20;
this->exp = 25;
this->bonus_damage = this->strength / 8 + this->agility / 12;
this->armor = this->agility / 8 + this->constitution / 12;
this->max_health = this->constitution * 3 + this->strength * 1;
this->health = this->max_health;
}
that was monster.cpp, here comes game.cpp:
#include <iostream>
#include "player.h"
#include "monster.h"
#include <stdlib.h>
using namespace std;
#define COLOR_OFF 8
#define COLOR_RED 12
#define COLOR_YELLOW 14
#define COLOR_WHITE 15
#define COLOR_GREEN 10
#define COLOR_CYAN 11
int main()
{
int u;
HANDLE Color;
string name;
string confirm;
string action;
player *p;
monster *m;
p = new player();
m = new monster();
m->set_monster1_stats();
Color = GetStdHandle(STD_OUTPUT_HANDLE);
for( ; ; ){
system("cls");
SetConsoleTextAttribute(Color, COLOR_RED);
cout << "Welcome to SiSUD" << endl;
SetConsoleTextAttribute(Color, COLOR_OFF);
p->set_stats(10, 10, 15);
p->text_dump();
cout << "\nRe-roll? (Y/N): ";
SetConsoleTextAttribute(Color, COLOR_WHITE);
cin >> confirm;
SetConsoleTextAttribute(Color, COLOR_OFF);
cout << endl;
if(confirm == "n" || confirm == "N") break;
}
cout << "Welcome to the Arena! " << endl << endl;
cout << "What is your name, gladiator?: ";
SetConsoleTextAttribute(Color, COLOR_WHITE);
cin >> name;
SetConsoleTextAttribute(Color, COLOR_OFF);
p->set_name(name);
u = ((rand() % 3) + 1);
if(u == 1){
cout << endl;
cout << p->get_name() << "? I think I had a pet hamster once with that name. \nBut he's dead now." << endl;
}
if(u == 2){
cout << endl;
cout << "I know a dwarf called " << p->get_name() << ". You look alot like him." << endl;
}
if(u == 3){
cout << endl;
cout << "Hahah... What a soft name " << p->get_name() << " is. But I guess it suits you, peasant." << endl;
}
Sleep(1500);
/* Loading game (Fun thing, doesn't work).
cout << "\nLoading game";
for(u = 0; u < 5; u++){
cout << ".";
Sleep(500);
cout << endl;
}
*/
for( ; ; ){
cout << endl;
cout << "To enter the gauntlet, type 'go'." << endl;
cout << "If you're hurt, try going to the 'temple'. " << endl;
cout << "Or if you want to buy some goods, go to the 'shop'. " << endl;
cout << "To check your statistics, type 'stats'." << endl;
cout << "Want to quit? Then 'quit' is your way out of this hole." << endl;
cout << endl;
SetConsoleTextAttribute(Color, COLOR_RED);
cout << p->get_health() << "hp> ";
SetConsoleTextAttribute(Color, COLOR_OFF);
SetConsoleTextAttribute(Color, COLOR_WHITE);
cin >> action;
SetConsoleTextAttribute(Color, COLOR_OFF);
if(action == "shop" || action == "Shop"){
p->shop();
}
if(action == "temple" || action == "Temple"){
p->temple();
}
if(action == "stats" || action == "Stats"){
p->text_dump();
}
if(action == "q" || action == "quit" || action == "Quit"){
cout << "\nThanks for playing!\n";
exit(0);
}
if(action == "go" || action == "Go"){
if(p->fight(m) == 0) exit(0);
}
}
delete p;
return 0;
}