Fix: minor bug

This commit is contained in:
2026-06-12 20:18:51 +02:00
parent 053f0048bc
commit 9a931bfc1b
21 changed files with 268 additions and 274 deletions
@@ -33,7 +33,7 @@ public class Building11 extends BuildingCard {
*
* @return the prestige multiplier associated with this building card effect.
*/
public int getprestigeMul() {return prestigeMul;}
public int getPrestigeMul() {return prestigeMul;}
/**
* Creates a Building11 card with the specified era, price, prestige value,
@@ -79,7 +79,7 @@ public class Building11 extends BuildingCard {
*/
@Override
public BuildingCard clone() {
return new Building11(getIdIMG(),getEra(),getPrice(),getPrestigeValue(), getIcon(), getprestigeMul());
return new Building11(getIdIMG(),getEra(),getPrice(),getPrestigeValue(), getIcon(), getPrestigeMul());
}
/**
@@ -94,7 +94,7 @@ public class Building11 extends BuildingCard {
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
player.addPrestige(player.getNType(getIcon()) * this.getprestigeMul());
player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul());
}
/**
@@ -79,7 +79,7 @@ public class Building4 extends BuildingCard {
}
for(Inventor inv : player.getInventors())
{
map.merge(inv.Icon(),1,Integer::sum);
map.merge(inv.getIcon(),1,Integer::sum);
}
numPair=0;
for(Integer i : map.values())
@@ -141,7 +141,7 @@ public class Building4 extends BuildingCard {
}
for(Inventor inv : player.getInventors())
{
map.merge(inv.Icon(),1,Integer::sum);
map.merge(inv.getIcon(),1,Integer::sum);
}
int temp=0;
for(Integer i : map.values())
@@ -20,7 +20,7 @@ public class Inventor extends Character {
*
* @return the icon value of this Inventor card.
*/
public int Icon() {
public int getIcon() {
return icon;
}
@@ -77,21 +77,21 @@ public class CavePaintings extends EventCard {
@Override
public void activateEvent (ArrayList <Player> playerList){
for (Player player : playerList){
int NArtists = player.getNType(CharacterType.ARTIST);
int NBuildings = 0;
int nArtists = player.getNType(CharacterType.ARTIST);
int nBuildings = 0;
ArrayList<BuildingCard> buildingCards = player.getBuildingCards();
for(BuildingCard card : buildingCards){
if(card.getEffectId() == 9){
NBuildings++;
nBuildings++;
}
}
player.addFood(NBuildings * NArtists);
if (NArtists < nLower){
player.addFood(nBuildings * nArtists);
if (nArtists < nLower){
player.removePrestige(nPrestigeRem);
}
else{
player.addPrestige(nPrestigeMul * NArtists);
player.addPrestige(nPrestigeMul * nArtists);
}
}
}
@@ -28,7 +28,7 @@ public class Sustenance extends EventCard {
*
* @return the prestige penalty multiplier associated with this Sustenance event.
*/
public int getprestigeDebt() {
public int getPrestigeDebt() {
return prestigeDebt;
}
@@ -71,30 +71,30 @@ public class Sustenance extends EventCard {
@Override
public void activateEvent (ArrayList <Player> playerList) throws NullPointerException {
for(Player player : playerList){
int NChar = player.getTotCharacters();
int NGatherers = player.getNType(CharacterType.GATHERER);
int nChar = player.getTotCharacters();
int nGatherers = player.getNType(CharacterType.GATHERER);
int NCharDiscount = 0;
int nCharDiscount = 0;
for(BuildingCard b : player.getBuildingCards()){
if(b.getEffectId() == 1){
CharacterType c = ((Building1)b).getIcon();
NCharDiscount += player.getNType(c);
nCharDiscount += player.getNType(c);
}
}
int FoodDebt = NChar - (FOOD_PER_GATHERER * NGatherers + NCharDiscount);
int foodDebt = nChar - (FOOD_PER_GATHERER * nGatherers + nCharDiscount);
if(FoodDebt <= 0){
if(foodDebt <= 0){
continue;
}
if(player.getFoodValue() >= FoodDebt){
player.removeFood(FoodDebt);
if(player.getFoodValue() >= foodDebt){
player.removeFood(foodDebt);
}
else{
FoodDebt -= player.getFoodValue();
foodDebt -= player.getFoodValue();
player.removeFood(player.getFoodValue()); // player.getFoodValue() == 0
player.removePrestige(FoodDebt * prestigeDebt);
player.removePrestige(foodDebt * prestigeDebt);
}
}
}