Add: JavaDoc for Order2

This commit is contained in:
MatteoPellegrino05
2026-04-12 19:15:17 +02:00
parent ba9fe58d5b
commit a25218af09
@@ -7,12 +7,30 @@ import it.polimi.ingsw.gc14.Model.Player;
import java.util.*;
public class Order2 extends OrderLogicCard {
/**
* Creates an Order2 logic card for a two-player game.
*
* @param players the list of players associated with this order card
* @throws NoSuchElementException if the number of players is not equal to 2
*/
public Order2(ArrayList<Player> players)throws NoSuchElementException {
if(players.size()!=2)
throw new NoSuchElementException();
super(players);
}
/**
* Applies the effect associated with the specified position index for the given player.
* If {@code index == 0}, the player gains 1 Food and the building effect is applied.
* If {@code index == 1}, the player tries to remove 1 Food; if the player cannot remove it,
* the player loses 2 Prestige.
*
* @param player the player to whom the effect is applied
* @param index the position index of the effect to apply
* @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 2}
*/
@Override
protected void effect(Player player,int index) throws IndexOutOfBoundsException
{