Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create a
  • Loading branch information
morarul committed Mar 20, 2020
1 parent 535763d commit f059819
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions a
@@ -0,0 +1,82 @@
class Item;
class Character
{

public:
vector<string>inventory;
static int number;
int maxHealth;
bool dead = false;
string name;
int health, attack, defence, speed;
Character( string Name, int HP, int AT, int DEF, int SP);
Character();
~Character()
{
number -= 1;
}
string get_name() { return name; }
int get_health() { return health; }
bool get_life() { return dead; }
int get_attack() { return attack; }
int get_defence() { return defence; }
int get_speed() { return speed; }
void set_maxHealth(int newHealth)
{
maxHealth = newHealth;
}
void heal()
{
health = maxHealth;
}
void Stats()
{
cout <<name<<"'s stats are: " << endl;
cout << "Health " << health << " Attack " << attack;
cout << " Defence " << defence << " Speed " <<speed << endl;

}
void killCharacter()
{
dead = true;
}
static void enemyNumber()
{
cout << number << " enemies left." << endl;
}
void get_inventory()
{
cout << "Your inventory: ";
for (int i = 0; i < inventory.size(); i++)
{
cout<<"||" << inventory[i];;
}
cout <<"||"<< endl;
}

};
Character::Character(string Name, int HP, int AT, int DEF, int SP)
{
number += 1;
name = Name;
health = HP;
attack = AT;
defence = DEF;
speed = SP;


};
Character::Character()
{
name = "No name";
health = 10;
attack = 10;
defence = 10;
speed = 10;
};
int Character::number = 0;
std::ostream& operator<<(std::ostream& os, const Character& character)
{
os <<character.name;
return os;
}

0 comments on commit f059819

Please sign in to comment.