Guest User

Untitled

a guest
Jun 26th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using namespace std;
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <ctime>
  5. #include <conio.h>
  6.  
  7. class Wrog
  8. {
  9. public:
  10. int poziom;
  11. int doswiadczenie;
  12. int bron;
  13. int obrazenia;
  14. int hit_points;
  15. int gold;
  16. virtual void statystyki()=0;
  17. virtual void atak()=0;
  18. virtual void otrzymaj_obrazenia(int obrazenia)=0;
  19. };
  20.  
  21. class Wilk :public Wrog
  22. {
  23. public:
  24. virtual void statystyki()
  25. {
  26. hit_points = 50;
  27. doswiadczenie = 0;
  28. poziom = 0;
  29. bron = 0;
  30. gold = 10;
  31. obrazenia = 0;
  32. }
  33. virtual void atak()
  34. {
  35. srand( time( NULL ) );
  36. obrazenia = (std::rand() % 10) + 0;
  37. }
  38. virtual void otrzymaj_obrazenia(int obrazenia)
  39. {
  40. hit_points = hit_points - obrazenia;
  41. if(hit_points <= 0)
  42. {
  43. cout<<"\nPotwor pokonany!\n";
  44. }
  45. }
  46. };
Add Comment
Please, Sign In to add comment