Fix: Added Building Cards Prestige Value

This commit is contained in:
rubenpirreram
2026-03-21 15:43:42 +01:00
parent 25683c3e7a
commit 7e20248b7d
12 changed files with 30 additions and 31 deletions
@@ -18,8 +18,8 @@ public class Building0 extends BuildingCard {
public Building0(int era,int price) { public Building0(int era,int price,int prestigeValue) {
super(era,price); super(era,price,prestigeValue);
effectType=EffectType.CARD_SET; effectType=EffectType.CARD_SET;
effectId=0; effectId=0;
purchased = false; purchased = false;
@@ -52,7 +52,7 @@ public class Building0 extends BuildingCard {
} }
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building0(getEra(),getPrice()); return new Building0(getEra(),getPrice(),getPrestigeValue());
} }
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -12,15 +12,15 @@ public class Building1 extends BuildingCard {
private CharacterType icon ; private CharacterType icon ;
public CharacterType getIcon() {return icon;} public CharacterType getIcon() {return icon;}
public Building1(int era, int price, CharacterType icon) { public Building1(int era, int price,int prestigeValue, CharacterType icon) {
super(era,price); super(era,price,prestigeValue);
effectType = EffectType.ON_EVENT; effectType = EffectType.ON_EVENT;
effectId = 1; effectId = 1;
this.icon = icon; this.icon = icon;
} }
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building1(getEra(),getPrice(),getIcon()); return new Building1(getEra(),getPrice(),getPrestigeValue(),getIcon());
} }
@Override @Override
public void applyEffect(Player player) { public void applyEffect(Player player) {
@@ -9,14 +9,14 @@ import it.polimi.ingsw.gc14.Model.Player;
import java.util.HashMap; import java.util.HashMap;
public class Building10 extends BuildingCard { public class Building10 extends BuildingCard {
public Building10(int era, int price) { public Building10(int era, int price,int prestigeValue) {
super(era,price); super(era,price,prestigeValue);
effectType= EffectType.FINAL; effectType= EffectType.FINAL;
effectId=10; effectId=10;
} }
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building8(getEra(),getPrice()); return new Building8(getEra(),getPrice(),getPrestigeValue());
} }
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -14,8 +14,8 @@ public class Building11 extends BuildingCard {
public int getPrestigeMul() {return PrestigeMul;} public int getPrestigeMul() {return PrestigeMul;}
public Building11(int era, int price, CharacterType icon, int prestigeMul) { public Building11(int era, int price,int prestigeValue, CharacterType icon, int prestigeMul) {
super(era,price); super(era,price,prestigeValue);
effectType = EffectType.FINAL; effectType = EffectType.FINAL;
effectId = 11; effectId = 11;
this.icon = icon; this.icon = icon;
@@ -23,7 +23,7 @@ public class Building11 extends BuildingCard {
} }
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building11(getEra(),getPrice(), getIcon(), getPrestigeMul()); return new Building11(getEra(),getPrice(),getPrestigeValue(), getIcon(), getPrestigeMul());
} }
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -5,14 +5,14 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Player; import it.polimi.ingsw.gc14.Model.Player;
public class Building13 extends BuildingCard{ public class Building13 extends BuildingCard{
public Building13(int era, int price) { public Building13(int era, int price,int prestigeValue) {
super(era,price); super(era,price,prestigeValue);
effectType= EffectType.FINAL; effectType= EffectType.FINAL;
effectId=13; effectId=13;
} }
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building13(getEra(),getPrice()); return new Building13(getEra(),getPrice(),getPrestigeValue());
} }
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -12,8 +12,8 @@ public class Building4 extends BuildingCard {
boolean purchased ; boolean purchased ;
int numPair; int numPair;
public Building4(int era, int price) { public Building4(int era, int price,int prestigeValue) {
super(era,price); super(era,price,prestigeValue);
effectType= EffectType.INVENTOR_PAIR; effectType= EffectType.INVENTOR_PAIR;
effectId=4; effectId=4;
} }
@@ -53,7 +53,7 @@ public class Building4 extends BuildingCard {
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building4(getEra(),getPrice()); return new Building4(getEra(),getPrice(),getPrestigeValue());
} }
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -10,14 +10,14 @@ import java.util.stream.Collectors;
public class Building8 extends BuildingCard { public class Building8 extends BuildingCard {
public Building8(int era, int price) { public Building8(int era, int price,int prestigeValue) {
super(era,price); super(era,price,prestigeValue);
effectType= EffectType.FINAL; effectType= EffectType.FINAL;
effectId=8; effectId=8;
} }
@Override @Override
public BuildingCard clone() { public BuildingCard clone() {
return new Building8(getEra(),getPrice()); return new Building8(getEra(),getPrice(),getPrestigeValue());
} }
@Override @Override
public void applyEffect(Player player) throws IllegalArgumentException { public void applyEffect(Player player) throws IllegalArgumentException {
@@ -15,7 +15,10 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
private boolean bought; private boolean bought;
protected EffectType effectType; protected EffectType effectType;
protected int effectId; protected int effectId;
private int prestigeValue;
public int getPrestigeValue() {
return prestigeValue;
}
public int getEffectId() { public int getEffectId() {
return effectId; return effectId;
} }
@@ -23,31 +26,27 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
return effectType; return effectType;
} }
public BuildingCard(int era,int price) throws IllegalArgumentException{ public BuildingCard(int era,int price,int prestigeValue) throws IllegalArgumentException{
super(era); super(era);
if (price > 0) { if (price > 0) {
this.price = price; this.price = price;
} else { } else {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.prestigeValue = prestigeValue;
bought = false; bought = false;
} }
public BuildingCard(int effectId,EffectType effectType ,int era,int price) throws IllegalArgumentException{ public BuildingCard(int effectId,EffectType effectType ,int era,int price,int prestigeValue) throws IllegalArgumentException{
this.effectId = effectId; this.effectId = effectId;
this.effectType = effectType; this.effectType = effectType;
super(era); this(era,price,prestigeValue);
if (price > 0) {
this.price = price;
} else {
throw new IllegalArgumentException();
}
} }
@Override @Override
public BuildingCard clone() public BuildingCard clone()
{ {
return new BuildingCard(effectId,effectType,getEra(),getPrice()); return new BuildingCard(effectId,effectType,getEra(),getPrice(),getPrestigeValue());
} }
public boolean buy(Player player) { public boolean buy(Player player) {
if( bought || !player.removeFood(getPrice())) if( bought || !player.removeFood(getPrice()))