SHARE
TWEET

Player.cpp

zCool May 17th, 2012 10 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Player.h"
  2. #include "Stats.h"
  3. #include "Character.h"
  4. #include<iostream>
  5. #include "time.h"
  6.  
  7. Player::Player(Stats stats):Character(stats) {}
  8.  
  9. void Player::getHit(int attackerATK, int victimDEF, int victimHP)
  10. {
  11. // division by zero
  12.         if(attackerATK - victimDEF == 0)
  13.         {
  14.                 m_stats.setHealth( victimHP - rand() % 4 ); // just make it 4 i don't know why
  15.         }
  16.  
  17.         else if(attackerATK - victimDEF != 0)
  18.         {
  19.                 m_stats.setHealth( victimHP - rand() % (attackerATK - victimDEF) );
  20.         }
  21. }
  22.  
  23. void Player::healSelf(int skill)
  24. {
  25.         m_stats.incrementHealth(rand() % 3*skill);
  26. }
  27.  
  28. int Player::fireBall(int skill)
  29. {
  30.         return rand() % 3*skill;
  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