public void ChangeEntityStat(EntityStat stat, ChangeStatDirection dir, int amt2Change) { newHero.ChangeStat(stat, dir, amt2Change); SyncProperties(); }
public void ChangeStat(EntityStat stat, ChangeStatDirection dir, int amt2Change) { // Change the indicated Stat by adding or subtracting the amt2Change // Subtraction is done by multiplying the amt2Change by -1 which creates a negative value that is then "added" to the existing stat. switch (stat) { case EntityStat.Health: if (dir == ChangeStatDirection.Set) { this.Health = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.Health += amt2Change; } break; case EntityStat.Attack: if (dir == ChangeStatDirection.Set) { this.Attack = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.Attack += amt2Change; } break; case EntityStat.AttackCount: if (dir == ChangeStatDirection.Set) { this.AttackCount = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.AttackCount += amt2Change; } break; case EntityStat.RespawnCount: if (dir == ChangeStatDirection.Set) { this.RespawnCount = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.RespawnCount += amt2Change; } break; case EntityStat.XP: if (dir == ChangeStatDirection.Set) { this.XP = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.XP += amt2Change; } break; case EntityStat.Accuracy: if (dir == ChangeStatDirection.Set) { this.Accuracy = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.Accuracy += amt2Change; } break; case EntityStat.Speed: if (dir == ChangeStatDirection.Set) { this.Speed = amt2Change; } else { if (dir == ChangeStatDirection.Down) { amt2Change *= (-1); } this.Speed += amt2Change; } break; } }