Package megamek.common.units
Class EntityClassTurn
java.lang.Object
megamek.common.game.AbstractPlayerTurn
megamek.common.game.GameTurn
megamek.common.units.EntityClassTurn
- All Implemented Interfaces:
Serializable,PlayerTurn
A type of game turn that allows only certain types of units to move.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe constant to represent Aero entities.static final intThe constant to represent building entities.static final intThe constant to represent dropship entities.static final intThe constant to represent Gun Emplacement entities.static final intThe constant to represent handheld weapon entities.static final intThe constant to represent Infantry (and Battle Armor) entities.static final intThe constant to represent jumpship entities.static final intThe constant to represent Mek entities.static final intThe constant to represent Protomek entities.static final intThe constant to represent warship entities.static final intThe constant to represent space station entities.static final intThe constant to represent Tank entities.static final intThe constant to represent warship entities. -
Constructor Summary
ConstructorsConstructorDescriptionEntityClassTurn(int playerId, int classMask) Only allow entities for the given player which have types in the class mask to move. -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetClassCode(Entity entity) Get the class code for the given entity.intGet the class code of this turnbooleanisValidClass(int classCode) Determine if entities of the given class get to move.booleanisValidEntity(Entity entity, Game game, boolean useValidNonInfantryCheck) Determine if the given entity is a valid one to use for this turn.toString()Methods inherited from class megamek.common.game.GameTurn
isMultiTurn, isValid, isValidEntity, isValidEntity, setMultiTurnMethods inherited from class megamek.common.game.AbstractPlayerTurn
playerIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.interfaces.PlayerTurn
isValid, isValid
-
Field Details
-
CLASS_INFANTRY
public static final int CLASS_INFANTRYThe constant to represent Infantry (and Battle Armor) entities.- See Also:
-
CLASS_PROTOMEK
public static final int CLASS_PROTOMEKThe constant to represent Protomek entities.- See Also:
-
CLASS_TANK
public static final int CLASS_TANKThe constant to represent Tank entities.- See Also:
-
CLASS_MEK
public static final int CLASS_MEKThe constant to represent Mek entities.- See Also:
-
CLASS_GUN_EMPLACEMENT
public static final int CLASS_GUN_EMPLACEMENTThe constant to represent Gun Emplacement entities.- See Also:
-
CLASS_AERO
public static final int CLASS_AEROThe constant to represent Aero entities.- See Also:
-
CLASS_SPACE_STATION
public static final int CLASS_SPACE_STATIONThe constant to represent space station entities.- See Also:
-
CLASS_JUMPSHIP
public static final int CLASS_JUMPSHIPThe constant to represent jumpship entities.- See Also:
-
CLASS_WARSHIP
public static final int CLASS_WARSHIPThe constant to represent warship entities.- See Also:
-
CLASS_DROPSHIP
public static final int CLASS_DROPSHIPThe constant to represent dropship entities.- See Also:
-
CLASS_SMALL_CRAFT
public static final int CLASS_SMALL_CRAFTThe constant to represent warship entities.- See Also:
-
CLASS_HANDHELD_WEAPON
public static final int CLASS_HANDHELD_WEAPONThe constant to represent handheld weapon entities.- See Also:
-
CLASS_BUILDING_ENTITY
public static final int CLASS_BUILDING_ENTITYThe 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- theintID of the playerclassMask- theintbitmask containing all the valid class types for this move.
-
-
Method Details
-
isValidEntity
Determine if the given entity is a valid one to use for this turn.- Overrides:
isValidEntityin classGameTurn- Parameters:
entity- theEntitybeing tested for the move.game- TheGamethe entity belongs touseValidNonInfantryCheck- Boolean that determines if we should check to see if infantry can be moved yet- Returns:
trueif the entity can be moved.
-
isValidClass
public boolean isValidClass(int classCode) Determine if entities of the given class get to move.- Parameters:
classCode- theintclass code being tested- Returns:
trueif 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
- Overrides:
toStringin classAbstractPlayerTurn
-
getClassCode
Get the class code for the given entity.- Parameters:
entity- theEntitywhose class code is needed.- Returns:
- the
intcode for the entity's class.
-