Class Order5
java.lang.Object
it.polimi.ingsw.gc14.Model.OrderLogicCard
it.polimi.ingsw.gc14.Model.Orders.Order5
- All Implemented Interfaces:
Serializable
Represents the order logic card used in a five-player game.
This class defines the specific turn-order behavior for games with five players.
- See Also:
-
Field Summary
Fields inherited from class OrderLogicCard
playerList -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class OrderLogicCard
buildingEffect, containsInQueue, getFirst, getPlayerList, getPosition, pull, push, pushNoEffect, removeFromQueue
-
Constructor Details
-
Order5
Creates an Order5 logic card for a five-player game.- Parameters:
players- the list of players associated with this order card.- Throws:
NoSuchElementException- if the number of players is not equal to 5.
-
-
Method Details
-
effect
Applies the effect associated with the specified position index for the given player.If
index == 0, the player gains 3 Food and the building effect is applied.If
index == 1, the player gains 1 Food and the building effect is applied.If
index == 2, no effect is applied.If
index == 3, no effect is applied.If
index == 4, the player tries to remove 1 Food; if the player cannot pay it, the player loses 2 Prestige.- Specified by:
effectin classOrderLogicCard- Parameters:
player- the player to whom the effect is applied.index- the position index of the effect to apply.- Throws:
IndexOutOfBoundsException- ifindex < 0orindex >= 5.
-
toString
-