Class GameTurn

All Implemented Interfaces:
Serializable, PlayerTurn
Direct Known Subclasses:
EntityClassTurn, PrephaseTurn, SpecificEntityTurn, UnitNumberTurn, UnloadStrandedTurn

public class GameTurn extends AbstractPlayerTurn
Represents a single turn within a phase of the game, where a specific player has to declare his/her action. The default game turn allows a player to move any entity.
See Also:
  • Constructor Details

    • GameTurn

      public GameTurn(int playerId)
      Creates a new instance of GameTurn
  • Method Details

    • isValidEntity

      public boolean isValidEntity(@Nullable Entity entity, Game game)
      Determine if the specified entity is a valid one to use for this turn.
      Parameters:
      entity - the Entity that may take this turn.
      game - The Game the turn belongs to
      Returns:
      true if the specified entity can take this turn. false if the entity is not valid for this turn.
    • isValidEntity

      public boolean isValidEntity(@Nullable Entity entity, Game game, boolean useValidNonInfantryCheck)
      Determine if the specified entity is a valid one to use for this turn.

      In addition to the "standard" validity checks, there is also a check for the optional rules "infantry move later" and "ProtoMeks move later." This checks to see if those options are enabled and if there is a valid non-infantry (or proto) unit to move and if so, the entity is invalid.

      There are certain instances where this check should not be used when the optional rules are enabled (such as loading infantry into a unit). Hence, the use of these additional checks is specified by a boolean input parameter.

      Parameters:
      entity - the Entity that may take this turn.
      game - The Game the turn belongs to
      useValidNonInfantryCheck - Boolean that determines if we should check to see if infantry can be moved yet
      Returns:
      true if the specified entity can take this turn. false if the entity is not valid for this turn.
    • isValidEntity

      public boolean isValidEntity(InGameObject unit, IGame game)
      Returns:
      true if the given unit may act in this turn
    • isValid

      public boolean isValid(int playerId, @Nullable Entity entity, Game game)
      Returns:
      true if the player and entity are both valid.
    • isMultiTurn

      public boolean isMultiTurn()
      Description copied from interface: PlayerTurn
      Returns true if this player turn requires the player to provide actions for more than one unit. This is true for example when vehicles must be moved as a lance. This is not equivalent to providing multiple actions, such as in firing multiple weapons. That is not considered a multi-turn. By default, this method returns false.
      Returns:
      True when this turn requires actions for at least two units
    • setMultiTurn

      public void setMultiTurn(boolean isMultiTurn)