Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. Enemy
  2. private:
  3. int level;
  4. int hp;
  5. int hpMax;
  6. int damageMin;
  7. int damageMax;
  8. float dropChance;
  9. int defence;
  10. int accuracy;
  11.  
  12. public:
  13. Enemy(int level = 0);
  14. virtual ~Enemy();
  15.  
  16. inline bool isAlive() { return this->hp > 0; }
  17. std::string getAsString()const;
  18. void takeDamage(int damage);
  19.  
  20. inline int getLevel()const { return this->level; }
  21. inline int getDamageMin()const { return this->damageMin; }
  22. inline int getDamageMax()const { return this->damageMax; }
  23. inline int getDamage()const { return rand() % this->damageMax + this->damageMin; }
  24. inline int getExp()const { return this->level * 100; }
  25. inline int getHp()const { return this->hp; }
  26. inline int getHpMax()const { return this->hpMax; }
  27. inline int getDefence()const { return this->defence; }
  28. inline int getAccuracy()const { return this->accuracy; }
  29. };
  30.  
  31. class Character
  32. {
  33. private:
  34.  
  35. int distanceTravelled;
  36. int gold;
  37.  
  38. std::string name;
  39. int level;
  40. int exp;
  41. int expNext;
  42.  
  43. int strength;
  44. int vitality;
  45. int dexterity;
  46. int intelligence;
  47.  
  48. int hp;
  49. int hpMax;
  50. int stamina;
  51. int staminaMax;
  52. int damageMin;
  53. int damageMax;
  54. int defence;
  55. int accuracy;
  56. int luck;
  57.  
  58. int statPoints;
  59.  
  60. public:
  61. Character();
  62. Character(string name, int distanceTravelled,
  63. int gold, int level,
  64. int exp, int strength, int vitality,
  65. int dexterity, int intelligence,
  66. int hp, int stamina, int statPoints);
  67. virtual ~Character();
  68.  
  69. //Functions
  70. void initialize(const std::string name);
  71. void printStats() const;
  72. string getAsString()const;
  73. void levelUp();
  74. void updateStats();
  75. void addToStat(int stat, int value);
  76. inline void resetHP() { this->hp = this->hpMax; }
  77.  
  78.  
  79. //Accessors
  80. inline const int& getDistTravel() const { return this->distanceTravelled; }
  81. inline const std::string& getName() const { return this->name; }
  82. inline const int& getLevel() const { return this->level; }
  83. inline const int& getExp() const { return this->exp; }
  84. inline const int& getExpNext() const { return this->expNext; }
  85. inline const int& getStatPoints() const { return this->statPoints; }
  86. inline const int& getHP() const { return this->hp; }
  87. inline const int& getHPMax() const { return this->hpMax; }
  88. inline const bool isAlive() { return this->hp > 0; }
  89. inline const int& getStamina() const { return this->stamina; }
  90. inline const int& getDamageMin() const { return this->damageMin; }
  91. inline const int& getDamageMax() const { return this->damageMax; }
  92.  
  93. //Modifier
  94. inline void setDistTravelled(const int& distance) { this->distanceTravelled = distance; }
  95. inline void travel() { this->distanceTravelled++; }
  96. inline void gainExp(const int exp) { this->exp += exp; }
  97. inline void gainGold(const int gold) { this->gold += gold; }
  98. inline void payGold(const int gold) { this->gold -= gold; }
  99. void takeDamage(const int damage);
  100. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement