Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Player
- {
- public:
- Player(string name_, int maxhp_, int strenght_, int attackspeed_)
- {
- name = name_;
- maxhp = maxhp_;
- hp = maxhp;
- strenght = strenght_;
- attackspeed = attackspeed_;
- isdead = false;
- }
- void fullhp()
- {
- hp = maxhp;
- }
- void dmg(int dmg)
- {
- hp -= dmg;
- if (hp < 0)
- dead();
- }
- void dead()
- {
- isdead = true;
- cout << name <<" died like a pessant";
- }
- string get_name()
- {
- return name;
- }
- int get_hp()
- {
- return hp;
- }
- int get_maxhp()
- {
- return maxhp;
- }
- int get_str()
- {
- return strenght;
- }
- int get_as()
- {
- return attackspeed;
- }
- bool ask_dead()
- {
- return isdead;
- }
- private:
- string name;
- int maxhp;
- int hp;
- int strenght;
- int attackspeed;
- bool isdead;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement