package it.polimi.ingsw.gc14.Model.Cards.Building.Effects;

import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
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.Player;

import java.util.HashMap;

public class Building10 extends BuildingCard {
    public Building10(int era, int price,int prestigeValue) {
        super(era,price,prestigeValue);
        effectType= EffectType.FINAL;
        effectId=10;
    }
    @Override
    public BuildingCard clone() {
        return new Building10(getEra(),getPrice(),getPrestigeValue());
    }
    @Override
    public void applyEffect(Player player) throws IllegalArgumentException {
        if(!player.buildingCards.contains(this))
            throw new IllegalArgumentException();
        HashMap<CharacterType,Integer> map = new HashMap<CharacterType,Integer>();

        int numSet=player.getNType(CharacterType.INVENTOR);
        for(CharacterType type : CharacterType.values())
        {
            if(player.getNType(type)<=numSet)
                numSet=player.getNType(type);
        }

        player.addPrestige(6 * numSet);
    }

}
