Files
Progetto-ingegneria-del-sof…/src/main/java/it/polimi/ingsw/gc14/Model/PlayableCard.java
T
rubenpirreram 609229058f Fix: TUI
2026-04-29 17:46:58 +02:00

53 lines
1.2 KiB
Java

package it.polimi.ingsw.gc14.Model;
import java.io.Serializable;
/**
* Abstract base class for all playable cards.
* A PlayableCard is characterized by an era value.
*/
public abstract class PlayableCard implements Serializable {
/**
* The era associated with this playable card.
*/
private int Era;
/**
* Returns the era of this playable card.
*
* @return the era of this playable card.
*/
public int getEra(){
return Era;
}
/**
* Creates a playable card with the specified era.
*
* @param Era the era of the playable card.
* @throws IllegalArgumentException if {@code Era <= 0} or {@code Era >= 4}.
*/
public PlayableCard (int Era) throws IllegalArgumentException{
if (Era>0 && Era<4) {
this.Era = Era;
} else {
throw new IllegalArgumentException();
}
}
/**
* Returns the string representation of this playable card.
*
* @return the string representation of this playable card.
*/
@Override
public String toString() {
return "⎕:";
}
public String toStringBoard()
{
return "⎕:";
}
}