CavePaintings Event Added

This commit is contained in:
GabrieleRadice
2026-03-15 18:06:40 +01:00
parent 90566787eb
commit f42cc682c9
@@ -1,18 +1,52 @@
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Artist;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
import it.polimi.ingsw.gc14.Model.Player;
import java.util.ArrayList;
public class CavePaintings extends EventCard {
public CavePaintings(int Era) {
private int NUpper;
private int NLower;
private int NPrestigeRem; // NPrestigeLower
private int NPrestigeMul; // NPrestigeUpper
public CavePaintings(int Era, int NUpper, int NLower, int NPrestigeRem, int NPrestigeMul) {
super(Era, EventType.CAVE_PAINTINGS);
this.NUpper = NUpper;
this.NLower = NLower;
this.NPrestigeRem = NPrestigeRem;
this.NPrestigeMul = NPrestigeMul;
}
// TODO
@Override
public void activateEvent (ArrayList <Player> playerList){
for (Player player : playerList){
int NArtists = 0;
int NBuildings = 0;
ArrayList<Character> charCards = player.getCharacterCards();
ArrayList<BuildingCard> buildingCards = player.getBuildingCards();
for (Character card : charCards){
if(card instanceof Artist){
NArtists++;
}
}
for(BuildingCard card : buildingCards){
if(card.getEffectId() == 9){
NBuildings++;
}
}
player.addFood(NBuildings * NArtists);
if (NArtists <= NLower){
player.removePrestige(NPrestigeRem);
}
else{
player.addPrestige(NPrestigeMul * NUpper);
}
}
}
}