Advertisement
zCool

RPG Battle 3 Player.cpp

May 13th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement