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() { public int getPrice() {
return price; return price;
} }
private boolean bought;
protected EffectType effectType; protected EffectType effectType;
protected int effectId; protected int effectId;
@@ -30,6 +30,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
} else { } else {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
bought = false;
} }
public BuildingCard(int effectId,EffectType effectType ,int era,int price) throws IllegalArgumentException{ public BuildingCard(int effectId,EffectType effectType ,int era,int price) throws IllegalArgumentException{
this.effectId = effectId; this.effectId = effectId;
@@ -49,7 +50,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
return new BuildingCard(effectId,effectType,getEra(),getPrice()); return new BuildingCard(effectId,effectType,getEra(),getPrice());
} }
public boolean buy(Player player) { public boolean buy(Player player) {
if(!player.removeFood(getPrice())) if( bought || !player.removeFood(getPrice()))
return false; return false;
player.buildingCards.add(this); player.buildingCards.add(this);
return true; return true;