forked from 2211945/WIZARD_PR2_DOP
54 lines
1.0 KiB
Java
54 lines
1.0 KiB
Java
/*
|
|
============================================================
|
|
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 {
|
|
|
|
// 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
|
|
@Override
|
|
public String toString() {
|
|
return this.name;
|
|
}
|
|
// Public Methoden
|
|
|
|
// Private Methoden
|
|
|
|
}
|