SHARE
TWEET

RPG Battle 3 Player.cpp

zCool May 13th, 2012 9 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Player.h"
  2. #include "Stats.h"
  3. #include<iostream>
  4. #include<cmath>
  5.  
  6. Player::Player(int hp, int atk, int def, int skil)
  7. {
  8.         Player::stats.setHealth(hp);
  9.         Player::stats.setAttack(atk);
  10.         Player::stats.setDefense(def);
  11.         Player::stats.setSkill(skil);
  12. }
  13.  
  14. Stats Player::getStats()
  15. {
  16.         return Player::stats;
  17. }
  18.  
  19. void Player::displayHP()
  20. {
  21.         std::cout << "Hero HP: " << Player::stats.getHealth() << std::endl;
  22. }
  23. int Player::getHit(int attackerATK, int victimDEF, int victimHP)
  24. {
  25.         return (victimHP - rand()%(attackerATK - victimDEF));
  26. }
  27.  
  28. int Player::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