2023-10-05 23:49:36 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "Narrenkarte" file from Author: Philipp Kotte
|
|
|
|
written on: 05 / 10 / 2023 at: 23:41
|
|
|
|
============================================================
|
|
|
|
*/
|
|
|
|
package Domain.Karten;
|
|
|
|
|
|
|
|
public class Narrenkarte extends Karte {
|
|
|
|
|
2023-10-23 14:22:39 +02:00
|
|
|
// Statische Konstanten
|
|
|
|
private final static String KARTE_NAME = "Narr";
|
|
|
|
// Statische Attribute
|
|
|
|
private static int nkAnzahl = 1;
|
|
|
|
// Attribute der Objekte
|
|
|
|
private String name;
|
|
|
|
// Konstruktoren
|
|
|
|
public Narrenkarte() {
|
|
|
|
super();
|
|
|
|
if (getNkAnzahl() <= 4) {
|
|
|
|
setName(KARTE_NAME);
|
|
|
|
setNkAnzahl();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
throw new RuntimeException("Es darf nur 4 Narrenkarten im Spiel geben.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Statische Methoden
|
|
|
|
|
|
|
|
// Getter und Setter
|
|
|
|
private void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
public String getName() {
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setNkAnzahl() {
|
|
|
|
nkAnzahl++;
|
|
|
|
}
|
|
|
|
public int getNkAnzahl() {
|
|
|
|
return nkAnzahl;
|
|
|
|
}
|
|
|
|
// Overrides
|
2023-10-26 09:03:09 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return this.name;
|
|
|
|
}
|
2023-10-23 14:22:39 +02:00
|
|
|
// Public Methoden
|
|
|
|
|
|
|
|
// Private Methoden
|
|
|
|
|
2023-10-05 23:49:36 +02:00
|
|
|
}
|