diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java index 00b2a9e..59be90f 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java @@ -9,17 +9,45 @@ import it.polimi.ingsw.gc14.Model.Player; import java.util.ArrayList; public class Sustenance extends EventCard { + + /** + * The prestige penalty multiplier applied for each unpaid Food unit. + */ private int PrestigeDebt; + + /** + * Returns the prestige penalty multiplier associated with this Sustenance event. + * + * @return the prestige penalty multiplier associated with this Sustenance event. + */ public int getPrestigeDebt() { return PrestigeDebt; } + /** + * Creates a Sustenance event card with the specified era and prestige debt value. + * + * @param Era the era of the event card. + * @param PrestigeDebt the prestige penalty multiplier for unpaid Food units. + */ public Sustenance(int Era, int PrestigeDebt) { super(Era, EventType.SUSTENANCE); this.PrestigeDebt = PrestigeDebt; } - // Sustenence va eseguito per ultimo tra gli eventi + /** + * Activates the Sustenance event for the specified list of players. + * For each player, the required Food is computed from the total number of characters, + * reduced by the contribution of Gatherers and by any applicable character discounts + * granted by owned building cards with effect id equal to 1. + * If the resulting Food debt is positive, the player must pay it with available Food. + * If the player does not have enough Food, all remaining Food is removed and the player + * loses Prestige equal to the unpaid Food debt multiplied by {@code PrestigeDebt}. + * This event is intended to be executed last among event effects. + * + * @param playerList the list of players affected by the event. + * @throws NullPointerException if {@code playerList} or one of its required elements is {@code null}. + */ @Override public void activateEvent (ArrayList playerList) throws NullPointerException { for(Player player : playerList){ @@ -51,6 +79,12 @@ public class Sustenance extends EventCard { } } } + + /** + * Creates and returns a copy of this Sustenance event card. + * + * @return a clone of this Sustenance event card. + */ @Override public EventCard clone() { return new Sustenance(getEra(), PrestigeDebt);