Class Sustenance
java.lang.Object
it.polimi.ingsw.gc14.Model.PlayableCard
it.polimi.ingsw.gc14.Model.Cards.TribeCard
it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard
it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events.Sustenance
- All Implemented Interfaces:
Serializable
Represents a Sustenance event card.
This class defines the specific behavior of the Sustenance event.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intFood units covered by each Gatherer during the Sustenance event.private final intThe prestige penalty multiplier applied for each unpaid Food unit. -
Constructor Summary
ConstructorsConstructorDescriptionSustenance(int Era, int prestigeDebt) Creates a Sustenance event card with the specified era and prestige debt value.Sustenance(String idIMG, int Era, int prestigeDebt) Creates a Sustenance event card with the specified image id, era and prestige debt value. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateEvent(ArrayList<Player> playerList) Activates the Sustenance event for the specified list of players.clone()Creates and returns a copy of this Sustenance event card.intReturns the prestige penalty multiplier associated with this Sustenance event.Returns the representation shown on the board (offer track cards).Prints a string representation of thisTribeCard.Methods inherited from class TribeCard
getNMin, isEventCardMethods inherited from class PlayableCard
getEra, getIdIMG
-
Field Details
-
FOOD_PER_GATHERER
private static final int FOOD_PER_GATHERERFood units covered by each Gatherer during the Sustenance event.- See Also:
-
prestigeDebt
private final int prestigeDebtThe prestige penalty multiplier applied for each unpaid Food unit.
-
-
Constructor Details
-
Sustenance
public Sustenance(int Era, int prestigeDebt) Creates a Sustenance event card with the specified era and prestige debt value.- Parameters:
Era- the era of the event card.prestigeDebt- the prestige penalty multiplier for unpaid Food units.
-
Sustenance
Creates a Sustenance event card with the specified image id, era and prestige debt value.- Parameters:
idIMG- the image identifier of the Sustenance event card.Era- the era of the event card.prestigeDebt- the prestige penalty multiplier for unpaid Food units.
-
-
Method Details
-
getPrestigeDebt
public int getPrestigeDebt()Returns the prestige penalty multiplier associated with this Sustenance event.- Returns:
- the prestige penalty multiplier associated with this Sustenance event.
-
activateEvent
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 byprestigeDebt. This event is intended to be executed last among event effects.- Specified by:
activateEventin classEventCard- Parameters:
playerList- the list of players affected by the event.
-
clone
-
toStringPlayer
Prints a string representation of thisTribeCard. This specific variation is used in theGame's toString to print a more detailed version. Includes:- Specified by:
toStringPlayerin classPlayableCard- Returns:
String- a string representation of thisTribeCard.- See Also:
-
toStringBoard
Description copied from class:PlayableCardReturns the representation shown on the board (offer track cards).- Specified by:
toStringBoardin classPlayableCard- Returns:
- the board string representation of this card.
-