Advertisement
Guest User

Untitled

a guest
Oct 11th, 2015
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <cstdlib>
  4.  
  5. #include "elf.h"
  6. #include "creature.h"
  7.  
  8. using namespace std;
  9.  
  10.  
  11. elf::elf(){
  12. }
  13.  
  14.  
  15. elf::elf(int inStrength, int inHitpoints) : creature(inStrength, inHitpoints)
  16. {
  17.  
  18. }
  19.  
  20. int elf::getDamage() const{
  21. int damage = creature::getDamage();
  22. cout << "The elf attacks for " << damage << " points!" << endl;
  23. if (rand() % 100 < 50) {
  24. cout << "Magical attack inflicts " << damage << " additional damage points!" << endl;
  25. damage = damage * 2;
  26. }
  27. return damage;
  28. }
  29.  
  30. string elf::getSpecies() const
  31. {
  32. return "elf";
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement