package semesterprojekt; public class held { public int leben; public int level = 1; public int exp = 0; public int schaden; int maxLeben; int minSchaden = 1; int maxSchaden = 2; public held() { leben = 15; maxLeben = 15; } public String toString() { return "Level: " + level + " Held (" + leben + "/" + maxLeben + " HP)\nSchaden: " + schaden + "\nExperience Points: " + exp + "/10"; } public int getLeben() { return leben; } public void setLeben(int leben) { this.leben = leben; if (this.leben >= maxLeben) { this.leben = maxLeben; } } public int getExp() { return exp; } public void setExp(int exp) { this.exp = exp; if (this.exp >= 10) { levelUp(); } } private void levelUp() { level++; maxLeben += 2; leben = maxLeben; schaden++; exp = 0; } public int getSchaden() { return schaden; } public void setSchaden() { this.schaden = minSchaden + (int) (Math.random() * ((maxSchaden - minSchaden) + 1)); } public int getMaxLeben() { return maxLeben; } }