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