SHARE
TWEET

Stats.cpp

zCool May 17th, 2012 12 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Stats.h"
  2. #include<iostream>
  3.  
  4. Stats::Stats(int health, int attack, int defense, int skill)
  5. {
  6.         m_health = health;
  7.         m_attack = attack;
  8.         m_defense = defense;
  9.         m_skill = skill;
  10. }
  11.  
  12. void Stats::incrementDefense(int defenseIncrement)
  13. {
  14.         if(defenseIncrement < 0)
  15.         {
  16.                 defenseIncrement = 0;
  17.                 std::cout << "Please Enter a Positive Integer!";
  18.         }
  19.        
  20.         m_defense += defenseIncrement;
  21. }
  22.  
  23. void Stats::incrementAttack(int attackIncrement)
  24. {
  25.         if(attackIncrement < 0)
  26.         {
  27.                 attackIncrement = 0;
  28.                 std::cout << "Please enter a Positive Integer!";
  29.         }
  30.  
  31.         m_attack += attackIncrement;
  32. }
  33.  
  34. void Stats::incrementHealth(int healthIncrement)
  35. {
  36.         if(healthIncrement < 0)
  37.         {
  38.                 healthIncrement = 0;
  39.                 std::cout<< "Please enter a Positive Integer!";
  40.         }
  41.  
  42.         m_health += healthIncrement;
  43. }
  44.  
  45. void Stats::printStats()
  46. {
  47.         std::cout << "HP: " << m_health << " Attack: " << m_attack << " Defense: "
  48.                 << m_defense << " Skill: " << m_skill << std::endl;
  49. }
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