From a25218af09eb0edf73e33417d22b316407a1f824 Mon Sep 17 00:00:00 2001 From: MatteoPellegrino05 Date: Sun, 12 Apr 2026 19:15:17 +0200 Subject: [PATCH] Add: JavaDoc for Order2 --- .../polimi/ingsw/gc14/Model/Orders/Order2.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java index ffbf893..e27dc37 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java @@ -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 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 {