package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;

import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Hunter;
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 Hunt extends EventCard {
    int foodToAdd;
    int prestigeMultiplicator;
    public Hunt(int Era, int prestigeMultiplicator) {
        super(Era, EventType.HUNT);
        this.foodToAdd = 1;
        this.prestigeMultiplicator = prestigeMultiplicator;
    }

    @Override
    public void activateEvent (ArrayList <Player> playerList){
        for (Player player : playerList) {
            ArrayList <BuildingCard> buildingList = player.buildingCards;
            int hunterCounter=player.getNType(CharacterType.HUNTER);

            for (BuildingCard buildingCard : buildingList) {
                if (buildingCard.getEffectId() == 7) {
                    foodToAdd++;
                    prestigeMultiplicator++;
                }
            }

            player.addFood(foodToAdd);
            player.addPrestige(prestigeMultiplicator * hunterCounter);
        }
    }
}
