Advertisement
zCool

Player.cpp

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