- All Superinterfaces:
Remote
- All Known Implementing Classes:
GameControllerRMI
Interface representing gameController for the RMI connection. Hence this interface is exposed to the network as RMI remote interface.
The controller is the controller given to a particular players using RMI for connection. This implies the methods called
via this gameController are implicitly referred to the players it belongs to.
This is a controller for a single game/match
This is a controller for a single game/match
-
Method Summary
Modifier and TypeMethodDescriptionvoid
choosePersonalObjective
(CardObjectiveIF cardObj) Method callable only during INIT phase.int
void
pickCard
(CardPlayableIF card) Picks one of the 6 cards on the table, and makes the game proceed to the next Turn.void
playCard
(CardPlayableIF card, Side side, Coordinates coord) Plays a given card side on the field, at the given coordinatesvoid
playStarter
(Side side) Method callable only once during INIT phase.void
transmitChatMessage
(List<PlayerLobby> receivers, String text) Transmits a chat message (while this message will not cause any change in the model, nor will it be stored, it follows the same path as all the other messages)void
Updates the ping of the player's listener by setting it to the current time
-
Method Details
-
updatePing
Updates the ping of the player's listener by setting it to the current time- Throws:
RemoteException
-
playStarter
Method callable only once during INIT phase. It plays the starter card of the player on the passed side- Parameters:
side
- The side of the starting card- Throws:
GameStatusException
- If game phase is not INITInvalidPlayCardException
- Positioning error of the card at coordinates (0,0).RemoteException
-
choosePersonalObjective
void choosePersonalObjective(CardObjectiveIF cardObj) throws RemoteException, InvalidChoiceException, VariableAlreadySetException, GameStatusException Method callable only during INIT phase. Sets the personal objective of the player according to his choice. The objective card must be between the 2 possible cards given to the player. They can be retrieved withfetchPersonalObjectives(player)
- Parameters:
cardObj
- the objective chosen by the player- Throws:
GameStatusException
- if this method isn't called in the INIT phaseInvalidChoiceException
- if the objective card does not belong to the list of the possible objective cards for the playerVariableAlreadySetException
- if this method has been called before for the playerRemoteException
-
playCard
void playCard(CardPlayableIF card, Side side, Coordinates coord) throws RemoteException, RequirementsNotMetException, InvalidPlayCardException, GameStatusException Plays a given card side on the field, at the given coordinates- Parameters:
card
- Card which is being played. It must be in player's handside
- Indicates whether the card is going to be played on the front or on the backcoord
- Coordinates in the field of the player where the card is going to be positioned- Throws:
RequirementsNotMetException
- If the requirements for playing the specified card in player's field are not metInvalidPlayCardException
- If the player doesn't have the specified cardGameStatusException
- If this method is called in the INIT or CALC POINTS phaseRemoteException
-
pickCard
void pickCard(CardPlayableIF card) throws RemoteException, InvalidDrawCardException, GameStatusException Picks one of the 6 cards on the table, and makes the game proceed to the next Turn. If there is no other turn to play after this one, it adds the objective points and calculates the winner.- Parameters:
card
- A playable card that should be in the field- Throws:
InvalidDrawCardException
- if the passed card is not on the tableGameStatusException
- if this method is called in the INIT or CALC POINTS phaseRemoteException
-
getGameId
- Returns:
- Unique number indicating the actual game model (hence the game/match to its all entirety)
- Throws:
RemoteException
-
getPlayers
- Returns:
- the players of the match
- Throws:
RemoteException
-
transmitChatMessage
Transmits a chat message (while this message will not cause any change in the model, nor will it be stored, it follows the same path as all the other messages)- Parameters:
receivers
- of the messagetext
- content of the message- Throws:
RemoteException
-