SHARE
TWEET

RPG Battle 3 Enemy.cpp

zCool May 13th, 2012 7 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Enemy.h"
  2. #include<iostream>
  3. #include<cmath>
  4.  
  5. Enemy::Enemy(int hp, int atk, int def, int skil)
  6. {
  7.         Enemy::stats.setHealth(hp);
  8.         Enemy::stats.setAttack(atk);
  9.         Enemy::stats.setDefense(def);
  10.         Enemy::stats.setSkill(skil);
  11. }
  12.  
  13. Stats Enemy::getStats()
  14. {
  15.         return Enemy::stats;
  16. }
  17.  
  18. void Enemy::displayHP()
  19. {
  20.         std::cout << "Monster HP: " << Enemy::stats.getHealth() << std::endl;
  21. }
  22.  
  23. int Enemy::getHit(int attackerATK, int victimDEF, int victimHP)
  24. {
  25.         return (victimHP - rand()%(attackerATK - victimDEF));
  26. }
  27.  
  28. int Enemy::healSelf(int hp, int skil)
  29. {
  30.         return (hp + rand()%(5*skil));
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top