BaseController
This is the base implementation of controller.Controller. Every method that does not implement controller.Controller does not change the status directly, but rather often acts upon a model.status.StatusBuilder object.
Value parameters
- fileIo
-
the model.io.FileIo used for saving and loading the status
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Should be called when an attacking player attacks with the specified card. It is not checked whether Controller.canAttack returns true. The exact update depends on the implementation, normally base.command.AttackCommand. The method assumes to be called in a valid context and will update all observers
Should be called when an attacking player attacks with the specified card. It is not checked whether Controller.canAttack returns true. The exact update depends on the implementation, normally base.command.AttackCommand. The method assumes to be called in a valid context and will update all observers
Value parameters
- card
-
The card to attack with.
Attributes
- Definition Classes
Returns the player who has the specified turn.
Returns the player who has the specified turn.
Attributes
- Returns
-
the player who has the specified turn. If multiple players have the same turn, the first one is returned.
- Definition Classes
Checks whether a card can be used to attack with.
Checks whether a card can be used to attack with.
Value parameters
- card
-
the card to attack with
Attributes
- Returns
-
true when either Status.used, Status.undefended or Status.defended contain the specified card. Otherwise, false.
- Definition Classes
Checks whether a card can be used to defend another.
Checks whether a card can be used to defend another.
Value parameters
- undefended
-
the undefended card to defend
- used
-
the card of the defending player
Attributes
- Returns
-
true when Card.beats, called on used with undefended as the argument, returns true or when used is a trump card and undefended is not. Otherwise, false.
- Definition Classes
Sets the player at index to model.turn.FirstlyAttacking and all other players' turn accordingly.
Sets the player at index to model.turn.FirstlyAttacking and all other players' turn accordingly.
Value parameters
- index
-
the index of the player to set to model.turn.FirstlyAttacking
- players
-
all players, must contain previous
Attributes
- Returns
-
a list of players with updated turns
Sets the specified player to model.turn.FirstlyAttacking and all other players' turn accordingly.
Sets the specified player to model.turn.FirstlyAttacking and all other players' turn accordingly.
Value parameters
- players
-
all players, must contain previous
- previous
-
the player to set to model.turn.FirstlyAttacking
Attributes
- Returns
-
a list of players with updated turns
Returns the player who has the current turn.
Returns the player who has the current turn.
Attributes
- Returns
-
the player who has the current turn. The current turn is determined by model.status.Status.turn.
- Definition Classes
Should be called when a defending player attacks an undefended card with one of their own. It is not checked whether controller.Controller.canDefend returns true. The exact update depends on the implementation, normally controller.base.command.DefendCommand. The method assumes to be called in a valid context and will update all observers
Should be called when a defending player attacks an undefended card with one of their own. It is not checked whether controller.Controller.canDefend returns true. The exact update depends on the implementation, normally controller.base.command.DefendCommand. The method assumes to be called in a valid context and will update all observers
Value parameters
- undefended
-
The undefended card to defend
- used
-
The card of the defending player
Attributes
- Definition Classes
Should be called when an attacking player denies their attack. The exact update depends on the implementation, normally base.command.DenyCommand. The method assumes to be called in a valid context and will update all observers
Should be called when an attacking player denies their attack. The exact update depends on the implementation, normally base.command.DenyCommand. The method assumes to be called in a valid context and will update all observers
Attributes
- Definition Classes
Draws cards from the stack and fills every player's cards up to the set card amount. It will either start with model.status.StatusBuilder.getPassed or with the player who is Turn.FirstlyAttacking.
Draws cards from the stack and fills every player's cards up to the set card amount. It will either start with model.status.StatusBuilder.getPassed or with the player who is Turn.FirstlyAttacking.
Value parameters
- statusBuilder
-
a model.status.StatusBuilder containing the initial status
Attributes
- Returns
-
a model.status.StatusBuilder containing a status with cards drawn from the stack
Sets a player to finished and updates all other data accordingly. This method does not check whether hasFinished returns true.
Sets a player to finished and updates all other data accordingly. This method does not check whether hasFinished returns true.
Value parameters
- finished
-
the player to be set to finished
- statusBuilder
-
a model.status.StatusBuilder containing the current status
Attributes
- Returns
-
an updated model.status.StatusBuilder containing the changes made after the specified player was set to finished
Checks whether the specified player is finished. A player is finished if he is attacking, having no cards left with the stack being empty. A player can also be finished if he is defending, has no cards left without there being undefended cards or cards on the stack.
Checks whether the specified player is finished. A player is finished if he is attacking, having no cards left with the stack being empty. A player can also be finished if he is defending, has no cards left without there being undefended cards or cards on the stack.
Value parameters
- finished
-
the player to check for being finished
- statusBuilder
-
a model.status.StatusBuilder containing the current status
Attributes
- Returns
-
whether the specified player is finished
Initializes the status with the specified card amount and player names. The first attacking player is chosen randomly. The exact update depends on the implementation, normally base.command.InitializeCommand. The method assumes to be called in a valid context and will update all observers
Initializes the status with the specified card amount and player names. The first attacking player is chosen randomly. The exact update depends on the implementation, normally base.command.InitializeCommand. The method assumes to be called in a valid context and will update all observers
Value parameters
- amount
-
the card amount
- names
-
the player names
Attributes
- Definition Classes
Initializes the status with the specified card amount, player names and first attacking player. The exact update depends on the implementation, normally base.command.InitializeCommand. The method assumes to be called in a valid context and will update all observers
Initializes the status with the specified card amount, player names and first attacking player. The exact update depends on the implementation, normally base.command.InitializeCommand. The method assumes to be called in a valid context and will update all observers
Value parameters
- amount
-
the card amount
- attacking
-
the first attacking player
- names
-
the player names
Attributes
- Definition Classes
Returns whether the game is over.
Returns whether the game is over.
Attributes
- Returns
-
true when there is only one player whose turn is not model.Turn.Finished. Otherwise, false.
- Definition Classes
Loads the status from I/O, normally calling model.io.FileIo.load and thus might block. All exceptions will be caught. The method assumes to be called in a valid context and will update all observers
Loads the status from I/O, normally calling model.io.FileIo.load and thus might block. All exceptions will be caught. The method assumes to be called in a valid context and will update all observers
Attributes
- Definition Classes
Should be called when a defending player picks cards up, thus failing to defend. The exact update depends on the implementation, normally base.command.DefendCommand. The method assumes to be called in a valid context and will update all observers
Should be called when a defending player picks cards up, thus failing to defend. The exact update depends on the implementation, normally base.command.DefendCommand. The method assumes to be called in a valid context and will update all observers
Attributes
- Definition Classes
Redoes the last undone command. The method assumes to be called in a valid context and will update all observers
Redoes the last undone command. The method assumes to be called in a valid context and will update all observers
Attributes
- Definition Classes
Saves the status to I/O, normally calling model.io.FileIo.save and thus might block. All exceptions will be caught. The method assumes to be called in a valid context and will update all observers
Saves the status to I/O, normally calling model.io.FileIo.save and thus might block. All exceptions will be caught. The method assumes to be called in a valid context and will update all observers
Attributes
- Definition Classes
Unbinds any I/O, normally calling model.io.FileIo.unbind.
Undoes the last command. The method assumes to be called in a valid context and will update all observers
Undoes the last command. The method assumes to be called in a valid context and will update all observers
Attributes
- Definition Classes
Replaces old with updated in players
Replaces old with updated in players
Value parameters
- old
-
the player to be replaced with
- players
-
list of players to update
- updated
-
the player to replace old
Attributes
- Returns
-
an updated list
Inherited methods
Adds an observer.
Adds an observer.
Value parameters
- observer
-
the observer to add
Attributes
- Inherited from:
- Observable
Notifies all added observers.
Removes an observer.
Removes an observer.
Value parameters
- observer
-
the observer to remove
Attributes
- Inherited from:
- Observable