Add: Javadoc for Sustenance class
This commit is contained in:
@@ -9,17 +9,45 @@ import it.polimi.ingsw.gc14.Model.Player;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Sustenance extends EventCard {
|
public class Sustenance extends EventCard {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The prestige penalty multiplier applied for each unpaid Food unit.
|
||||||
|
*/
|
||||||
private int PrestigeDebt;
|
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() {
|
public int getPrestigeDebt() {
|
||||||
return PrestigeDebt;
|
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) {
|
public Sustenance(int Era, int PrestigeDebt) {
|
||||||
super(Era, EventType.SUSTENANCE);
|
super(Era, EventType.SUSTENANCE);
|
||||||
this.PrestigeDebt = PrestigeDebt;
|
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
|
@Override
|
||||||
public void activateEvent (ArrayList <Player> playerList) throws NullPointerException {
|
public void activateEvent (ArrayList <Player> playerList) throws NullPointerException {
|
||||||
for(Player player : playerList){
|
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
|
@Override
|
||||||
public EventCard clone() {
|
public EventCard clone() {
|
||||||
return new Sustenance(getEra(), PrestigeDebt);
|
return new Sustenance(getEra(), PrestigeDebt);
|
||||||
|
|||||||
Reference in New Issue
Block a user