Class RevealFreshCardCommand
java.lang.Object
ca.uqam.info.controller.RevealFreshCardCommand
- All Implemented Interfaces:
ca.uqam.info.mgl7010.max.skyjo.controller.Command
public class RevealFreshCardCommand
extends Object
implements ca.uqam.info.mgl7010.max.skyjo.controller.Command
Command implementation for drawing a fresh card from the deck in Skyjo game.
This command represents the player's decision to take the top card from the deck
and place it in their personal buffer for potential use during their turn.
After executing this command, the player can choose to either keep the drawn card
(by replacing one of their own cards) or reject it (using RejectCardCommand).
This command makes the RejectCardCommand available in the follow-up options.
- Version:
- 2.1
- Author:
- Mohamed Latif Diallo, Hamza Afif, Ussel Sabbat
-
Constructor Summary
ConstructorsConstructorDescriptionRevealFreshCardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model) Constructs a new RevealFreshCardCommand with the specified game model. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the reveal fresh card command by: 1.ca.uqam.info.mgl7010.max.skyjo.controller.Command[]After execution of a command calling this method creates a list of legal follow-up commands.booleanIndicates whether this command supports undo operations.toString()Returns the name of the commandvoidundo()Undo operation for this command.
-
Constructor Details
-
RevealFreshCardCommand
public RevealFreshCardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model) Constructs a new RevealFreshCardCommand with the specified game model.- Parameters:
model- the Skyjo game model instance, must not be null
-
-
Method Details
-
execute
public void execute()Executes the reveal fresh card command by: 1. Drawing the top card from the deck (removing it from the deck) 2. Placing the drawn card in the player's buffer for decision-making The card is now available in the buffer and the player must decide whether to keep it (by replacing one of their cards) or reject it (sending it to discard). This action does not end the player's turn - they must make a subsequent decision.- Specified by:
executein interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
undo
public void undo()Undo operation for this command. Not implemented for TP2 requirements. This method is part of the Command interface but remains unused in this version.- Specified by:
undoin interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
isUndoable
public boolean isUndoable()Indicates whether this command supports undo operations.- Specified by:
isUndoablein interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command- Returns:
- false as undo functionality is not implemented for TP2
-
getFollowUpCommands
public ca.uqam.info.mgl7010.max.skyjo.controller.Command[] getFollowUpCommands()After execution of a command calling this method creates a list of legal follow-up commands. Can only be empty at game end. Returns: legal followup commands.- Specified by:
getFollowUpCommandsin interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
toString
-