MasterGun

RPG

Jan 24th, 2021
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>;
  2. using namespace std;
  3. class creature
  4. {
  5.     string name = "default";
  6.     char symbol = '@';
  7.     int health = 999;
  8.     int damage = 999;
  9.     int gold = 999;
  10. public:
  11.     void get(string name_n, char symbol_n, int health_n, int damage_n, int gold_n)
  12.     {
  13.         name = name_n;
  14.         symbol = symbol_n;
  15.         health = health_n;
  16.         damage = damage_n;
  17.         gold = gold_n;
  18.     }
  19.     void reduceHealth(int damage) {
  20.         health = health-damage;
  21.     }
  22.     bool isDead()
  23.     {
  24.         if (0>=health) {
  25.             return true;
  26.         }
  27.     }
  28.     void addGold(int gold)
  29.     {
  30.         gold = gold + gold;
  31.     }
  32. };
  33. class Player : public creature
  34. {
  35.     int level = 1;
  36. public:
  37.     void get()
  38.     {
  39.         this->level = level;
  40.     }
  41.     void level_up(){
  42.         level++;
  43.         damage++;
  44.     }
  45. };
  46. int main()
  47. {
  48.  
  49. }
RAW Paste Data