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

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;

public class Builder extends Character
{
    private int reductionValue;
    private int prestigeValue;
    /**
     *
     * @return Builder specific reduction value
     */
    public int getReductionValue() {
        return reductionValue;
    }
    public int getPrestigeValue() {
        return prestigeValue;
    }

    public Builder(int Era, int reductionValue, int prestigeValue)  throws IllegalArgumentException {
        super(Era,CharacterType.BUILDER);
        if(reductionValue < 0)  {
            throw new IllegalArgumentException();
        }
        this.reductionValue = reductionValue;

        if(prestigeValue < 0)  {
            throw new IllegalArgumentException();
        }
        this.prestigeValue = prestigeValue;
    }

    public Builder(int Era, int reductionValue, int prestigeValue,int nMin)  throws IllegalArgumentException {
        super(Era,CharacterType.BUILDER,nMin);
        if(reductionValue < 0)  {
            throw new IllegalArgumentException();
        }
        this.reductionValue = reductionValue;

        if(prestigeValue < 0)  {
            throw new IllegalArgumentException();
        }
        this.prestigeValue = prestigeValue;
    }
    public Builder(Builder copy)
    {
        this(copy.getEra(),copy.getReductionValue(), copy.getPrestigeValue());
    }
    @Override
    public String toString()  { return  super.toString()+" Reduction Value: " + String.valueOf(reductionValue) + "\n Prestige Value: " + String.valueOf(prestigeValue); }

    @Override
    public Character clone() {
        return new Builder(this);
    }

    public void insert(Player player) {
        player.builders.add(this);
    }
}