creatures.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // This file contains the declarations of objects used along in the game.
  3. // Monster, player and a few other class definitions go here for elaboration
  4. // in creatures.cpp.
  5. //
  6. // This file is part of Linux Legends.
  7. //
  8. // Linux Legends is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #include <iostream>
  22. #include <string>
  23. #ifndef CREATURES_H
  24. #define CREATURES_H
  25. class Creature {
  26. public:
  27. Creature(int atk, int hp, int def, int xp);
  28. int attack();
  29. bool is_dead();
  30. protected:
  31. int max_attack;
  32. int health;
  33. int defense;
  34. int experience;
  35. };
  36. class Monster : public Creature {
  37. public:
  38. Monster(int atk, int hp, int def, int xp, std::string nm);
  39. void defend(int incoming);
  40. int yield_xp();
  41. private:
  42. std::string name;
  43. };
  44. class Player : public Creature {
  45. public:
  46. Player(int atk, int hp, int def, int xp, std::string eq);
  47. void defend(int incoming);
  48. void get_xp(int xp);
  49. private:
  50. std::string weapon;
  51. };
  52. #endif