Added: BuildingCard check on price

This commit is contained in:
2026-03-19 17:58:48 +01:00
parent c94e96e135
commit 677a12a833
2 changed files with 28 additions and 7 deletions
@@ -23,15 +23,23 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
return effectType;
}
public BuildingCard(int era,int price) {
public BuildingCard(int era,int price) throws IllegalArgumentException{
super(era);
this.price = price;
if (price > 0) {
this.price = price;
} else {
throw new IllegalArgumentException();
}
}
public BuildingCard(int effectId,EffectType effectType ,int era,int price) {
public BuildingCard(int effectId,EffectType effectType ,int era,int price) throws IllegalArgumentException{
this.effectId = effectId;
this.effectType = effectType;
super(era);
this.price = price;
if (price > 0) {
this.price = price;
} else {
throw new IllegalArgumentException();
}
}