1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#ifndef ENEMY_H
#define ENEMY_H
#include <iostream>
#include <cstring>
using namespace std;
//************************************
// constant variables for char arrays
//************************************
const int NAME = 20;
const int TYPE = 10;
//****************************************
// Enemy Class will create a base for any
// enemy in the game.
//****************************************
class Enemy
{
protected:
char name[NAME];
char type[TYPE];
int level;
int health;
int strength;
int gold;
bool dead;
public:
//***************************************************
// Default constructor, if no arguments are passed
// on call, then set default values for enemy stats
//***************************************************
Enemy()
{
strcpy_s(name,"");
health = 1;
strcpy_s(type,"");
level = 1;
strength = 1;
gold = 0;
}
//***************************************************
// Constructor, accepts 3 arguments to set the
// stats of the enemy
//***************************************************
Enemy(char n[],char t[], int lv, int hp, int str, int g)
{
strcpy_s(name,n);
strcpy_s(type,t);
level = lv;
health = hp;
strength = str;
gold = g;
}
//****************************************************
// Used to display the stats of the enemy, used mainly
// for testing purposes
//****************************************************
void getStats() const
{
cout << "Name: " << name << endl;
cout << "Level: " << level << endl;
cout << "Health: " << health << endl;
cout << "Strength: " << strength << endl;
cout << "Gold: " << gold << endl;
}
};
#endif
|