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) {
super(era,price);
public Building0(int era,int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType=EffectType.CARD_SET;
effectId=0;
purchased = false;
@@ -52,7 +52,7 @@ public class Building0 extends BuildingCard {
}
@Override
public BuildingCard clone() {
return new Building0(getEra(),getPrice());
return new Building0(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
@@ -12,15 +12,15 @@ public class Building1 extends BuildingCard {
private CharacterType icon ;
public CharacterType getIcon() {return icon;}
public Building1(int era, int price, CharacterType icon) {
super(era,price);
public Building1(int era, int price,int prestigeValue, CharacterType icon) {
super(era,price,prestigeValue);
effectType = EffectType.ON_EVENT;
effectId = 1;
this.icon = icon;
}
@Override
public BuildingCard clone() {
return new Building1(getEra(),getPrice(),getIcon());
return new Building1(getEra(),getPrice(),getPrestigeValue(),getIcon());
}
@Override
public void applyEffect(Player player) {
@@ -9,14 +9,14 @@ import it.polimi.ingsw.gc14.Model.Player;
import java.util.HashMap;
public class Building10 extends BuildingCard {
public Building10(int era, int price) {
super(era,price);
public Building10(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=10;
}
@Override
public BuildingCard clone() {
return new Building8(getEra(),getPrice());
return new Building8(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
@@ -14,8 +14,8 @@ public class Building11 extends BuildingCard {
public int getPrestigeMul() {return PrestigeMul;}
public Building11(int era, int price, CharacterType icon, int prestigeMul) {
super(era,price);
public Building11(int era, int price,int prestigeValue, CharacterType icon, int prestigeMul) {
super(era,price,prestigeValue);
effectType = EffectType.FINAL;
effectId = 11;
this.icon = icon;
@@ -23,7 +23,7 @@ public class Building11 extends BuildingCard {
}
@Override
public BuildingCard clone() {
return new Building11(getEra(),getPrice(), getIcon(), getPrestigeMul());
return new Building11(getEra(),getPrice(),getPrestigeValue(), getIcon(), getPrestigeMul());
}
@Override
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;
public class Building13 extends BuildingCard{
public Building13(int era, int price) {
super(era,price);
public Building13(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=13;
}
@Override
public BuildingCard clone() {
return new Building13(getEra(),getPrice());
return new Building13(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
@@ -12,8 +12,8 @@ public class Building4 extends BuildingCard {
boolean purchased ;
int numPair;
public Building4(int era, int price) {
super(era,price);
public Building4(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.INVENTOR_PAIR;
effectId=4;
}
@@ -53,7 +53,7 @@ public class Building4 extends BuildingCard {
@Override
public BuildingCard clone() {
return new Building4(getEra(),getPrice());
return new Building4(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
@@ -10,14 +10,14 @@ import java.util.stream.Collectors;
public class Building8 extends BuildingCard {
public Building8(int era, int price) {
super(era,price);
public Building8(int era, int price,int prestigeValue) {
super(era,price,prestigeValue);
effectType= EffectType.FINAL;
effectId=8;
}
@Override
public BuildingCard clone() {
return new Building8(getEra(),getPrice());
return new Building8(getEra(),getPrice(),getPrestigeValue());
}
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
@@ -15,7 +15,10 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
private boolean bought;
protected EffectType effectType;
protected int effectId;
private int prestigeValue;
public int getPrestigeValue() {
return prestigeValue;
}
public int getEffectId() {
return effectId;
}
@@ -23,31 +26,27 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
return effectType;
}
public BuildingCard(int era,int price) throws IllegalArgumentException{
public BuildingCard(int era,int price,int prestigeValue) throws IllegalArgumentException{
super(era);
if (price > 0) {
this.price = price;
} else {
throw new IllegalArgumentException();
}
this.prestigeValue = prestigeValue;
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.effectType = effectType;
super(era);
if (price > 0) {
this.price = price;
} else {
throw new IllegalArgumentException();
}
this(era,price,prestigeValue);
}
@Override
public BuildingCard clone()
{
return new BuildingCard(effectId,effectType,getEra(),getPrice());
return new BuildingCard(effectId,effectType,getEra(),getPrice(),getPrestigeValue());
}
public boolean buy(Player player) {
if( bought || !player.removeFood(getPrice()))