title: Setters not working inside of a class method
body: <p>I am new to C++ and I decided to make a little turn-based RPG engine. Here's the problem I have. I have class <code>Mob</code> with attributes like <code>HP</code>, <code>MP</code>, <code>Stamina</code>, <code>Strength</code>, and <code>Intelligence</code>. They all have getters and setters to go along with them. I also have the method <code>attack()</code> which takes the two mobs involved in the attack. Also already created two mobs with HP of 100, Stamina of 30, and Strength of 30 (EDIT Strength is actually 5. My bad). Anyways, here is the code for attacking:</p>
  
  <pre><code>srand(time(0));
  int damage = mobSend.getStr() * 5 + (rand() % str);
  cout &lt;&lt; damage &lt;&lt; endl;
  mobRec.setHP((mobRec.getHP() - damage));
  mobSend.setStamina(mobSend.getStamina() - 5);
  </code></pre>
  
  <p>When I run the program, I have it so it first prints out the HP and Stamina, runs the attack method, and then prints the HP and Stamina again. However, when I run it, the mobs' HP or Stamina don't go down. I tested to make sure that <code>setHP()</code> and <code>setStamina()</code> worked so I set the hp and stamina to 0 in the main method and it worked. </p>
  
  <p>I tried other things like <code>loseHP()</code> which took damage as a parameter:</p>
  
  <pre><code>void Mob:: loseHP(int damage) {this-&gt;HP -= damage;}
  </code></pre>
  
  <p>but it still didn't work. What am I doing wrong here? I am really stumped here, so some help would be appreciated.</p>