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