2023-10-05 23:49:36 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "Magierkarte" file from Author: Philipp Kotte
|
|
|
|
written on: 05 / 10 / 2023 at: 23:41
|
|
|
|
============================================================
|
|
|
|
*/
|
|
|
|
package Domain.Karten;
|
|
|
|
|
|
|
|
public class Magierkarte extends Karte {
|
2023-10-23 10:50:20 +02:00
|
|
|
|
|
|
|
// Statische Konstanten
|
|
|
|
private static String TRUMPF_NAME = "Zauberer";
|
|
|
|
|
|
|
|
// Statische Attribute
|
|
|
|
private static int mkAnzahl = 1; // mk = magierkarte
|
|
|
|
|
|
|
|
// Attribute der Objekte
|
|
|
|
private String name;
|
|
|
|
|
|
|
|
// Konstruktoren
|
|
|
|
public Magierkarte() {
|
|
|
|
super();
|
|
|
|
if (getMkAnzahl() <= 4) {
|
|
|
|
setName(TRUMPF_NAME);
|
|
|
|
setMkAnzahl();
|
|
|
|
}
|
|
|
|
else {
|
2023-10-23 14:22:39 +02:00
|
|
|
throw new RuntimeException("Es darf nur 4 Zaubererkarten im Spiel geben.");
|
2023-10-23 10:50:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Statischen Methoden
|
|
|
|
|
|
|
|
// Getter und Setter
|
|
|
|
|
2023-10-23 14:22:39 +02:00
|
|
|
public int getMkAnzahl() {
|
2023-10-23 10:50:20 +02:00
|
|
|
return mkAnzahl;
|
|
|
|
}
|
|
|
|
|
2023-10-23 14:22:39 +02:00
|
|
|
public void setMkAnzahl() {
|
2023-10-23 10:50:20 +02:00
|
|
|
mkAnzahl++;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
2023-10-05 23:49:36 +02:00
|
|
|
|
2023-10-23 10:50:20 +02:00
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
2023-10-26 09:03:09 +02:00
|
|
|
// Overrides
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
|
2023-10-23 10:50:20 +02:00
|
|
|
// public Methoden
|
|
|
|
|
|
|
|
// private Methoden
|
2023-10-05 23:49:36 +02:00
|
|
|
}
|