Class Order3
java.lang.Object
it.polimi.ingsw.gc14.Model.OrderLogicCard
it.polimi.ingsw.gc14.Model.Orders.Order3
- All Implemented Interfaces:
Serializable
Represents the order logic card used in a three-player game.
This class defines the specific turn-order behavior for games with three 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
-
Order3
Creates an Order3 logic card for a three-player game.- Parameters:
players- the list of players associated with this order card.- Throws:
NoSuchElementException- if the number of players is not equal to 3.
-
-
Method Details
-
effect
Applies the effect associated with the specified position index for the given player.If
index == 0, the player gains 2 Food and the building effect is applied.If
index == 1, no effect is applied.If
index == 2, 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 >= 3.
-
toString
-