package it.polimi.ingsw.gc14.Model.Orders;

import it.polimi.ingsw.gc14.Model.OrderLogicCard;
import it.polimi.ingsw.gc14.Model.Player;

import java.util.ArrayList;

public class Order3 extends OrderLogicCard {
    public Order3(ArrayList<Player> players) {
        super(players);
    }
    @Override
    public void effect(Player player,int index) throws IndexOutOfBoundsException
    {
        if(index >= 3 || index < 0)
        {
            throw new IndexOutOfBoundsException("index out of bounds");
        }
        if(index==0)
        {
            player.addFood(2);
            buildingEffect(player);
            return;
        }
        if(index==2){
            if(player.removeFood(1)){
                player.removePrestige(2);
            }
            return;
        }
    }
}