Fix: public access now are private with setter/getter

This commit is contained in:
2026-06-09 21:06:51 +02:00
parent 3318801913
commit cbf6cb3c5b
43 changed files with 351 additions and 336 deletions
@@ -126,7 +126,7 @@ public class Building0 extends BuildingCard {
*/
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
int min_temp=player.getNType(CharacterType.INVENTOR);
for(CharacterType type : CharacterType.values())
@@ -64,7 +64,7 @@ public class Building10 extends BuildingCard {
*/
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
HashMap<CharacterType,Integer> map = new HashMap<CharacterType,Integer>();
@@ -92,7 +92,7 @@ public class Building11 extends BuildingCard {
*/
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul());
}
@@ -56,7 +56,7 @@ public class Building13 extends BuildingCard{
*/
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
player.addPrestige(25);
}
@@ -74,7 +74,7 @@ public class Building4 extends BuildingCard {
{
map.put(i,0);
}
for(Inventor inv : player.inventors)
for(Inventor inv : player.getInventors())
{
map.merge(inv.Icon(),1,Integer::sum);
}
@@ -129,14 +129,14 @@ public class Building4 extends BuildingCard {
*/
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
HashMap<Integer,Integer> map = new HashMap<>();
for(int i=0;i<10;i++)
{
map.put(i,0);
}
for(Inventor inv : player.inventors)
for(Inventor inv : player.getInventors())
{
map.merge(inv.Icon(),1,Integer::sum);
}
@@ -57,9 +57,9 @@ public class Building8 extends BuildingCard {
*/
@Override
public void applyEffect(Player player) throws IllegalArgumentException {
if(!player.buildingCards.contains(this))
if(!player.getBuildingCards().contains(this))
throw new IllegalArgumentException();
for (Builder builder : player.builders) {
for (Builder builder : player.getBuilders()) {
player.addPrestige(builder.getPrestigeValue());
}
}
@@ -243,7 +243,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
// sum reduction value builder=> sconto
public boolean buy(Player player) {
int discount = 0;
discount = player.builders.stream().mapToInt(x -> x.getReductionValue()).sum();
discount = player.getBuilders().stream().mapToInt(x -> x.getReductionValue()).sum();
if(discount > this.price){
discount = this.price;
@@ -251,7 +251,7 @@ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEf
if(bought || !player.removeFood(this.price - discount))
return false;
player.buildingCards.add(this);
player.getBuildingCards().add(this);
bought=true;
return true;
}
@@ -81,8 +81,8 @@ public class Artist extends Character {
*/
@Override
public void insert(Player player) {
player.artists.add(this);
player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
player.getArtists().add(this);
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}
@@ -175,7 +175,7 @@ public class Builder extends Character {
* @param player the player who receives the card.
*/
public void insert(Player player) {
player.builders.add(this);
player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
player.getBuilders().add(this);
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}
@@ -80,7 +80,7 @@ public class Gatherer extends Character {
* @param player the player who receives the card.
*/
public void insert(Player player) {
player.gatherers.add(this);
player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
player.getGatherers().add(this);
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}
@@ -136,11 +136,11 @@ public class Hunter extends Character {
*/
@Override
public void insert(Player player) {
player.hunters.add(this);
player.getHunters().add(this);
if(this.getIcon()){
player.addFood(player.hunters.size());
player.addFood(player.getHunters().size());
}
player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}
@@ -135,8 +135,8 @@ public class Inventor extends Character {
*/
@Override
public void insert(Player player) {
player.inventors.add(this);
player.buildingCards.stream().filter(b -> b.getEffectId() == 4).forEach(b4 -> b4.applyEffect(player));
player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
player.getInventors().add(this);
player.getBuildingCards().stream().filter(b -> b.getEffectId() == 4).forEach(b4 -> b4.applyEffect(player));
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}
@@ -124,7 +124,7 @@ public class Shaman extends Character {
@Override
public void insert(Player player)
{
player.shamans.add(this);
player.buildingCards.stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
player.getShamans().add(this);
player.getBuildingCards().stream().filter(x->x.getEffectId()==0).forEach(x->x.applyEffect(player));
}
}
@@ -79,7 +79,7 @@ public class CavePaintings extends EventCard {
for (Player player : playerList){
int NArtists = player.getNType(CharacterType.ARTIST);
int NBuildings = 0;
ArrayList<BuildingCard> buildingCards = player.buildingCards;
ArrayList<BuildingCard> buildingCards = player.getBuildingCards();
for(BuildingCard card : buildingCards){
if(card.getEffectId() == 9){
@@ -58,7 +58,7 @@ public class Hunt extends EventCard {
int tmpFoodMultiplier = foodMultiplier;
int tmpPrestigeMultiplier = prestigeMultiplier;
ArrayList <BuildingCard> buildingList = player.buildingCards;
ArrayList <BuildingCard> buildingList = player.getBuildingCards();
int hunterCounter=player.getNType(CharacterType.HUNTER);
for (BuildingCard buildingCard : buildingList) {
@@ -70,8 +70,8 @@ public class ShamanicRitual extends EventCard {
int tmpCount = 0;
for (Player player : playerList) {
tmpIcons = player.shamans.stream().mapToInt(sh -> sh.getIcon()).sum();
tmpCount = (int) player.buildingCards.stream().filter(b -> b.getEffectId() == 5).count();
tmpIcons = player.getShamans().stream().mapToInt(sh -> sh.getIcon()).sum();
tmpCount = (int) player.getBuildingCards().stream().filter(b -> b.getEffectId() == 5).count();
if (tmpCount >= 1) {
tmpIcons = tmpIcons+(3*tmpCount);
}
@@ -86,7 +86,7 @@ public class ShamanicRitual extends EventCard {
for (Player player : maxIconsPlayer) {
if (player.buildingCards.stream().anyMatch(b -> b.getEffectId() == 6) && maxIconsPlayer.size() == 1) {
if (player.getBuildingCards().stream().anyMatch(b -> b.getEffectId() == 6) && maxIconsPlayer.size() == 1) {
player.addPrestige(prestigeToAdd * 2);
} else {
player.addPrestige(prestigeToAdd);
@@ -94,7 +94,7 @@ public class ShamanicRitual extends EventCard {
}
for (Player player : minIconsPlayer) {
if (!(player.buildingCards.stream().anyMatch(b -> b.getEffectId() == 2))) {
if (!(player.getBuildingCards().stream().anyMatch(b -> b.getEffectId() == 2))) {
player.removePrestige(prestigeToRemove);
}
}
@@ -72,7 +72,7 @@ public class Sustenance extends EventCard {
int NGatherers = player.getNType(CharacterType.GATHERER);
int NCharDiscount = 0;
for(BuildingCard b : player.buildingCards){
for(BuildingCard b : player.getBuildingCards()){
if(b.getEffectId() == 1){
CharacterType c = ((Building1)b).getIcon();
NCharDiscount += player.getNType(c);