3012389_Semesteraufgabe/slime.java

34 lines
586 B
Java
Raw Normal View History

2024-01-05 07:18:41 +01:00
package semesterprojekt;
public class slime {
private int leben = 7;
private int level = 1;
private int schaden;
private int maxLeben = 7;
public String toString() {
return "Level: " + level + " Slime (" + leben + "HP)";
}
public int getLeben() {
return leben;
}
public void setLeben(int leben) {
this.leben = leben;
}
public int getSchaden() {
return schaden;
}
public void setSchaden() {
this.schaden = (int) (Math.random() * 3); // random schaden zwischen 0 und 2
}
public int getMaxLeben() {
return maxLeben;
}
}