public abstract class Held { private int hp; private int maxHp; private int damage; private String name; private String typ; private Waffe waffe = new Waffe(); public Held(int hp, int maxHp, int damage, String name, String typ) { this.hp = hp; this.maxHp = maxHp; this.damage = damage; this.name = name; this.typ = typ; } public Held() { this(20, 20, 5, "Thor", "Krieger"); } public int getHp() { return hp; } public void setHp(int hp) { if (hp <= 0) { System.out.println("Du bist tot"); this.hp = 0; } else if (hp > this.maxHp) { this.hp = this.maxHp; } else { this.hp = hp; } } public int getDamage() { return damage; } public void setDamage(int damage) { this.damage = damage; } public String getName() { return name; } public String getTyp() { return typ; } public Waffe getWaffe() { return waffe; } public void setWaffe(Waffe waffe) { this.waffe = waffe; } public int getMaxHp() { return maxHp; } // This method has to be implemented by all sub classes public abstract void angreifen(Monster ziel); }