Advertisement
Guest User

Untitled

a guest
Oct 11th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include "creature.h"
  5. #include <ctime>
  6.  
  7.  
  8. using namespace std;
  9. /////////////////////////////////////////////////////
  10.  
  11. creature::creature()
  12. {
  13. strength = 10;
  14. hitpoints = 10;
  15. }
  16.  
  17.  
  18. creature::creature(int inStrength, int inHitpoints)
  19. {
  20. strength = inStrength;
  21. hitpoints = inHitpoints;
  22. }
  23.  
  24.  
  25.  
  26. int creature::getDamage() const
  27. {
  28. int damage = (rand() % strength) + 1;
  29. return damage;
  30. }
  31.  
  32. string creature::getSpecies() const
  33. {
  34. return "creature";
  35. }
  36.  
  37. int creature::getStrength() const
  38. {
  39. return strength;
  40. }
  41.  
  42. int creature::getHitpoints() const
  43. {
  44. return hitpoints;
  45. }
  46.  
  47.  
  48. void creature::setStrength(int newStrength)
  49. {
  50. strength = newStrength;
  51. }
  52.  
  53. void creature::setHitpoints(int newHitpoints) {
  54. hitpoints = newHitpoints;
  55. }
  56.  
  57. /////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement