Class EntityClassTurn

All Implemented Interfaces:
Serializable, PlayerTurn

public class EntityClassTurn extends GameTurn
A type of game turn that allows only certain types of units to move.
See Also:
  • Field Details

    • CLASS_INFANTRY

      public static final int CLASS_INFANTRY
      The constant to represent Infantry (and Battle Armor) entities.
      See Also:
    • CLASS_PROTOMEK

      public static final int CLASS_PROTOMEK
      The constant to represent Protomek entities.
      See Also:
    • CLASS_TANK

      public static final int CLASS_TANK
      The constant to represent Tank entities.
      See Also:
    • CLASS_MEK

      public static final int CLASS_MEK
      The constant to represent Mek entities.
      See Also:
    • CLASS_GUN_EMPLACEMENT

      public static final int CLASS_GUN_EMPLACEMENT
      The constant to represent Gun Emplacement entities.
      See Also:
    • CLASS_AERO

      public static final int CLASS_AERO
      The constant to represent Aero entities.
      See Also:
    • CLASS_SPACE_STATION

      public static final int CLASS_SPACE_STATION
      The constant to represent space station entities.
      See Also:
    • CLASS_JUMPSHIP

      public static final int CLASS_JUMPSHIP
      The constant to represent jumpship entities.
      See Also:
    • CLASS_WARSHIP

      public static final int CLASS_WARSHIP
      The constant to represent warship entities.
      See Also:
    • CLASS_DROPSHIP

      public static final int CLASS_DROPSHIP
      The constant to represent dropship entities.
      See Also:
    • CLASS_SMALL_CRAFT

      public static final int CLASS_SMALL_CRAFT
      The constant to represent warship entities.
      See Also:
    • CLASS_HANDHELD_WEAPON

      public static final int CLASS_HANDHELD_WEAPON
      The constant to represent handheld weapon entities.
      See Also:
    • CLASS_BUILDING_ENTITY

      public static final int CLASS_BUILDING_ENTITY
      The constant to represent building entities.
      See Also:
  • Constructor Details

    • EntityClassTurn

      public EntityClassTurn(int playerId, int classMask)
      Only allow entities for the given player which have types in the class mask to move.
      Parameters:
      playerId - the int ID of the player
      classMask - the int bitmask containing all the valid class types for this move.
  • Method Details

    • isValidEntity

      public boolean isValidEntity(@Nullable Entity entity, Game game, boolean useValidNonInfantryCheck)
      Determine if the given entity is a valid one to use for this turn.
      Overrides:
      isValidEntity in class GameTurn
      Parameters:
      entity - the Entity being tested for the move.
      game - The Game the entity belongs to
      useValidNonInfantryCheck - Boolean that determines if we should check to see if infantry can be moved yet
      Returns:
      true if the entity can be moved.
    • isValidClass

      public boolean isValidClass(int classCode)
      Determine if entities of the given class get to move.
      Parameters:
      classCode - the int class code being tested
      Returns:
      true if entities of that class can move.
    • getTurnCode

      public int getTurnCode()
      Get the class code of this turn
      Returns:
      the class code of this turn
    • toString

      public String toString()
      Overrides:
      toString in class AbstractPlayerTurn
    • getClassCode

      public static int getClassCode(Entity entity)
      Get the class code for the given entity.
      Parameters:
      entity - the Entity whose class code is needed.
      Returns:
      the int code for the entity's class.