Fix: Building Cards Bought Logic
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user