Add: idIMG constructor

This commit is contained in:
rubenpirreram
2026-05-06 16:09:20 +02:00
parent 5d31e6346d
commit 67b0e0ff7b
18 changed files with 396 additions and 0 deletions
@@ -8,6 +8,11 @@ import java.io.Serializable;
*/
public abstract class PlayableCard implements Serializable {
private String idIMG;
public String getIdIMG() {
return idIMG;
}
/**
* The era associated with this playable card.
*/
@@ -29,6 +34,22 @@ public abstract class PlayableCard implements Serializable {
* @throws IllegalArgumentException if {@code Era <= 0} or {@code Era >= 4}.
*/
public PlayableCard (int Era) throws IllegalArgumentException{
idIMG="-1";
if (Era>0 && Era<4) {
this.Era = Era;
} else {
throw new IllegalArgumentException();
}
}
/**
* 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 (String idIMG,int Era) throws IllegalArgumentException{
this.idIMG = idIMG;
if (Era>0 && Era<4) {
this.Era = Era;
} else {