Skip to content
Snippets Groups Projects
Commit af6c422c authored by Ian Prins's avatar Ian Prins
Browse files

move HP up from PlayerChar to Mob

parent 64e479ce
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,10 @@
class Mob {
public:
Mob(std::string, Coord);
Mob(std::string, Coord, int);
int getHP();
void setHP();
int getMaxHP();
Coord& getCoord();
void setCoord(Coord);
int& operator[](int);
......@@ -14,6 +17,7 @@ class Mob {
private:
std::string name;
Coord coord;
int HP, maxHP;
};
#endif
......@@ -13,14 +13,12 @@ class PlayerChar : public Mob {
int getMaxStrength();
int getArmor();
int getGold();
int getHP();
int getMaxHP();
int getLevel();
bool foundAmulet();
int maxDelved();
private:
const int START_HP=10, START_ARMOR=0, START_STR=1, START_GOLD=0, START_LEVEL=1;
int HP, maxHP, armor, strength, maxStrength, gold, level;
const int START_HP=10, START_ARMOR=0, START_STR=15, START_GOLD=0, START_LEVEL=1;
int armor, strength, maxStrength, gold, level;
ItemZone backpack;
bool hasFoundAmulet;
int maxDepth;
......
......@@ -2,11 +2,21 @@
#include "include/coord.h"
#include <string>
Mob::Mob(std::string name, Coord coord)
Mob::Mob(std::string name, Coord coord, int hp)
: name(name)
, coord(coord)
, HP(hp)
, maxHP(hp)
{}
int Mob::getHP() {
return HP;
}
int Mob::getMaxHP() {
return maxHP;
}
Coord& Mob::getCoord() {
return coord;
}
......
......@@ -4,9 +4,7 @@
#include "include/coord.h"
PlayerChar::PlayerChar(Coord pos)
: Mob("@Rogue", pos)
, HP(START_HP)
, maxHP(START_HP)
: Mob("@Rogue", pos, START_HP)
, armor(START_ARMOR)
, strength(START_STR)
, maxStrength(START_STR)
......@@ -16,15 +14,6 @@ PlayerChar::PlayerChar(Coord pos)
, hasFoundAmulet(false)
, maxDepth(1)
{}
int PlayerChar::getHP() {
return HP;
}
int PlayerChar::getMaxHP() {
return maxHP;
}
int PlayerChar::getArmor() {
return armor;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment