Fix: Building Cards Bought Logic

This commit is contained in:
rubenpirreram
2026-03-19 18:55:45 +01:00
parent 96c45a347a
commit 83bba89462
@@ -12,7 +12,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
public int getPrice() {
return price;
}
private boolean bought;
protected EffectType effectType;
protected int effectId;
@@ -30,6 +30,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
} else {
throw new IllegalArgumentException();
}
bought = false;
}
public BuildingCard(int effectId,EffectType effectType ,int era,int price) throws IllegalArgumentException{
this.effectId = effectId;
@@ -49,7 +50,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
return new BuildingCard(effectId,effectType,getEra(),getPrice());
}
public boolean buy(Player player) {
if(!player.removeFood(getPrice()))
if( bought || !player.removeFood(getPrice()))
return false;
player.buildingCards.add(this);
return true;