Sobottasgithub e2f5e70d70 Init
2025-11-09 15:17:21 +01:00

99 lines
2.4 KiB
Java

public class Waffe {
private String typ;
private String material;
private double angriffspunkte;
private double durability;
private double gewicht;
public Waffe() {
this.typ = "schwert";
this.material = "eisen";
this.angriffspunkte = 6;
this.durability = 20;
this.gewicht = 5;
}
public Waffe(String typ, String material) {
String typNorm = typ == null ? "" : typ.toLowerCase();
String matNorm = material == null ? "" : material.toLowerCase();
this.typ = typNorm;
this.material = matNorm;
if (typNorm.equals("schwert")) {
this.angriffspunkte = 2;
this.gewicht = 5;
this.durability = 20;
} else if (typNorm.equals("axt")) {
this.angriffspunkte = 3;
this.gewicht = 7;
this.durability = 15;
} else if (typNorm.equals("sichel")) {
this.angriffspunkte = 1;
this.gewicht = 2;
this.durability = 25;
}
if (matNorm.equals("holz")) {
this.angriffspunkte *= 1;
this.gewicht *= 0.90;
this.durability *= 0.80;
} else if (matNorm.equals("knochen")) {
this.angriffspunkte *= 2;
this.gewicht *= 0.80;
this.durability *= 0.85;
} else if (matNorm.equals("eisen")) {
this.angriffspunkte *= 3;
this.gewicht *= 1;
this.durability *= 1;
} else if (matNorm.equals("blei")) {
this.angriffspunkte *= 3;
this.gewicht *= 1.4;
this.durability *= 1.1;
} else if (matNorm.equals("netherite")) {
this.angriffspunkte *= 5;
this.gewicht *= 0.95;
this.durability *= 2;
} else if (matNorm.equals("dolch")) {
this.angriffspunkte *= 2.5;
this.gewicht *= 0.75;
this.durability *= 2;
}
}
public String getTyp() {
return typ;
}
public String getMaterial() {
return material;
}
public void setMaterial(String materialNeu) {
material = materialNeu;
}
public double getAngriffspunkte() {
return angriffspunkte;
}
public void setAngriffspunkte(double angriffspunkteNeu) {
angriffspunkte = angriffspunkteNeu;
}
public double getDurability() {
return durability;
}
public void setDurability(double durabilityNeu) {
durability = durabilityNeu;
}
public double getGewicht() {
return gewicht;
}
public void setGewicht(double gewichtNeu) {
gewicht = gewichtNeu;
}
}