public void GainXP(int XP) { xp += XP; if (xp >= levelXP) { xp -= levelXP; storedLevelUps += 1; levelXP = Math.Max((int)(1.1 * levelXP), levelXP + 1); //Set Level up main.SetUpdateState(storedLevelUps > 0); //Immediate effect troop.health.RawValue = troop.health.MaxValue().Value; main.WriteConsole("Level Up! Healing to max hp!"); } }