Class Entity
- All Implemented Interfaces:
Serializable
,BTObject
,CombatRole
,Deployable
,ForceAssignable
,InGameObject
,ITechnology
,ITurnOrdered
,PhaseUpdated
,RoundUpdated
,Targetable
,Transporter
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface megamek.common.ITechnology
ITechnology.AvailabilityValue, ITechnology.Era, ITechnology.Faction, ITechnology.FactionAffiliation, ITechnology.TechBase, ITechnology.TechRating
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected static int[]
protected static int[]
protected int
altitude is different from elevation.protected List<AmmoMounted>
A list of all mounted ammo.protected int[]
protected ITechnology.TechRating
Used by support vehicles to define tech rating of armor.protected double
protected int[]
protected boolean
protected int
Keeps track of the current ASEW effect on this entitystatic final int
protected boolean
protected List<BombMounted>
A list of all mounted bombs.protected boolean
protected boolean
protected int
protected int
protected String
protected Camouflage
protected boolean
protected boolean
protected String
protected String
The special chassis name for Clan Meks such as Timber Wolf for the Mad Cat.protected int
Keeps track of the number of consecutive turns a radical heat sink has been used.protected boolean
int
protected CriticalSlot[][]
This matrix stores critical slots in the format [location][slot #].int
int
int
protected boolean
protected boolean
protected DisplacementAttackAction
static final int
static final int
static final int
static final int
static final int
boolean
static final int
protected boolean
protected boolean
protected int
this is the elevation of the Entity--with respect to the surface of the hex it's in.int
protected ITechnology.TechRating
Used by support vehicles to define tech rating of armor.A list of all mounted equipment.static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
Entity Type Id Definitions These are used to identify the type of Entity, such as 'Mek or aero.static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final long
protected String
ID settable by external sources (such as mm.net)protected int
protected boolean
protected boolean
Contains the ids of all entities that this entity has established a firing solution on.protected EntityFluff
protected Game
boolean
static final int
static final int
static final int
protected boolean[]
protected boolean
Keeps track of whether or not this Entity has a critically hit radical heat sink.protected boolean
True when the entity has an undestroyed searchlight that is neither a Quirk searchlight nor a mounted (0.5t / 1slot) searchlight.int
int
int
protected int
protected GamePhase
Keeps track of whether this Entity should activate in a particular game phase.protected boolean
protected Base64Image
The icon for this unit; This is empty unless the unit file has an embedded icon.protected int
protected IGame
protected boolean
protected ArrayList<WeaponAttackAction>
Vector storing references to friendly weapon attack actions this entity may need to support; Primarily used by Princess to speed up TAG utility calculations.The object that tracks this unit's Inferno round hits.protected int
boolean
protected boolean
protected boolean
Flag that determines if this Entity is a hidden unit or not (see TW pg 259).protected boolean
protected int
protected int
protected int
protected String
protected boolean
static final int
static final int
protected boolean[]
protected boolean[]
protected long
protected long
protected boolean
Used to determine if this Entity has made a pointblank shot so far this round.protected int
protected boolean
protected static int[]
static final int
static final int
protected boolean
protected List<MiscMounted>
A list of all remaining equipment.protected boolean
protected String
protected EntityMovementMode
Stores the current movement mode.int
protected int
protected int
If this is a unit from an official source, the MUL ID links it to its corresponding entry in the online Master Unit List.protected int
protected int
protected int
protected int
protected int
protected boolean
protected Player
protected int
protected EntityMovementMode
protected boolean
boolean
boolean
protected boolean
protected int
Used for Entities that are bigger than a single hex.protected boolean
protected boolean
protected boolean
Contains the ids of all entities that have been detected by this entity's sensors.protected boolean
protected boolean
protected boolean
protected String
boolean
static final int
protected boolean
protected boolean
protected ITechnology.TechRating
Used by support vehicles to define the structural tech rating (TM pg 117).protected int
protected int
protected boolean
protected static final TechAdvancement
protected static final TechAdvancement
protected static final TechAdvancement
protected static final TechAdvancement
protected int
protected int
protected int
protected int
protected boolean
protected int
protected int
protected int
protected List<WeaponMounted>
A list of every weapon mount, including bay mounts and weapon group mountsprotected int
protected GamePhase
int
protected boolean
static final int
protected boolean
protected boolean
protected boolean
protected boolean
protected int[]
protected int
protected List<WeaponMounted>
A list of all mounted weapon baysprotected List<WeaponMounted>
A list of all mounted weapon groupsprotected List<WeaponMounted>
A list of all mounted weapons.protected double
int
protected int
Fields inherited from interface megamek.common.ITechnology
DATE_ES, DATE_NONE, DATE_PS
Fields inherited from interface megamek.common.Targetable
TYPE_BLDG_IGNITE, TYPE_BLDG_TAG, TYPE_BUILDING, TYPE_ENTITY, TYPE_FLARE_DELIVER, TYPE_FUEL_TANK, TYPE_FUEL_TANK_IGNITE, TYPE_HEX_AERO_BOMB, TYPE_HEX_ARTILLERY, TYPE_HEX_BOMB, TYPE_HEX_CLEAR, TYPE_HEX_EXTINGUISH, TYPE_HEX_IGNITE, TYPE_HEX_SCREEN, TYPE_HEX_TAG, TYPE_INARC_POD, TYPE_MINEFIELD_CLEAR, TYPE_MINEFIELD_DELIVER, TYPE_SEARCHLIGHT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttackedByThisTurn
(int entityId) void
void
Mounted<?>
addBomb
(EquipmentType equipmentType, int loc) indicate whether this is a bomb mountprotected void
void
For clan units that get automatic Clan CASE, adds clan CASE in every location that has potentially explosive equipment (this includes uncharged PPC Capacitors).addConditionBonuses
(PilotingRollData roll, EntityMovementType moveType) Add in any modifiers due to global conditions like light/weather/etc.void
addCoolantFailureAmount
(int amount) This is implemented in subclasses, do nothing in generalboolean
addCritical
(int loc, int slot, CriticalSlot cs) Attempts to set the given slot to the given critical.boolean
addCritical
(int loc, CriticalSlot cs) Adds a critical to the first available slot in the location.boolean
addCritical
(int loc, CriticalSlot cs, int slotNumber) Adds a critical to a critical slot, first trying the supplied slot number, and continuing from there if it's fullabstract PilotingRollData
Add in any piloting skill modsMounted<?>
addEquipment
(EquipmentType equipmentType, int loc) Creates a new mount for this equipment and adds it in.Mounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted) Creates a new mount for this equipment and adds it in.Mounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted, int nAmmo) mounting weapons needs to take account of ammoMounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean dwpMounted) indicate whether this is body mounted for BAsMounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted) Creates a new mount for this equipment and adds it in.Mounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted) Mounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted) Mounted<?>
addEquipment
(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted, boolean isOmniPodded) void
addEquipment
(Mounted<?> mounted, int loc, boolean rearMounted) protected void
addEquipment
(Mounted<?> mounted, int loc, boolean rearMounted, boolean isWeaponGroup) protected void
addEquipment
(Mounted<?> mounted, int loc, boolean rearMounted, int nAmmo) void
void
addFiringSolution
(int targetId) Adds the specified target entity's ID to this entity's firingSolutionsvoid
addGroundAttackedByThisTurn
(int entityId) void
addIMPHits
(int missiles) void
void
addOffBoardObserver
(int teamID) Indicate that an off-board artillery attack by this entity has been observed by a particular teamvoid
void
Apply PSR modifier for difficult terrain in the current positionvoid
addPilotingModifierForTerrain
(PilotingRollData roll, Coords c, int boardId) Apply PSR modifier for difficult terrain at the specified coordinates.void
addPilotingModifierForTerrain
(PilotingRollData roll, Coords c, int boardId, boolean enteringRubble) Apply PSR modifier for difficult terrain at the specified coordinatesvoid
addPilotingModifierForTerrain
(PilotingRollData roll, MoveStep step) Apply PSR modifier for difficult terrain at the move step positionvoid
addSensorContact
(int targetId) Adds the specified target entity's ID to this entity's sensorContactsprotected void
Incorporate dates for components that are not in the equipment list, such as engines and structure.void
addTargetedBySwarm
(int entityId, int weaponId) Add a targeting by a swarm volley from a specified entityprotected void
addTechComponent
(ITechnology tech) void
addTowedUnit
(int id) Adds an entity to this tractor's trainvoid
addTransporter
(Transporter component) Add a transportation component to this Entity.void
addTransporter
(Transporter component, boolean isOmniPod) Add a transportation component to this Entity.void
addWeaponGroup
(EquipmentType equipmentType, int loc) boolean
Check for vulnerability to anti-TSM munitions.void
Applies any damage that the entity has suffered.protected int
applyGravityEffectsOnMP
(int MP) static String
armorStringFor
(int value) Parses the game's internal armor representation into a human-readable string.void
assignAMS
(List<WeaponHandler> attacks) Assign AMS systems to the most dangerous incoming missile attacks.void
assignTMAMS
(TeleMissileAttackAction telemissileAttack) Assign AMS systems to an incoming telemissile attack.protected void
assignWeaponQuirk
(QuirkEntry quirkEntry) void
attachINarcPod
(INarcPod pod) attach an iNarcPodvoid
attachNarcPod
(NarcPod pod) add a narc pod from this team to the Mek.abstract void
Sets the internal structure for every location to appropriate undamaged values for the unit and location.int
boolean
C3MasterIs
(Entity e) Determines if the passedEntity
is the C3 Master of this unit.int
calcElevation
(Hex current, Hex next) int
calcElevation
(Hex current, Hex next, int assumedElevation, boolean climb) Calculates the elevation of the entity in the next hex.final int
Calculates the Battle Value of this unit.final int
calculateBattleValue
(boolean ignoreC3, boolean ignoreSkill) Calculates the Battle Value of this unit.int
calculateBattleValue
(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport) Calculates the Battle Value of this unit.int
calculateBattleValue
(CalculationReport calculationReport) Calculates the Battle Value of this unit.int
Determine the remaining number of other C3 Master computers that can connect to thisEntity
.int
Determine the remaining number of other C3 computers that can connect to thisEntity
.boolean
Whether this entity can activate the "blood stalker" abilityboolean
boolean
Determines if an entity is eligible for a phase.boolean
canBrace()
abstract boolean
Can this entity change secondary facing at all?boolean
boolean
canDFA()
boolean
boolean
canFall()
Only applicable to Meks, but here for convenience.boolean
canFall
(boolean gyroLegDamage) Only applicable to Meks, but here for convenience.boolean
canFireWeapon
(int location) Whether a weapon in a given location can be fired, given the entity's currently carried cargofinal boolean
canFlee()
Returns true when this unit can flee from its current position.boolean
Returns true when this unit can flee from the given position.boolean
Returns true if the entity can flip its armsboolean
boolean
is it possible to go down, or are we landed/just above the water/treeline? assuming passed elevation.boolean
Method to determine if an entity is currently capable of going hull-down.boolean
is it possible to go up, or are we at maximum altitude? assuming passed elevation.boolean
boolean
Determines if this object can accept the given unit.boolean
Determines if this object can accept the given unit.boolean
boolean
Returns true if the entity can pick up ground objectsboolean
canRam()
boolean
canSpot()
Um, basically everything can spot for LRM indirect fire.boolean
canTow
(int trailerId) Determines if this vehicle is currently able to tow designated trailer.boolean
canTransferCriticals
(int loc) Returns true if this location should transfer criticals to the next location inwards.boolean
Returns true if the entity has an RAC which is jammed and not destroyed As of 5/22/2012 also returns true if there is a jammed and not destroyed Ultra AC and the unofficial options is enabled.boolean
Is the Entity stuck in a swamp?checkBogDown
(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, int lastElev, boolean isPavementStep) Checks if the entity is moving into a hex that might cause it to bog down.checkDislodgeSwarmers
(MoveStep step, EntityMovementType moveType) Checks if the entity is being swarmed.boolean
checkForMASCFailure
(MovePath md, Vector<Report> vDesc, HashMap<Integer, List<CriticalSlot>> vCriticalSlots) This function checks for masc failure.boolean
checkForSuperchargerFailure
(MovePath md, Vector<Report> vDesc, HashMap<Integer, List<CriticalSlot>> vCriticalSlots) This function checks for Supercharger failure.checkGetUp
(MoveStep step, EntityMovementType moveType) Checks if the entity is getting up.checkGunningIt
(EntityMovementType overallMoveType) Checks if the entity is attempting to increase two speed categories.checkLandingInHeavyWoods
(EntityMovementType overallMoveType, Hex curHex) Checks if an entity is landing (from a jump) in heavy woods.checkLandingOnBlackIce
(EntityMovementType overallMoveType, Hex curHex) Checks if the entity is landing (from a jump) on black ice.checkLandingOnIce
(EntityMovementType overallMoveType, Hex curHex) Checks if the entity is landing (from a jump) on ice-covered water.checkLandingWithDamage
(EntityMovementType overallMoveType) Checks if the entity is landing (from a jump) with damage that would force a PSR.checkLandingWithPrototypeJJ
(EntityMovementType overallMoveType) Checks if the entity is landing (from a jump) with a prototype JJ If so, returns the target roll for the piloting skill check.checkMovedTooFast
(MoveStep step, EntityMovementType moveType) int
checkMovementInBuilding
(MoveStep step, MoveStep prevStep, Coords curPos, Coords prevPos) Checks to see if an entity is moving through building walls.checkRecklessMove
(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, Hex prevHex) Checks if an entity is passing through certain terrain while not moving carefullycheckRubbleMove
(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, boolean isLastStep, boolean isPavementStep) Checks if the entity is moving into rubble.checkRunningWithDamage
(EntityMovementType overallMoveType) Checks if the entity is attempting to run with damage that would force a PSR.checkSideSlip
(EntityMovementType moveType, Hex prevHex, EntityMovementType overallMoveType, MoveStep prevStep, int prevFacing, int curFacing, Coords lastPos, Coords curPos, int distance, boolean speedBooster) checkSkid
(EntityMovementType moveType, Hex prevHex, EntityMovementType overallMoveType, MoveStep prevStep, MoveStep currStep, int prevFacing, int curFacing, Coords lastPos, Coords curPos, boolean isInfantry, int distance) Checks if the entity might skid.checkSprintingWithMASCAndSupercharger
(EntityMovementType overallMoveType, int used) Checks if the entity is attempting to sprint with MASC and supercharger engaged.checkSprintingWithMASCXorSupercharger
(EntityMovementType overallMoveType, int used) Checks if the entity is attempting to sprint with MASC or Supercharger engaged (but not both).checkTurnModeFailure
(EntityMovementType overallMoveType, int straightLineHexes, int mpUsed, Coords currPos) If using advanced vehicle ground movement, checks whether the unit is required to make a driving roll for turning, and if so whether it succeeds.void
checkUnstall
(Vector<Report> vPhaseReport) Check for uninstalling of this Entity's engine (only used for ICE-powered 'Meks).checkUsingOverdrive
(EntityMovementType overallMoveType) Checks if the entity is attempting to sprint with supercharger engaged.checkWaterMove
(int waterLevel, EntityMovementType overallMoveType) Checks if the entity is moving into depth 1+ water.checkWaterMove
(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, boolean isPavementStep) Checks if the entity is moving into depth 1+ water.int
chooseSide
(Coords attackPos, boolean usePrior) void
void
Clear all bombs and bomb attacksvoid
Iterates over all Narc and iNarc pods attached to this entity and removes those still 'stuck' to destroyed or missing locations.void
void
Empties this entity's firingSolutions Used when it dies or moves offboardvoid
This clears all Narc and iNarc Pods from an Entity.void
void
void
Empties this entity's sensorContacts Used when it dies or moves offboardboolean
Get the entity's "climbing mode"abstract int
clipSecondaryFacing
(int dir) Returns the closest valid secondary facing to the given direction.long
countEquipment
(String internalName) Returns the number of equipment of the given internal name that are mounted on this unit, regardless of their working condition.boolean
Returns true when the current (remaining) battle strength of this unit/object should be counted for a strength sum, e.g.int
Returns the number of MiscType equipment of the given internalName, regardless of state.int
int
count all the quirks for this unit, positive and negativeint
countQuirks
(String grpKey) count the quirks for this unit, for a given group nameint
int
countWorkingMisc
(String internalName, int location) int
return how many misc equipments with the specified flag the unit hasint
countWorkingMisc
(EquipmentFlag flag, int location) protected int
critStateCount
(int type, int index, int loc, Predicate<CriticalSlot> slotState) Damages a randomly determined bay door on the entity, if one existsint
Returns the number of destroyed jump jets.boolean
Damages a randomly determined docking collar on the entity, if one exists.void
damage the door of the first bay that can load this unitint
void
damageSystem
(int type, int slot, int hits) int
damageSystem
(int type, int slot, int loc, int hits) void
void
deployOffBoard
(int round) Deploy this offboard entity at the previously specified distance and direction.void
destroyLocation
(int loc) Marks all equipment in a location on this entity as destroyed.void
destroyLocation
(int loc, boolean blownOff) Marks all equipment in a location on this entity as destroyed.void
Method to destroy a single searchlight on an entity.void
destroyRetractableBlade
(int loc) destroys the first retractable blade critical slot foundvoid
disconnectUnit
(int id) Detaches an entity from this entity's towing mechanism also detaches all trailers behind this one from the whole trainprotected int
doBattleValueCalculation
(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport) Calculates and returns the Battle Value of this unit taking into account the parameters.doCheckEngineStallRoll
(Vector<Report> vPhaseReport) Possibly do a ICE-Engine stall PSR (only intended for Meks, both Industrial and Battle).boolean
boolean
boolean
boolean
boolean
void
dropGroundObject
(int location) Remove a ground object (cargo) from the given locationvoid
dropGroundObject
(ICarryable carryable, boolean isUnload) Remove a specific carried object - useful for when you have the object but not its location, or when an object is being carried in multiple locations.void
Convenience method to drop all cargo.int
elevationOccupied
(Hex hex) Returns the absolute elevation above ground level 0 that this entity would be on if it were placed into the specified hex.int
elevationOccupied
(Hex hex, int elevation) boolean
boolean
Helper function to determine if a entity is a quadboolean
Two entities are equal if their ids are equalvoid
extendBlade
(int loc) Set the retractable blade in the given location as extended Takes the first piece of appropriate equipmentfactionTechLevel
(ITechnology.Faction techFaction) Returns any known displacement attacks (should only be one) that this entity is a target of.int
boolean
defensively check and correct elevationPretty-prints the heat capacity of a unit, including optional heat sinking systems.protected final IGameOptions
Returns the GameOptions of this Entity's game if it has one.Returns the general name or type name of this unit/object.void
Generates the display name for this entity.void
Generate the short name for a unitA list of all active sub-entities.int
This counts the number of UMU's a Mek has that are still viableint
getActiveVibrobladeHeat
(int location) int
getActiveVibrobladeHeat
(int location, boolean ignoreMode) int
int
This returns all UMU a Mek has.boolean
double
int
getAmmo()
getAmmo
(int index) getAmmo
(WeaponMounted weapon) int
int
getArmor
(int loc) Returns the amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.int
getArmor
(int loc, boolean rear) Returns the amount of armor in the location specified, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.int
Returns the amount of armor in the location hit, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.static TechAdvancement
int
getArmorForReal
(int loc) int
getArmorForReal
(int loc, boolean rear) double
Returns the percent of the armor remaininggetArmorString
(int loc) Returns a string representing the armor in the locationgetArmorString
(int loc, boolean rear) Returns a string representing the armor in the locationint
getArmorTechLevel
(int loc) int
getArmorType
(int loc) double
The total weight of the armor on this unit.double
getArmorWeight
(int loc) Prior to TacOps errata 3.3, armor was rounded up to the nearest half ton As of TacOps errata 3.3, patchwork armor is not rounded by location.boolean
Returns true if the Mek's arms are flipped to the rearint
int
getBadCriticals
(int type, int index, int loc) The number of critical slots that are destroyed or breached in the location or missing along with it (if it was blown off).int
What's the range of the BAP equipment?int
getBARRating
(int loc) Return the BAR-rating of this Entity's armordouble
Used by omni support vehicles to track the weight of fire control systems.double
double
Returns an entity's base piloting skill roll needed Only use this version if the entity is through processing movementgetBasePilotingRoll
(EntityMovementType moveType) Returns an entity's base piloting skill roll neededgetBayByAmmo
(AmmoMounted ammoMounted) Returns the Bay that the given ammo is associated with.getBayById
(int bayNumber) int
Method that returns the mapping between locations which, if cargo is carried, block other locations from firing.int
int
int
int
Determines where to place equipment that does not require a specific location.getBombLoadout
(boolean internalOnly) getBombs()
getBombs
(EquipmentFlag flag) Returns a list of operable bombs with shots left and with the given flag (e.g.int
int
getC3iNextUUIDAsString
(int pos) Return the unit that is current master of this unit's C3 network.int
Get the ID of the master unit in this unit's C3 network.getC3Top()
getCamouflageOrElse
(Camouflage camouflage) getCamouflageOrElse
(Camouflage camouflage, boolean checkForces) int
getCargoMpReduction
(Entity carrier) getCarriedObject
(int location) Get the object carried in the given location.getClubs()
getCollarById
(int collarNumber) Returns the DockingCollar with the given ID or null if this unit doesn't have such a Docking Collar.int
int
abstract TechAdvancement
return - the base construction option tech advancementint
int
final double
getCost
(boolean ignoreAmmo) Calculates and returns the C-bill cost of the unit.abstract double
getCost
(CalculationReport calcReport, boolean ignoreAmmo) Calculates and returns the C-bill cost of the unit.getCrew()
getCritical
(int loc, int slot) Returns a critical hit slotgetCriticalSlots
(int location) Returns the CriticalSlots in the given location as a list.int
getCustomWeaponOrder
(WeaponMounted weapon) int
getDamagedCriticals
(int type, int index, int loc) Number of slots damaged (but not breached) in a locationint
Returns the entity's current damage level.int
getDamageLevel
(boolean checkCrew) Returns the entity's current damage level.int
getDamageReductionFromModularArmor
(HitData hit, int damage, Vector<Report> vDesc) A list of the "default" cargo pick up locations for when none is specifiedint
getDependentLocation
(int loc) Gets the location that is destroyed recursively.int
The round the unit will be deployedReturns the display name for this entity.Returns a list of all Docking Collars (Hard points) of this unit.int
getDocks()
int
getDocks
(boolean forCost) int
Gets the marker used to disambiguate this entity from others with the same name.int
double
int
What's the range of the ECM equipment? Infantry can have ECM that just covers their own hex.double
int
Returns the elevation of this target, relative to the position Hex's surfaceint
getEmptyCriticals
(int loc) Returns the number of empty critical slots in a locationint
abstract int
int
static String
getEntityMajorTypeName
(long typeId) Given an Entity type, return the name of the major class it belongs to (eg: Mek, Aero, Tank, Infantry).abstract long
static String
getEntityTypeName
(long typeId) Returns the specific entity type name for the given type id (eg: Biped Mek, Conventional Fighter, VTOL).Returns an enumeration of all equipmentMounted<?>
getEquipment
(int index) Returns the equipment, specified by numberprotected Mounted<?>
getEquipmentForWeaponQuirk
(QuirkEntry quirkEntry) Returns the Mounted that is referred to by the quirkEntry (which must be a weapon quirk).int
getEquipmentNum
(Mounted<?> mounted) Returns the equipment number of the specified equipment, or -1 if equipment is not present.int
getExteriorUnitAt
(int loc, boolean isRear) If a unit is being transported on the outside of the transporter, it can suffer damage when the transporter is hit by an attack.int
This returns the external ID.int
int
getExtinctionDate
(boolean clan, ITechnology.Faction faction) int
getExtraC3BV
(int baseBV) int
int
int
Returns the primary facing, or -1 if n/agetFacingName
(int facing) Returns an enumeration which contains the name of each piece of equipment that failed to load.Retrieves the IDs of all entities that this entity has established firing solutions ongetFluff()
Returns the fluff for this entity.Returns a fluff image for this unit or object to be shown e.g.int
Returns a String representation of the force hierarchy this entity belongs to.int
Returns the forward firing arc for this entity - overrided by some unitsint
int
getGame()
This returns the game this Entity belongs to.boolean
abstract int
Calculates a "generic" Battle Value that is based on the average of all units of this type and tonnage.int
int
int
getGoodCriticals
(int type, int index, int loc) Returns the number of operational critical slots of the specified type in the locationint
int
int
Only Meks have Gyros but this helps keep the code a bit cleaner.return the heading of the unit based on its active vectors if vectors are tied then return two headingsint
getHeat()
int
Returns the amount of heat that the entity can sink each turn.int
getHeatCapacity
(boolean radicalHeatSink) int
int
Returns the modifier to weapons fire due to heat.int
getHeatInArc
(int location, boolean rearMount) int
int
Returns the height of the target, that is, how many levels above its elevation it is for LOS purposes.getHitchCarrying
(int id) Finds the trailer hitch transporter that is carrying a given entityId Hitches move around in Transports on loading a saved gameint
getHitCriticals
(int type, int index, int loc) Number of slots doomed, missing or destroyed in a locationint
getHittableCriticals
(int loc) Returns the number of operational critical slots remaining in a locationint
getIcon()
Returns an icon for this unit or object for the game board.int
getId()
Returns this InGameObject's id.Get anEnumeration
ofINarcPod
s that are attached to this entity.int
Gets the initial BV of a unit.int
getInternal
(int loc) Returns the amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.int
getInternal
(HitData hit) Returns the amount of internal structure in the location hit.int
getInternalForReal
(int loc) double
Returns the percent of the armor remaininggetInternalString
(int loc) Returns a string representing the internal structure in the locationint
int
getIntroductionDate
(boolean clan, ITechnology.Faction faction) boolean
int
getJumpHeat
(int movedMP) get the heat generated by this Entity when jumping for a certain amount of MPint
Returns this entity's current jump jet jumping MP, not affected by terrain, factored for gravity.int
getJumpMP
(MPCalculationSetting mpCalculationSetting) int
Returns this entity's current jumping MP, affected by terrain (like water.)int
int
int
getKills()
double
int
int
Returns a list of DropShips launchable from any of the Transport facilities of this unit.Get aList
of the trailers currently loaded into this payload.Get aList
of the units currently loaded into this payload.getLocationAbbr
(int loc) Returns the abbreviated name of the location specified.getLocationAbbr
(HitData hit) Returns the abbreviated name of the location specified.abstract String[]
abstract String
getLocationDamage
(int loc) int
getLocationFromAbbr
(String abbr) Returns the location that the specified abbreviation indicatesgetLocationName
(int loc) Returns the name of the location specified.getLocationName
(HitData hit) Returns the name of the location specified.abstract String[]
int
getLocationStatus
(int loc) returns exposure or breached flag for locationint
int
int
getMASC()
int
int
Get the number of turns MASC has been used continuously.abstract int
The maximum elevation change the entity can crossint
by default, entities can move as far down as they can move upint
getMaxElevationDown
(int currElevation) Returns the maximum number of downward elevation changes a unit can make.int
The max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range.int
getMaxWeaponRange
(boolean targetIsAirborne) The max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range, and whether the target is airborne.int
int
getMechanicalJumpBoosterMP
(MPCalculationSetting mpCalculationSetting) int
getMisc()
getMisc
(int index) static TechAdvancement
getModel()
Returns the unit code for this entity.int
getMotiveSideMod
(int side) The attack direction modifier for rolls on the motive system hits table for the given side (as defined inToHitData
).boolean
abstract String
Returns the abbreviation of the name of the type of movement used.int
getMovementBeforeSkidPSRModifier
(int distance) Calculate the piloting skill roll modifier, based upon the number of hexes moved this phase.Get the movement mode of the entityGet the movement mode of the entity as a String.abstract String
Returns the name of the type of movement used.getMPBoosters
(boolean onlyArmed) int
int
getMulId()
Returns this entity's MUL ID linking it to a unit on the online Master Unit List.getNC3NextUUIDAsString
(int pos) int
getNCrew()
int
protected abstract int[]
int
int
getNumberOfCriticals
(int loc) Returns the number of total critical slots in a locationint
getNumberOfCriticals
(int type, int index, int loc) Returns the number of critical slots present in the section, destroyed or not.int
getNumberOfCriticals
(EquipmentType equipmentType) Returns the number of critical slots present in the Mek, destroyed or not.int
getNumberOfCriticals
(EquipmentType equipmentType, int loc) Returns the number of critical slots present in the section, destroyed or not.int
getNumberOfShields
(long size) Check to see how many shields of a certain size a mek has.int
getOArmor
(int loc) Returns the original amount of armor in the location specified.int
getOArmor
(int loc, boolean rear) Returns the original amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.int
Returns the original amount of armor in the location hit.Returns the direction off the board that the unit will be deployed.int
Get the distance in hexes from the board that the unit will be deployed.int
getOInternal
(int loc) Returns the original amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.int
getOInternal
(HitData hit) Returns the original amount of internal structure in the location hit.static TechAdvancement
static TechAdvancement
int
Units with construction data that varies by year (such as engine and control system weight for some primitive aerospace units) require tracking the original build year separately from the intro year for the model to account for refits that don't affect the core components.int
Returns this entity's original jumping mp.int
getOriginalJumpMP
(boolean ignoreModularArmor) int
int
Returns this entity's original walking movement pointsgetOwner()
Returns the player that "owns" this entity.int
Returns the unique id of this InGameObject's owning player.int
static TechAdvancement
getPlayerPickedPassThrough
(int attackerId) double
double
Computes and returns the power amplifier weight for this entity, if any.double
Returns a multiplier that combines multiplicative construction cost modifiers for this Entity.int
int
getProductionDate
(boolean clan, ITechnology.Faction faction) int
int
getPrototypeDate
(boolean clan, ITechnology.Faction faction) int
getQuirkList
(String sep) Returns a string of all the quirk "codes" for this entity, using sep as the separatorRetrieves the quirks object for entity.int
Returns the rear firing arc for this entity - overrided by some unitsint
int
int
getReintroductionDate
(boolean clan, ITechnology.Faction faction) int
Getter for property removalCondition.getRole()
int
get the heat generated by this Entity when running/flankingint
getRunMP()
int
getRunMP
(MPCalculationSetting mpCalculationSetting) Returns this entity's running/flank mp as a string.getRunMPasString
(boolean gameState) Returns this entity's running/flank mp as a string.int
Returns run MP without considering any MASC systemsint
get the gravity limit for ground movementboolean
int
Returns the secondary facing, or -1 if n/aboolean
boolean
boolean
int
Retrieves the IDs of all entities that this entity has detected with sensorsA short name, suitable for displaying above a unit icon.int
int
int
get the heat generated by this Entity when sprintingint
Returns this entity's sprinting MP, modified for all its current circumstances such as gravity and damage.int
getSprintMP
(MPCalculationSetting mpCalculationSetting) Returns this entity's sprinting MP, modified according to the given setting.int
Returns sprint MP without considering MASCint
Returns sprint MP without considering MASCint
Used to determine the draw priority of different Entity subclasses.int
get the heat generated by this Entity when standing stillint
int
getStartingAnyNWx
(boolean inheritFromOwner) int
int
getStartingAnyNWy
(boolean inheritFromOwner) int
int
getStartingAnySEx
(boolean inheritFromOwner) int
int
getStartingAnySEy
(boolean inheritFromOwner) int
int
getStartingOffset
(boolean inheritFromOwner) int
int
getStartingPos
(boolean inheritFromOwner) int
int
getStartingWidth
(boolean inheritFromOwner) For non-era-based usage, provide a single tech level that does not vary with date.getStealthModifier
(int range, Entity ae) Determine the stealth modifier for firing at this unit from the given range.int
Returns the current (remaining) battle strength of this unit or object.int
int
This method (and getActiveSubEntities()) is meant for groups of entities handled as a singular one.int
int
Get the number of turns Supercharger has been used continuously.int
Get the ID of theEntity
that is attacking this unit with a swarm attack.int
Get the ID of theEntity
that is the current target of a swarm attack by this unit.int
int
boolean
getTargetedBySwarm
(int entityId, int weaponId) Were we targeted by a certain swarm/swarm-i volley this turn?int
int
int
boolean
int
int
int
Returns the unit tech for this entity.int
Entities that use different sprites for different modes should override thisint
int
Returns the total amount of armor on the entity.abstract int
int
Returns the total amount of internal structure on the entity.int
getTotalMunitionsOfType
(WeaponMounted weapon) Determine how much ammunition (of all munition types) remains which is compatible with the given weapon.int
Returns the total amount of armor on the entity.int
Returns the total original amount of internal structure on the entity.int
int
int
int
int
getTransferLocation
(int loc) int versionabstract HitData
Gets the location that excess damage transfers to.int
Get the IDEntity
that has loaded this one.double
getTrooperAtLocation
(HitData hit, Entity transport) int
int
short
Get the unit number of this entity.abstract int
double
double
Returns the current amount of cargo space for an entity of the given type.Return a string that identifies the unused capacity of this transporter.getUnusedString
(ViewFormatting formatting) Return a string that identifies the unused capacity of this transporter.boolean
A list of all the locations that the entity can use to pick up cargo following the TacOps "one handed" pickup rulesint
getVector
(int vectorFacing) int[]
int
int
Return how many BA vibroclaws thisEntity
is equipped withint
get the heat generated by this Entity when walking/cruisingint
int
getWalkMP
(MPCalculationSetting mpCalculationSetting) getWeapon
(int index) abstract int
getWeaponArc
(int weaponNumber) Returns the Rules.ARC that the weapon, specified by number, fires into.double
int
int
getYear()
boolean
hasAbility
(String name) determine if an entity has an ability that is identified by its presence or absence only.boolean
hasAbility
(String name, String choice) determine if an entity has an ability at a given level.boolean
boolean
Checks to see if this unit has a functional Blue Shield Particle Field Damper that is turned onboolean
Checks to see if this entity has a functional ECM unit that is using ECCM.boolean
Does the Mek have a functioning ECM unit?boolean
hasActiveECM
(boolean stealth) check if we have an active ECM unit for stealth armor purposesboolean
boolean
boolean
hasActiveShield
(int location) Does the Mek have an active shield This should only be called by hasActiveShield(location, rear)boolean
hasActiveShield
(int location, boolean rear) Does the Mek have an active shield This should only be called after hasShield has been called.boolean
Returns whether or not this entity has a Targeting Computer that is in aimed shot mode.boolean
Returns true if the unit has a standard C3M/S, a Naval C3 or C3i or a Nova CEWS.boolean
Returns true if any Narc or iNarc pods are attached to this unit.boolean
hasArcFired
(int location, boolean rearMount) boolean
boolean
boolean
hasBAP()
Does the Mek have a functioning BAP? This is just for the basic BAP for Beagle BloodHound WatchDog Clan Active or Light.boolean
hasBAP
(boolean checkECM) boolean
hasBARArmor
(int loc) boolean
boolean
boolean
boolean
hasC3()
boolean
hasC3i()
boolean
hasC3M()
Checks if the entity has a C3 Master.boolean
hasC3MM()
boolean
hasC3S()
boolean
hasCase()
Returns whether there is CASE anywhere on thisEntity
.boolean
True if the unit has CASE II (on any location in the case of Meks).boolean
hasCASEII
(int location) True if the unit has CASE II in the given location.boolean
Units with a cockpit command console provide an initiative bonus to their side, provided that the commander is not currently functioning as pilot, the unit has advanced fire control, and the unit is heavy or assault weight class.boolean
boolean
boolean
boolean
Returns whether this entity has a Drone Operating Systemboolean
hasECM()
boolean
boolean
Returns true when this unit has an embedded icon, i.e.boolean
boolean
boolean
hasETypeFlag
(long flag) Convenience method that checks whether a bit is set in the entity type field.boolean
boolean
boolean
boolean
hasFiringSolutionFor
(int targetId) Checks the firingSolutions set for a specific target's ID numberboolean
boolean
boolean
hasFunctionalArmAES
(int location) boolean
boolean
hasGhostTargets
(boolean active) Does the Mek have a functioning ECM unit, tuned to ghost target generation?boolean
boolean
hasHarJelIn
(int location) Does this entity have an undamaged HarJel system in this location? (Type-dependent, defaults to false.) Does not include Harjel II or Harjel III, as they do not prevent breach checks like Harjel does.int
hashCode()
boolean
Checks if the unit has a hierarchic C3 system.boolean
Returns true if the entity has a hip critical slot.boolean
Returns true if any iNarc pods are attached to this unit.boolean
Scans through the ammo on the unit for any inferno rounds.boolean
Returns true if the entity has a leg actuator critical slotboolean
hasLinkedMGA
(WeaponMounted mounted) boolean
Returns true when the entity has a MiscType equipment of the given internalName, regardless of its state.boolean
Returns true when the entity has a MiscType equipment of the given internalName, regardless of its state, in the given location.boolean
hasMisc
(EquipmentFlag flag) Returns true when the entity has a MiscType equipment with the given MiscTypeFlag, regardless of its state.boolean
boolean
hasModularArmor
(int loc) boolean
hasMulId()
Returns true when this entity has a useful MUL ID, meaning it is a unit from an official source and can be linked to a unit on the online Master Unit List.boolean
Returns true if any Narc pods are attached to this unit.boolean
boolean
hasNhC3()
Returns true if the unit has a non hierarchic C3 system (C3i, NC3 or Nova CEWS).boolean
hasNoDefenseShield
(int location) Does the Mek have an shield in no defense modeboolean
boolean
boolean
hasPassiveShield
(int location) Does the Mek have a passive shield This should only be called by hasPassiveShield(location, rear)boolean
hasPassiveShield
(int location, boolean rear) Does the Mek have a passive shield This should only be called after hasShield has been called.boolean
boolean
boolean
hasRearArmor
(int loc) Does this location have rear armor?boolean
hasSCM()
boolean
boolean
Returns true if the given player can see this Entity, including teammates if team_vision is on.boolean
hasSensorContactFor
(int targetId) Checks the sensorContacts set for a specific target's ID numberboolean
Does the Mek have any shields.boolean
boolean
hasSystem
(int system, int loc) boolean
hasTAG()
boolean
Returns whether or not this entity has a Targeting Computer.boolean
hasUMU()
This method checks to see if a unit has Underwater Maneuvering Unitsboolean
boolean
protected boolean
boolean
boolean
hasWorkingMisc
(String name) Check if the entity has an arbitrary type of misc equipmentboolean
hasWorkingMisc
(EquipmentFlag flag) Check if the entity has an arbitrary type of misc equipmentboolean
hasWorkingMisc
(EquipmentFlag flag, long secondary) Check if the entity has an arbitrary type of misc equipmentboolean
hasWorkingMisc
(EquipmentFlag flag, long secondary, int location) Check if the entity has an arbitrary type of misc equipmentboolean
boolean
hasWorkingSystem
(int system, int loc) Returns true if there is at least 1 functional system of the type specified in the locationint
height()
Returns the height of the unit, that is, how many levels above its elevation it is for LOS purposes.void
hitAllCriticals
(int loc, int slot) Hits all critical slots of the system occupying the specified critical slot.int
Used to for cost calculations.protected void
void
initializeArmor
(int val, int loc) Initializes the armor on the unit.void
initializeInternal
(int val, int loc) Initializes the internal structure on the unit.protected void
protected void
Sets initial TechAdvancement without equipment based on construction options.boolean
isActive()
Determine if this entity participate in the current game phase.boolean
isActive
(int turn) protected boolean
isActiveOption
(String optionName) Returns true when this Entity's game is not null and the given boolean game option is active in the game.boolean
Convenience method to determine whether this entity should be treated as a landed aero on a ground map.boolean
A method to determine if an aero has suffered 3 sensor hits.boolean
boolean
Convenience method to determine whether this entity should be treated as an airborne aero on a ground map.boolean
boolean
boolean
boolean
boolean
isBoardProhibited
(Board board) boolean
isBoardProhibited
(BoardType boardType) boolean
boolean
boolean
boolean
boolean
isCanon()
boolean
boolean
isCapitalFighter
(boolean lounge) boolean
boolean
Has this entity been captured?boolean
Is this unit a carcass, a carcass can take no actionboolean
boolean
boolean
Determine if this unit has an active chameleon light polarization field.boolean
Determine if this unit has an active chameleon light polarization field.boolean
boolean
isClan()
Checks if this is a clan unit.boolean
isClanArmor
(int loc) boolean
boolean
boolean
abstract boolean
Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.abstract boolean
isCrippled
(boolean checkCrew) Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.boolean
Checks to see if an entity has been deployedboolean
boolean
boolean
abstract boolean
Returns TRUE if the entity has been heavily damaged.abstract boolean
Returns TRUE if the entity has been lightly damaged.abstract boolean
Returns TRUE if the entity has been moderately damaged.boolean
isDone()
boolean
isDoomed()
boolean
boolean
boolean
isElevationValid
(int assumedElevation, Hex hex) Check if this entity can legally occupy the requested elevation.boolean
isEligibleFor
(GamePhase phase) Determines if an entity is eligible for a phase.boolean
boolean
An entity is eligible for firing if it's not taking some kind of action that prevents it from firing, such as a full-round physical attack or sprinting.boolean
Pretty much anybody's eligible for movement.boolean
boolean
Tanks and certain other units can get a +1 bonus to MP if their move is entirely on pavement.boolean
Check if the entity has any valid targets for physical attacks.boolean
boolean
Returns true if the other entity is an enemy of this entity.boolean
boolean
boolean
boolean
boolean
boolean
boolean
Only Meks have gyros, but this helps keep the code a bit cleaner.boolean
do we have a half-hit hardened armor point in the location struck by this?boolean
isHidden()
Returns true if this unit is currently hidden (hidden units, TW pg 259).boolean
boolean
boolean
Is this entity shut down or is the crew unconscious?boolean
isImmobile
(boolean checkCrew) Is this entity shut down, or if applicable is the crew unconscious?boolean
boolean
isINarcedBy
(int nTeamID) Have we been iNarced with a homing pod from that team?boolean
isINarcedWith
(long type) Have we been iNarced with the named pod from any team?boolean
boolean
boolean
boolean
is this entity a large craft? (dropship, jumpship, warship, or space station, see TW p.20)boolean
boolean
Returns true if this entity could potentially be loaded (did not move from starting hex)boolean
isLocationBad
(int loc) Is this location destroyed or breached?boolean
isLocationBlownOff
(int loc) boolean
isLocationBlownOffThisPhase
(int loc) Has the indicated location been blown off this phase (as opposed to either earlier or not at all)?boolean
boolean
isLocationDeadly
(Coords c, int boardId) Returns true if the specified hex exists and has terrain that is deadly to this unit.boolean
isLocationDoomed
(int loc) Is this location destroyed or breached?final boolean
isLocationProhibited
(BoardLocation boardLocation) Returns true when the given location cannot legally be entered or deployed into by this unit at its present elevation or altitude.final boolean
isLocationProhibited
(BoardLocation boardLocation, int testElevation) Returns true when the given location cannot legally be entered or deployed into by this unit at the given elevation or altitude.final boolean
Returns true if the specified hex contains some sort of prohibited terrain.final boolean
isLocationProhibited
(Coords c, int currElevation) boolean
isLocationProhibited
(Coords testPosition, int testBoardId, int testElevation) Returns true when the given location cannot legally be entered or deployed into by this unit at the given elevation or altitude.boolean
isLocationTrulyDestroyed
(int loc) boolean
boolean
boolean
boolean
Determine if MASC has been used this turn.boolean
returns whether the unit is a military unit (as opposed to a civilian unit).boolean
boolean
isNarcedBy
(int nTeamID) has the team attached a narc pod to me?boolean
isNaval()
Is this a naval vessel?boolean
Determines if the pilot has the Nightwalker SPAfinal boolean
isNOE()
abstract boolean
Checks if the unit is hardened against nuclear strikes.boolean
Determine if this unit has an active null-signature system.boolean
Determine if this unit has an active null-signature system.boolean
boolean
isOffBoardObserved
(int teamID) Has the given team observed an off-board artillery attack by this entity?boolean
isOmni()
boolean
Convenience method to determine whether this entity is on a ground map with an atmosphereboolean
is this entity loaded into a fighter squadron?boolean
isPermanentlyImmobilized
(boolean checkCrew) This method returns true if a unit is permanently immobilized either because its crew is dead/gone or because of damageboolean
boolean
boolean
boolean
isProne()
boolean
boolean
boolean
boolean
Determine if the unit can be repaired, or only harvested for spares.boolean
Determine if the unit is just combat-lossed or if it has been utterly destroyed.abstract boolean
isSecondaryArcWeapon
(int weaponId) Returns true if this weapon fires into the secondary facing arc.boolean
Returns true if this entity is selectable for action.boolean
isSensorReturn
(Player spotter) Returns whether this Entity is a sensor return to the given player.boolean
boolean
boolean
Returns true when this unit is currently on a space board, either close to a planet ("high altitude") or in deep space but only if its position is valid, i.e.boolean
boolean
Is this Entity's ICE Engine stalled?boolean
boolean
Determine if this unit has an active and working stealth system.boolean
Determine if this unit has an active and working stealth system.boolean
isStuck()
Is the Entity stuck in a swamp?boolean
boolean
Determine if Supercharger has been used this turn.boolean
boolean
is this a naval vessel on the surface of the water?boolean
Returns true if this entity is targetable for attacks.boolean
Returns true if any other entities this entity knows of are making a displacement attack on this entity.boolean
Used to determine if this vehicle can be the engine/tractor for a bunch of trailersboolean
Used to determine if this vehicle can be towed by a tractorboolean
boolean
Are we trapped inside of a destroyed transport? If so we shouldn't count for BV, which is why we have this check.boolean
boolean
boolean
Determine if thisEntity
was unloaded previously this turn.boolean
boolean
boolean
abstract boolean
isValidSecondaryFacing
(int dir) Can this entity torso/turret twist the given direction?boolean
boolean
Determine if this unit has an active void signature system that is providing its benefits.boolean
Determine if this unit has an active void signature system.boolean
isWeaponBlockedAt
(int loc, boolean isRear) Determine if transported units prevent a weapon in the given location from firing.boolean
isWeaponBlockedByTowing
(int loc, int secondaryFacing, boolean isRear) Determine if a connected tractor/trailer prevents a weapon in the given location from firing.boolean
isWeaponValidForPhase
(WeaponMounted mounted) Returns true if the given weapon is valid for the current phase.boolean
boolean
joinLocationAbbr
(List<Integer> locations, int limit) Joins the abbreviations for the locations into a String with / as the separator.void
Load the given unit, checking if the elevation of both units is the same.void
Load the given unit.void
Load the given unit.void
Load the given unit.void
Attempts to load all weapons with ammovoid
boolean
Do units loaded onto this entity still have active ECM/ECCM/etc.?void
loadQuirks
(List<QuirkEntry> quirks) void
loadWeapon
(WeaponMounted mounted) Tries to load the specified weapon with the first available ammoboolean
loadWeapon
(WeaponMounted mounted, AmmoMounted mountedAmmo) Tries to load the specified weapon with the specified ammo.void
loadWeaponWithSameAmmo
(WeaponMounted mounted) Tries to load the specified weapon with the first available ammo of the same munition type as currently in use.boolean
loadWeaponWithSameAmmo
(WeaponMounted mounted, AmmoMounted mountedAmmo) Tries to load the specified weapon with the specified ammo.boolean
locationHasCase
(int loc) Returns whether there is CASE protecting the location.boolean
locationIsLeg
(int loc) abstract int
Returns the number of locations in the entityboolean
double
The maximum tonnage of ground objects that can be picked up by this unitint
boolean
Returns true is the entity needs a roll to stand upvoid
void
newRound
(int roundNumber) Start a new roundvoid
Switches the C3 network Id to the new network ID.nextConversionMode
(EntityMovementMode afterMode) Entities that can convert movement modes (LAMs, QuadVees) report the next mode to assume when a convert movement command is processed.boolean
boolean
onSameC3NetworkAs
(Entity e, boolean ignoreECM) Checks if another entity is on the same c3 network as this entityboolean
passedOver
(Targetable target) Returns true if this Entity passed over the given target during its current path.boolean
What coords were passed through previous to the given oneboolean
passedWithin
(Coords c, int dist) Did the entity pass within a certain number of hexes of these coords?void
void
void
pickUp
(MekWarrior mw) void
pickupGroundObject
(ICarryable carryable, Integer location) Put a ground object into the given locationvoid
Utility function that handles situations where a facing change imparts some kind of permanent effect to the entity.void
Resets techAdvancement to initial value and adjusts for all installed equipment.void
Recover the given unit.void
int
Returns the elevation of the entity's highest point relative to the surface of the hex the entity is in, i.e.void
Attempts to reload any empty weapons with the first ammo foundvoid
Remove all attached iNarc Podsvoid
Remove all transportation components from this Entity.void
removeCriticals
(int loc, CriticalSlot cs) Removes all matching critical slots from the locationvoid
removeFiringSolution
(Collection<Integer> targetIds) Removes the specified target entity's ID from this entity's firingSolutionsboolean
removeINarcPod
(INarcPod pod) Remove anINarcPod
from this entity.void
removeMisc
(String toRemove) Removes the first misc eq.boolean
removePartialCoverHits
(int location, int cover, int side) void
removeSensorContact
(Collection<Integer> targetIds) Removes the specified target entity's ID from this entity's sensorContactsvoid
removeTowedUnit
(int id) Removes an entity from this tractor's trainvoid
void
do any damage to bay doorsvoid
protected void
Reset bomb attacks according to what bombs are available.void
This is implemented in subclasses, do nothing in generalvoid
void
clear out all troops listed in the transporter.void
restore()
Restores the entity after serializationabstract HitData
rollHitLocation
(int table, int side) Rolls up a hit locationabstract HitData
rollHitLocation
(int table, int side, int aimedLocation, AimingMode aimingMode, int cover) Rolls the to-hit numberrollMovementInBuilding
(Building bldg, int distance, String why, EntityMovementType overallMoveType) Calculates and returns the roll for an entity moving in buildings.protected int
scmCritStateCount
(Predicate<CriticalSlot> slotState) void
setAlreadyTwisted
(boolean value) Used by TargetingPhaseDisplay.java and FiringDisplay.javavoid
setAltitude
(int a) void
setArcFired
(int location, boolean rearMount) void
setArmor
(int val, int loc) Sets the amount of armor in the front location specified.void
setArmor
(int val, int loc, boolean rear) Sets the amount of armor in the location specified.void
Sets the amount of armor in the location specified.void
setArmorTechLevel
(int newTL) void
setArmorTechLevel
(int newTL, int loc) void
setArmorTechRating
(int armorTechRating) void
setArmorTechRating
(ITechnology.TechRating armorTechRating) void
setArmorTonnage
(double ton) void
setArmorType
(int armType) void
setArmorType
(int armType, int loc) void
setArmorType
(String armType) void
setArmorType
(String armType, int loc) void
setArmsFlipped
(boolean armsFlipped) Set whether or not the Mek's arms are flipped to the rearvoid
setArmsFlipped
(boolean armsFlipped, boolean fireEvent) Set whether or not the Mek's arms are flipped to the rear.void
setASEWAffected
(int turns) Sets the number of rounds that the entity is affected by an ASEW missilevoid
setAssaultDropInProgress
(boolean flag) void
setBARRating
(int rating) Sets the barrier armor rating for support vehicles.void
setBARRating
(int rating, int loc) Sets the barrier armor rating in a specific location for support vehicles.void
setBaseChassisFireConWeight
(double weight) Used by omni support vehicles to set the weight of fixed fire control systems in the base chassis.void
setBATaserShutdown
(boolean value) void
setBloodStalkerTarget
(int value) void
setBoardId
(int boardId) void
setBoobyTrapInitiated
(boolean boobyTrapInitiated) void
setBraceLocation
(int location) void
setC3iNextUUIDAsString
(int pos, String c3id) void
setC3Master
(int entityId, boolean reset) void
setC3Master
(Entity e, boolean reset) Set anotherEntity
as C3 Master.void
void
setC3NetId
(String c3NetId) Explicitly set the C3 Net ID using a string.void
setC3NetId
(Entity e) void
void
void
setC3UUIDAsString
(String c3id) void
setCamouflage
(Camouflage camouflage) void
setCanon
(boolean canon) void
setCanUnstickByJumping
(boolean arg) Set whether this Entity is stuck in a swamp or notvoid
setCaptured
(boolean arg) Specify that this entity has been captured.void
setCarcass
(boolean carcass) Sets if this unit is a carcass.void
setCarefulStand
(boolean stand) void
setCarriedObjects
(Map<Integer, ICarryable> value) TODO HHW - Psivoid
setChassis
(String chassis) sets the chassis name for this entity.void
setClanChassisName
(String name) Sets theclanChassisName
for this unit, e.g.void
setClearingMinefield
(boolean clearingMinefield) void
setClimbMode
(boolean state) void
setCommander
(boolean arg) void
setConsecutiveRHSUses
(int consecutiveRHSUses) void
setConversionMode
(int mode) Sets the unit to be in the given mode.void
setConvertingNow
(boolean converting) void
void
setCritical
(int loc, int slot, CriticalSlot cs) Sets a critical hit slotvoid
setCustomWeaponOrder
(Map<Integer, Integer> customWeaponOrder) void
setCustomWeaponOrder
(WeaponMounted weapon, int order) void
setDeployed
(boolean deployed) Toggles if an entity has been deployedvoid
setDeployRound
(int deployRound) The round the unit will be deployed.void
setDesignValid
(boolean designValid) void
setDestroyed
(boolean destroyed) void
setDetectedByEnemy
(boolean b) void
setDisplacementAttack
(DisplacementAttackAction displacementAttack) protected void
setDisplayName
(String displayName) Sets the display name for this entity.void
setDone
(boolean done) void
setDoomed
(boolean doomed) void
setDuplicateMarker
(int duplicateMarker) Sets the marker used to disambiguate this entity from others with the same name.void
setElevation
(int elevation) Sets the current elevation of this entity above the ground.void
setEMI
(boolean inVal) void
void
setEngineTechRating
(int engineTechRating) void
setEngineTechRating
(ITechnology.TechRating engineTechRating) void
setEvading
(boolean evasion) void
setEverSeenByEnemy
(boolean b) void
setExternalId
(int id) void
setExternalIdAsString
(String externalId) This sets the external ID.void
setExternalSearchlight
(boolean arg) void
setFacing
(int facing) Sets the primary facing.void
setFallen
(boolean fell) Sets if the unit has fallen in the current phase.void
setFindingClub
(boolean findingClub) void
setFiredTsempThisTurn
(boolean firedTsempThisTurn) void
setFleeZone
(HexArea fleeZone) Sets the board area this unit may flee from.void
setForceId
(int newId) Sets the unique id of the force this ForceAssignable belongs to.void
Sets the force string, seeForceAssignable.getForceString()
.void
This sets the game the entity belongs to.void
void
setGrappled
(int id, boolean attacker) void
setGrappledThisRound
(boolean grappled) void
setGrappleSide
(int side) void
setHardenedArmorDamaged
(HitData hit, boolean damaged) void
setHasDamagedRHS
(boolean hasDamagedRHS) void
setHasFiredTsemp
(boolean hasFiredTSEMP) void
setHidden
(boolean inVal) Set the hidden state of this entity (used for hidden units rules, TW pg 259).void
void
setHullDown
(boolean down) void
Sets the embedded icon for this unit to the given base64 string.void
setId
(int id) Sets the ID number of this Entity, which will also set the display name and short name to null.void
void
setIlluminated
(boolean arg) void
setInitialBV
(int bv) Sets the initial BV for a unit.void
setInternal
(int val, int loc) Sets the amount of armor in the location specified.void
setInternal
(int val, HitData hit) Sets the amount of armor in the location specified.void
setInvalidSourceBuildReasons
(List<Entity.InvalidSourceBuildReason> invalidSourceBuildReasons) void
setIsJumpingNow
(boolean jumped) void
setJumpingWithMechanicalBoosters
(boolean jumpingWithMechanicalBoosters) void
void
setLastTarget
(int id) void
void
setLayingMines
(boolean laying) void
void
setLoadedThisTurn
(boolean loaded) void
setLocationBlownOff
(int loc, boolean damaged) void
setLocationBlownOffThisPhase
(int loc, boolean damaged) Marks the location as blown off in the current phase.void
setLocationStatus
(int loc, int status) sets location exposurevoid
setLocationStatus
(int loc, int status, boolean allowChange) sets location exposurevoid
setMadePointblankShot
(boolean inVal) void
setManualBV
(int bv) void
setManualShutdown
(boolean tf) void
setMASCUsed
(boolean used) Set whether MASC has been used.void
setMixedTech
(boolean mixedTech) void
Sets the unit code for this Entity.void
setMovedBackwards
(boolean back) void
setMovementMode
(EntityMovementMode movementMode) Set the movement type of the entityvoid
setMulId
(int newId) void
setNC3NextUUIDAsString
(int pos, String c3id) void
setNCrew
(int crew) void
setNeverDeployed
(boolean neverDeployed) Toggles if an entity has been deployedvoid
Set the C3 network ID to be used on the next turn.void
void
setNMarines
(int marines) Updates the number of marines aboardvoid
setNPassenger
(int pass) void
setOffBoard
(int distance, OffBoardDirection direction) Set the unit as an off board deployment.void
setOmni
(boolean omni) void
setOriginalBuildYear
(int year) void
setOriginalJumpMP
(int jumpMP) Sets this entity's original jump movement pointsvoid
setOriginalWalkMP
(int walkMP) Sets this entity's original walking movement pointsvoid
void
setOwnerId
(int ownerId) Sets the unique id of this InGameObject's owning player.void
setPassedThrough
(Vector<Coords> pass) void
setPassedThroughBoardId
(int passedThroughBoardId) void
setPassedThroughFacing
(List<Integer> passFacing) void
setPlayerPickedPassThrough
(int attackerId, Coords c) void
setPosition
(Coords position) void
setPosition
(Coords position, boolean gameUpdate) Sets the current position of this entity on the board.void
setPowerReverse
(boolean isPowerReverse) void
setProne
(boolean prone) void
void
setRamming
(boolean b) void
Force rapid fire mode to the highest level on RAC and UAC - this is for aerospacevoid
setReckless
(boolean b) void
setRecoveryTurn
(int r) void
setRemovalCondition
(int removalCondition) Setter for property removalCondition.void
setRetreatedDirection
(OffBoardDirection retreatedDirection) void
setSalvage
(boolean canSalvage) Record if the unit is just combat-lossed or if it has been utterly destroyed.void
setSearchlightState
(boolean arg) void
setSecondaryFacing
(int sec_facing) void
setSecondaryFacing
(int sec_facing, boolean fireEvent) Sets the secondary facing.void
setSelfDestructedThisTurn
(boolean tf) void
setSelfDestructing
(boolean selfDestructing) void
setSelfDestructInitiated
(boolean tf) void
setShutDown
(boolean shutDown) void
setShutDownThisPhase
(boolean shutDown) void
Sets the source (TRO or other) of the creation of this entity.void
setSpotTargetId
(int targetId) void
setSpotting
(boolean spotting) Sets if this unit is spotting this round.void
setStartingAnyNWx
(int i) void
setStartingAnyNWy
(int i) void
setStartingAnySEx
(int i) void
setStartingAnySEy
(int i) void
setStartingOffset
(int startingOffset) void
setStartingPos
(int i) void
setStartingWidth
(int startingWidth) void
setStartupThisPhase
(boolean shutDown) void
setStruck
(boolean struck) Sets if a unit was physically struck (punch, kick, DFA, etc).void
setStructuralTechRating
(int structuralTechRating) void
setStructuralTechRating
(ITechnology.TechRating structuralTechRating) void
setStructureTechLevel
(int level) void
setStructureType
(int structureType) void
setStructureType
(String structureType) void
setStuck
(boolean arg) Set weather this Entity is stuck in a swamp or notvoid
setSuperchargerUsed
(boolean used) Set whether Supercharger has been used.void
setSwarmAttackerId
(int id) Record the ID of theEntity
that is attacking this unit with a swarm attack.void
setSwarmTargetId
(int id) Record the ID of theEntity
that is the current target of a swarm attack by this unit.void
setTaggedBy
(int tagger) void
setTargetBay
(int tb) void
setTaserFeedback
(int rounds) set this entity to suffer from taser feedbackvoid
setTaserInterference
(int value, int rounds, boolean heat) void
setTaserShutdownRounds
(int rounds) void
setTechLevel
(int techLevel) Sets the tech level for this Entity.void
setTowedBy
(int id) Sets the Entity that is directly towing this onevoid
setTowing
(int id) Change the towed status of this entityvoid
setTractor
(int id) Sets the tractor towing the train this entity is part ofvoid
setTraitorId
(int id) void
setTransportId
(int transportId) Record the ID of theEntity
that has loaded this unit.void
setTsempEffect
(int tsempEffect) void
setTurnInterrupted
(boolean interrupted) void
setUnitNumber
(short unit) Set the unit number for this entity.void
setUnitRole
(UnitRole role) void
setUnjammingRAC
(boolean u) void
setUnloaded
(boolean unloaded) This method should only be called when needed to remove a dead swarmer's game turn.void
setUsedSearchlight
(boolean arg) void
setUseManualBV
(boolean bv) void
setVectors
(int[] v) void
setVisibleToEnemy
(boolean b) void
setWeaponHit
(WeaponMounted which) void
setWeaponSortOrder
(WeaponSortOrder weaponSortOrder) void
setWeapOrderChanged
(boolean weaponOrderChanged) void
setWeight
(double weight) void
setWhoCanDetect
(Vector<Player> entityDetectedBy) void
setWhoCanSee
(Vector<Player> entitySeenBy) void
setWigeLiftoffHover
(boolean lifted) void
setYear
(int year) boolean
shouldDeploy
(int round) Returns true if the entity should be deployedboolean
shouldOffBoardDeploy
(int round) Returns true if the off board entity should be deployed this round.boolean
shouldUseEdge
(String option) int
int
int
int
int
sideTableRam
(Coords src) Used to determine net velocity of ramming attackint
sideTableRam
(Coords src, int facing) int
slotNumber
(Mounted<?> mounted) Returns the slot in which the given mounted equipment is in its main location.Returns the specific name or type name of this unit/object.This returns a textual description of the entity for visually impaired users.statusToString
(int loc) This returns a textual description of a specific location of the entity for visually impaired users.statusToString
(String str) void
taserShutdown
(int turns, boolean baTaser) shut this unit down due to a Taser attackvoid
Sets the movement mode to the next in the conversion sequence for QuadVees, LAMs, and Meks with tracks.toString()
void
towUnit
(int id) Attaches a trailer to this trainboolean
This should eventually be true for any situation where the entity's turn was interrupted, e.g.boolean
Unload the given unit.void
cycle through and update Baysboolean
updateDuplicateMarkerAfterDelete
(int removedMarker) Updates the marker used to disambiguate this entity from others with the same name after one of them has been removed from the game.boolean
boolean
usedTag()
boolean
Only check for satisfied turn mode for Tanks or QuadVees in vehicle mode, or LAMs in AirMek mode.boolean
Generates a vector containing reports on all useful information about this entity.boolean
boolean
Checks to see if entity was never deployedboolean
boolean
boolean
weaponFiredFrom
(int loc) whichBay
(int equipmentId) return the bay of the current weapon or ammoboolean
Tracks whether a WiGE lifted off this turn (or a LAM hovered).Methods inherited from class megamek.common.TurnOrdered
clearInitiative, generateTurnOrder, getAeroTurns, getDropshipTurns, getEvenTurns, getInitCompensationBonus, getInitiative, getJumpshipTurns, getMultiTurns, getNormalTurns, getOtherTurns, getSmallCraftTurns, getSpaceStationTurns, getTeleMissileTurns, getWarshipTurns, incrementAeroTurns, incrementDropshipTurns, incrementEvenTurns, incrementJumpshipTurns, incrementMultiTurns, incrementOtherTurns, incrementSmallCraftTurns, incrementSpaceStationTurns, incrementTeleMissileTurns, incrementWarshipTurns, resetAeroTurns, resetDropshipTurns, resetEvenTurns, resetInitiativeCompensation, resetJumpshipTurns, resetMultiTurns, resetOtherTurns, resetSmallCraftTurns, resetSpaceStationTurns, resetTeleMissileTurns, resetWarshipTurns, rollInitAndResolveTies, rollInitAndResolveTies, rollInitiative, rollInitiative, setInitCompensationBonus, setInitiative
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface megamek.common.BTObject
hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospace, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattleMek, isCarryableObject, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isUnitGroup, isVehicle, isWarShip
Methods inherited from interface megamek.common.CombatRole
hasRole
Methods inherited from interface megamek.common.ForceAssignable
partOfForce
Methods inherited from interface megamek.common.InGameObject
hasOwner
Methods inherited from interface megamek.common.ITechnology
calcEraAvailability, calcEraAvailability, calcYearAvailability, calcYearAvailability, calcYearAvailability, findMinimumRulesLevel, findMinimumRulesLevel, getAdvancedRange, getAdvancedRange, getCodeFromIOAbbr, getCodeFromMMAbbr, getCommonDate, getEraAvailabilityName, getEraAvailabilityName, getExperimentalRange, getExperimentalRange, getExtinctionDate, getExtinctionRange, getFullRatingName, getFullRatingName, getIntroductionDate, getProductionDate, getPrototypeDate, getReintroductionDate, getSimpleLevel, getSimpleLevel, getSimpleLevel, getStandardRange, getStandardRange, getTechLevel, getTechLevel, getTechRatingName, isAvailableIn, isAvailableIn, isAvailableIn, isExtinct, isExtinct, isExtinct, isLegal, isLegal
Methods inherited from interface megamek.common.Targetable
getBoardLocation, isBomber, isHexBeingBombed, isOnBoard, tracksHeat
Methods inherited from interface megamek.common.Transporter
canTow, getNumberLoadedThisTurn, getNumberUnloadedThisTurn, getType, hardpointCost
-
Field Details
-
DOES_NOT_TRACK_HEAT
public static final int DOES_NOT_TRACK_HEAT- See Also:
-
UNLIMITED_JUMP_DOWN
public static final int UNLIMITED_JUMP_DOWN- See Also:
-
ETYPE_MEK
public static final long ETYPE_MEKEntity Type Id Definitions These are used to identify the type of Entity, such as 'Mek or aero.- See Also:
-
ETYPE_BIPED_MEK
public static final long ETYPE_BIPED_MEK- See Also:
-
ETYPE_LAND_AIR_MEK
public static final long ETYPE_LAND_AIR_MEK- See Also:
-
ETYPE_QUAD_MEK
public static final long ETYPE_QUAD_MEK- See Also:
-
ETYPE_ARMLESS_MEK
public static final long ETYPE_ARMLESS_MEK- See Also:
-
ETYPE_AERO
public static final long ETYPE_AERO- See Also:
-
ETYPE_JUMPSHIP
public static final long ETYPE_JUMPSHIP- See Also:
-
ETYPE_WARSHIP
public static final long ETYPE_WARSHIP- See Also:
-
ETYPE_SPACE_STATION
public static final long ETYPE_SPACE_STATION- See Also:
-
ETYPE_CONV_FIGHTER
public static final long ETYPE_CONV_FIGHTER- See Also:
-
ETYPE_FIXED_WING_SUPPORT
public static final long ETYPE_FIXED_WING_SUPPORT- See Also:
-
ETYPE_FIGHTER_SQUADRON
public static final long ETYPE_FIGHTER_SQUADRON- See Also:
-
ETYPE_SMALL_CRAFT
public static final long ETYPE_SMALL_CRAFT- See Also:
-
ETYPE_DROPSHIP
public static final long ETYPE_DROPSHIP- See Also:
-
ETYPE_TELEMISSILE
public static final long ETYPE_TELEMISSILE- See Also:
-
ETYPE_INFANTRY
public static final long ETYPE_INFANTRY- See Also:
-
ETYPE_BATTLEARMOR
public static final long ETYPE_BATTLEARMOR- See Also:
-
ETYPE_MEKWARRIOR
public static final long ETYPE_MEKWARRIOR- See Also:
-
ETYPE_PROTOMEK
public static final long ETYPE_PROTOMEK- See Also:
-
ETYPE_TANK
public static final long ETYPE_TANK- See Also:
-
ETYPE_GUN_EMPLACEMENT
public static final long ETYPE_GUN_EMPLACEMENT- See Also:
-
ETYPE_SUPER_HEAVY_TANK
public static final long ETYPE_SUPER_HEAVY_TANK- See Also:
-
ETYPE_SUPPORT_TANK
public static final long ETYPE_SUPPORT_TANK- See Also:
-
ETYPE_LARGE_SUPPORT_TANK
public static final long ETYPE_LARGE_SUPPORT_TANK- See Also:
-
ETYPE_VTOL
public static final long ETYPE_VTOL- See Also:
-
ETYPE_SUPPORT_VTOL
public static final long ETYPE_SUPPORT_VTOL- See Also:
-
ETYPE_TRIPOD_MEK
public static final long ETYPE_TRIPOD_MEK- See Also:
-
ETYPE_QUADVEE
public static final long ETYPE_QUADVEE- See Also:
-
ETYPE_AEROSPACEFIGHTER
public static final long ETYPE_AEROSPACEFIGHTER- See Also:
-
ETYPE_HANDHELD_WEAPON
public static final long ETYPE_HANDHELD_WEAPON- See Also:
-
BLOOD_STALKER_TARGET_CLEARED
public static final int BLOOD_STALKER_TARGET_CLEARED- See Also:
-
LOC_NONE
public static final int LOC_NONE- See Also:
-
LOC_DESTROYED
public static final int LOC_DESTROYED- See Also:
-
MAX_C3_NODES
public static final int MAX_C3_NODES- See Also:
-
MAX_C3i_NODES
public static final int MAX_C3i_NODES- See Also:
-
GRAPPLE_BOTH
public static final int GRAPPLE_BOTH- See Also:
-
GRAPPLE_RIGHT
public static final int GRAPPLE_RIGHT- See Also:
-
GRAPPLE_LEFT
public static final int GRAPPLE_LEFT- See Also:
-
DMG_NONE
public static final int DMG_NONE- See Also:
-
DMG_LIGHT
public static final int DMG_LIGHT- See Also:
-
DMG_MODERATE
public static final int DMG_MODERATE- See Also:
-
DMG_HEAVY
public static final int DMG_HEAVY- See Also:
-
DMG_CRIPPLED
public static final int DMG_CRIPPLED- See Also:
-
game
-
iGame
-
id
protected int id -
camouflage
-
externalId
ID settable by external sources (such as mm.net) -
weight
protected double weight -
omni
protected boolean omni -
chassis
-
model
-
clanChassisName
The special chassis name for Clan Meks such as Timber Wolf for the Mad Cat. This is appended to the base chassis name to form the full chassis name such as Mad Cat (Timber Wolf) ingetShortNameRaw()
andgetFullChassis()
. This is only saved in mtf files (as of 2024). -
mulId
protected int mulIdIf this is a unit from an official source, the MUL ID links it to its corresponding entry in the online Master Unit List. -
year
protected int year -
techLevel
protected int techLevel -
structuralTechRating
Used by support vehicles to define the structural tech rating (TM pg 117). The values should come from EquipmentType.TechRating.A-X. -
armorTechRating
Used by support vehicles to define tech rating of armor. Default value indicates that structural tech rating should be used, as in most cases the armor and structural tech ratings match. -
engineTechRating
Used by support vehicles to define tech rating of armor. Default value indicates that structural tech rating should be used, as in most cases the engine and structural tech ratings match. -
mixedTech
protected boolean mixedTech -
designValid
protected boolean designValid -
useManualBV
protected boolean useManualBV -
manualBV
protected int manualBV -
initialBV
protected int initialBV -
owner
-
ownerId
protected int ownerId -
traitorId
protected int traitorId -
targetBay
protected int targetBay -
STARTING_ANY_NONE
public static final int STARTING_ANY_NONE- See Also:
-
nCrew
protected int nCrew -
nPassenger
protected int nPassenger -
nMarines
protected int nMarines -
manualShutdown
protected boolean manualShutdown -
startupThisPhase
protected boolean startupThisPhase -
shutDown
protected boolean shutDown -
shutDownThisPhase
protected boolean shutDownThisPhase -
doomed
protected boolean doomed -
destroyed
protected boolean destroyed -
secondaryPositions
Used for Entities that are bigger than a single hex. This contains the central hex plus all of the other hexes this entity occupies. The central hex is important for drawing multi-hex sprites. -
facing
protected int facing -
sec_facing
protected int sec_facing -
twistedPhase
-
walkMP
protected int walkMP -
jumpMP
protected int jumpMP -
done
protected boolean done -
prone
protected boolean prone -
hullDown
protected boolean hullDown -
findingClub
protected boolean findingClub -
armsFlipped
protected boolean armsFlipped -
unjammingRAC
protected boolean unjammingRAC -
selfDestructing
protected boolean selfDestructing -
selfDestructInitiated
protected boolean selfDestructInitiated -
boobyTrapInitiated
protected boolean boobyTrapInitiated -
selfDestructedThisTurn
protected boolean selfDestructedThisTurn -
hasExternalSearchlight
protected boolean hasExternalSearchlightTrue when the entity has an undestroyed searchlight that is neither a Quirk searchlight nor a mounted (0.5t / 1slot) searchlight. -
illuminated
protected boolean illuminated -
searchlightIsActive
protected boolean searchlightIsActive -
usedSearchlight
protected boolean usedSearchlight -
stuckInSwamp
protected boolean stuckInSwamp -
canUnstickByJumping
protected boolean canUnstickByJumping -
taggedBy
protected int taggedBy -
layingMines
protected boolean layingMines -
_isEMId
protected boolean _isEMId -
hardenedArmorDamaged
protected boolean[] hardenedArmorDamaged -
locationBlownOff
protected boolean[] locationBlownOff -
locationBlownOffThisPhase
protected boolean[] locationBlownOffThisPhase -
armorType
protected int[] armorType -
armorTechLevel
protected int[] armorTechLevel -
isJumpingNow
protected boolean isJumpingNow -
convertingNow
protected boolean convertingNow -
previousMovementMode
-
displacementAttack
-
heat
public int heat -
heatBuildup
public int heatBuildup -
heatFromExternal
public int heatFromExternal -
coolFromExternal
public int coolFromExternal -
delta_distance
public int delta_distance -
mpUsed
public int mpUsed -
underwaterRounds
public int underwaterRounds -
moved
-
movedLastRound
-
mpUsedLastRound
protected int mpUsedLastRound -
gotPavementOrRoadBonus
public boolean gotPavementOrRoadBonus -
wigeBonus
public int wigeBonus -
inReverse
public boolean inReverse -
struck
protected boolean struck -
fell
protected boolean fell -
damageThisPhase
public int damageThisPhase -
damageThisRound
public int damageThisRound -
engineHitsThisPhase
public int engineHitsThisPhase -
rolledForEngineExplosion
public boolean rolledForEngineExplosion -
dodging
public boolean dodging -
reckless
public boolean reckless -
spotting
public boolean spotting -
killerId
protected int killerId -
vectors
protected int[] vectors -
infernos
The object that tracks this unit's Inferno round hits. -
aTracker
-
tmTracker
-
c3NetIdString
-
c3Master
protected int c3Master -
c3CompanyMasterIndex
protected int c3CompanyMasterIndex -
structureType
protected int structureType -
structureTechLevel
protected int structureTechLevel -
source
-
asewAffectedTurns
protected int asewAffectedTurnsKeeps track of the current ASEW effect on this entity -
equipmentList
A list of all mounted equipment. (Weapons, ammo, and misc) -
weaponList
A list of all mounted weapons. This only includes regular weapons, not bay mounts or grouped weapon mounts. -
weaponBayList
A list of all mounted weapon bays -
weaponGroupList
A list of all mounted weapon groups -
totalWeaponList
A list of every weapon mount, including bay mounts and weapon group mounts -
ammoList
A list of all mounted ammo. -
bombList
A list of all mounted bombs. -
miscList
A list of all remaining equipment. -
pendingINarcPods
-
iNarcPods
-
pendingNarcPods
-
narcPods
-
failedEquipmentList
-
m_lNarcedBy
protected long m_lNarcedBy -
m_lPendingNarc
protected long m_lPendingNarc -
crits
This matrix stores critical slots in the format [location][slot #]. What locations entities have and how many slots there are in each is determined by the subclasses of Entity such as Mek. -
movementMode
Stores the current movement mode. -
isHidden
protected boolean isHiddenFlag that determines if this Entity is a hidden unit or not (see TW pg 259). -
madePointblankShot
protected boolean madePointblankShotUsed to determine if this Entity has made a pointblank shot so far this round. -
carcass
protected boolean carcass -
sensorContacts
Contains the ids of all entities that have been detected by this entity's sensors. Used for double-blind on space maps - SO p117Entities need only be cleared from this when they move out of range, are destroyed, or move off the board
-
firingSolutions
Contains the ids of all entities that this entity has established a firing solution on. Used for double-blind on space maps - SO p117Entities need only be cleared from this when they move out of range, are destroyed, or move off the board
-
elevation
protected int elevationthis is the elevation of the Entity--with respect to the surface of the hex it's in. In other words, this may need to *change* as it moves from hex to hex--without it going up or down. I.e.--level 0 hex, elevation 5--it moves to a level 2 hex, without going up or down. elevation is now 3. -
altitude
protected int altitudealtitude is different from elevation. It is used to measure the vertical distance of Aero units from the ground on low atmosphere and ground maps. -
lastTarget
protected int lastTarget -
lastTargetDisplayName
-
isCarefulStanding
protected boolean isCarefulStanding -
heatSinkCoolantFailureFactor
protected int heatSinkCoolantFailureFactor -
taserShutdownRounds
protected int taserShutdownRounds -
shutdownByBATaser
protected boolean shutdownByBATaser -
taserFeedBackRounds
protected int taserFeedBackRounds -
taserInterference
protected int taserInterference -
taserInterferenceRounds
protected int taserInterferenceRounds -
taserInterferenceHeat
protected boolean taserInterferenceHeat -
fluff
-
armorTonnage
protected double armorTonnage -
MASC_FAILURE
protected static int[] MASC_FAILURE -
ALTERNATE_MASC_FAILURE
protected static int[] ALTERNATE_MASC_FAILURE -
ALTERNATE_MASC_FAILURE_ENHANCED
protected static int[] ALTERNATE_MASC_FAILURE_ENHANCED -
nMASCLevel
protected int nMASCLevel -
bMASCWentUp
protected boolean bMASCWentUp -
usedMASC
protected boolean usedMASC -
nSuperchargerLevel
protected int nSuperchargerLevel -
bSuperchargerWentUp
protected boolean bSuperchargerWentUp -
usedSupercharger
protected boolean usedSupercharger -
military
protected boolean military -
hasDamagedRHS
protected boolean hasDamagedRHSKeeps track of whether or not this Entity has a critically hit radical heat sink. Using a flag will prevent having to iterate over all of the Entity's mounted equipment -
consecutiveRHSUses
protected int consecutiveRHSUsesKeeps track of the number of consecutive turns a radical heat sink has been used. -
incomingGuidedAttacks
Vector storing references to friendly weapon attack actions this entity may need to support; Primarily used by Princess to speed up TAG utility calculations. -
icon
The icon for this unit; This is empty unless the unit file has an embedded icon. -
TA_OMNI
-
TA_PATCHWORK_ARMOR
-
TA_MIXED_TECH
-
TA_ARMORED_COMPONENT
-
-
Constructor Details
-
Entity
public Entity()Generates a new, blank, entity.
-
-
Method Details
-
getUnitType
public abstract int getUnitType()- See Also:
-
defaultCrewType
-
initMilitary
protected void initMilitary() -
hasViableWeapons
protected boolean hasViableWeapons() -
restore
public void restore()Restores the entity after serialization -
getId
public int getId()Description copied from interface:InGameObject
Returns this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.- Specified by:
getId
in interfaceInGameObject
- Returns:
- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
setId
public void setId(int id) Sets the ID number of this Entity, which will also set the display name and short name to null.- Specified by:
setId
in interfaceInGameObject
- Parameters:
id
- the new ID.
-
getExternalId
public int getExternalId()This returns the external ID.Taharqa: I am changing externalId to a string so I can use UUIDs in MHQ.
- Returns:
- the ID settable by external sources (such as mm.net)
- Throws:
NumberFormatException
- if the stored ID is not an integer- See Also:
-
getExternalIdAsString
-
setExternalIdAsString
This sets the external ID.- Parameters:
externalId
- the new external ID for this Entity.- See Also:
-
setExternalId
public void setExternalId(int id) -
getGame
This returns the game this Entity belongs to.- Returns:
- the game.
-
setIGame
-
setGame
This sets the game the entity belongs to. It also restores the entity and checks that the game is in a consistent state. This function takes care of the units transported by this entity.- Specified by:
setGame
in interfaceTransporter
- Parameters:
game
- The currentGame
-
getModel
Returns the unit code for this entity. -
setModel
Sets the unit code for this Entity.- Parameters:
model
- The unit code.
-
getChassis
- Returns:
- The pure chassis name without any additions, e.g. "Mad Cat"
-
getFullChassis
- Returns:
- The full chassis name plus the additional name, if any, e.g. Mad Cat (Timber Wolf)
-
setChassis
sets the chassis name for this entity.- Parameters:
chassis
- The chassis name.
-
setClanChassisName
Sets theclanChassisName
for this unit, e.g. "Timber Wolf". -
getClanChassisName
- Returns:
- The
clanChassisName
for this unit, e.g. "Timber Wolf", or "" if there is none.
-
getFluff
Returns the fluff for this entity. -
getTechLevel
public int getTechLevel()Returns the unit tech for this entity. -
setTechLevel
public void setTechLevel(int techLevel) Sets the tech level for this Entity.- Parameters:
techLevel
- The tech level, it must be one of theTechConstants
.
-
initTechAdvancement
protected void initTechAdvancement()Sets initial TechAdvancement without equipment based on construction options. -
factionTechLevel
-
addTechComponent
-
isIntroLevel
public boolean isIntroLevel()- Specified by:
isIntroLevel
in interfaceITechnology
-
isUnofficial
public boolean isUnofficial()- Specified by:
isUnofficial
in interfaceITechnology
-
getIntroductionDateAndEra
-
getIntroductionDate
public int getIntroductionDate()- Specified by:
getIntroductionDate
in interfaceITechnology
-
getIntroductionDate
- Specified by:
getIntroductionDate
in interfaceITechnology
-
getEarliestTechDate
public int getEarliestTechDate()- Returns:
- The earliest date this unit could be built, based on the latest intro date of the components.
-
getEarliestTechDateAndEra
- Returns:
- The earliest date this unit could be built, based on the latest intro date of the components.
-
getPrototypeRangeDate
-
getProductionDateRange
-
getCommonDateRange
-
getPrototypeDate
public int getPrototypeDate()- Specified by:
getPrototypeDate
in interfaceITechnology
-
getPrototypeDate
- Specified by:
getPrototypeDate
in interfaceITechnology
-
getProductionDate
public int getProductionDate()- Specified by:
getProductionDate
in interfaceITechnology
-
getProductionDate
- Specified by:
getProductionDate
in interfaceITechnology
-
getCommonDate
public int getCommonDate()- Specified by:
getCommonDate
in interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate()- Specified by:
getExtinctionDate
in interfaceITechnology
-
getExtinctionDate
- Specified by:
getExtinctionDate
in interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate()- Specified by:
getReintroductionDate
in interfaceITechnology
-
getReintroductionDate
- Specified by:
getReintroductionDate
in interfaceITechnology
-
getTechRating
- Specified by:
getTechRating
in interfaceITechnology
-
getStaticTechLevel
Description copied from interface:ITechnology
For non-era-based usage, provide a single tech level that does not vary with date.- Specified by:
getStaticTechLevel
in interfaceITechnology
- Returns:
- The base rules level of the equipment or unit.
-
getTechBaseDescription
-
getTechBaseDescriptions
-
getBaseAvailability
- Specified by:
getBaseAvailability
in interfaceITechnology
-
getExtinctionRange
- Specified by:
getExtinctionRange
in interfaceITechnology
-
getConstructionTechAdvancement
return - the base construction option tech advancement -
recalculateTechAdvancement
public void recalculateTechAdvancement()Resets techAdvancement to initial value and adjusts for all installed equipment. -
getOmniAdvancement
-
getOmniAdvancement
-
getPatchworkArmorAdvancement
-
getMixedTechAdvancement
-
getArmoredComponentTechAdvancement
-
addSystemTechAdvancement
Incorporate dates for components that are not in the equipment list, such as engines and structure. -
getRecoveryTurn
public int getRecoveryTurn() -
setRecoveryTurn
public void setRecoveryTurn(int r) -
isManualShutdown
public boolean isManualShutdown() -
setManualShutdown
public void setManualShutdown(boolean tf) -
performManualShutdown
public void performManualShutdown() -
performManualStartup
public void performManualStartup() -
isClan
public boolean isClan()Checks if this is a clan unit. This is determined by tech level.- Specified by:
isClan
in interfaceITechnology
- Returns:
- true if this unit is a clan unit.
- See Also:
-
isClanArmor
public boolean isClanArmor(int loc) -
getTechBase
- Specified by:
getTechBase
in interfaceITechnology
-
isMixedTech
public boolean isMixedTech()- Specified by:
isMixedTech
in interfaceITechnology
-
setMixedTech
public void setMixedTech(boolean mixedTech) -
isDesignValid
public boolean isDesignValid() -
setDesignValid
public void setDesignValid(boolean designValid) -
getYear
public int getYear() -
setYear
public void setYear(int year) -
getWeight
public double getWeight()- Returns:
- the tonnage of the Entity, not its weight
-
getWeightClass
public int getWeightClass() -
getWeightClassName
-
isSuperHeavy
public boolean isSuperHeavy() -
setWeight
public void setWeight(double weight) -
isOmni
public boolean isOmni() -
setOmni
public void setOmni(boolean omni) -
locations
public abstract int locations()Returns the number of locations in the entity -
getBodyLocation
public int getBodyLocation()Determines where to place equipment that does not require a specific location. What this means varies byEntity
type.- Returns:
- The location to place equipment that is not required to be assigned a location, defaulting to Entity.LOC_NONE for unit types that do not have such a location.
-
getOwner
Returns the player that "owns" this entity.
Unfortunately, entities freshly created may not have the game set. Therefore, fall back to the old version when game == null or the player is no longer in the game
Server and other central classes already used
AbstractGame.getPlayer(int)
. It is noted thatowner
property is not reliable and should be avoided except in special situations like when entities freshly created may not have the game set- Returns:
- The player that owns this entity. Null if the entity is not owned by anyone.
-
setOwner
-
setOwnerId
public void setOwnerId(int ownerId) Description copied from interface:InGameObject
Sets the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
setOwnerId
in interfaceInGameObject
- Parameters:
ownerId
- The player id of the owner of this InGameObject.
-
getOwnerId
public int getOwnerId()Description copied from interface:InGameObject
Returns the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
getOwnerId
in interfaceInGameObject
- Returns:
- The player id of the owner of this InGameObject.
-
isEnemyOf
Returns true if the other entity is an enemy of this entity. This is more reliable than Player.isEnemyOf since it knows that an entity will never be an enemy of itself.- Specified by:
isEnemyOf
in interfaceTargetable
- Returns:
-
getCrew
-
setCrew
-
getNCrew
public int getNCrew()- Returns:
- The total number of crew available to supplement marines on boarding actions. Includes officers, enlisted, and bay personnel, but not marines/ba or passengers.
-
setNCrew
public void setNCrew(int crew) -
getNPassenger
public int getNPassenger()- Returns:
- The number of passengers on this unit. Intended for spacecraft, where we want to get the crews of transported units plus actual passengers assigned to quarters
-
setNPassenger
public void setNPassenger(int pass) -
getNMarines
public int getNMarines()- Returns:
- The number conventional marines available to vessels for boarding actions.
-
setNMarines
public void setNMarines(int marines) Updates the number of marines aboard- Parameters:
marines
- The number of marines to add/subtract
-
hasCommandConsoleBonus
public boolean hasCommandConsoleBonus()Units with a cockpit command console provide an initiative bonus to their side, provided that the commander is not currently functioning as pilot, the unit has advanced fire control, and the unit is heavy or assault weight class.- Returns:
- Whether the Entity qualifies for initiative bonus from cockpit command console.
-
isShutDown
public boolean isShutDown() -
setShutDown
public void setShutDown(boolean shutDown) -
setShutDownThisPhase
public void setShutDownThisPhase(boolean shutDown) -
isShutDownThisPhase
public boolean isShutDownThisPhase() -
setStartupThisPhase
public void setStartupThisPhase(boolean shutDown) -
isStartupThisPhase
public boolean isStartupThisPhase() -
isDoomed
public boolean isDoomed() -
setDoomed
public void setDoomed(boolean doomed) -
isDestroyed
public boolean isDestroyed() -
setDestroyed
public void setDestroyed(boolean destroyed) -
getTargetType
public int getTargetType()- Specified by:
getTargetType
in interfaceTargetable
-
getHeight
public int getHeight()Description copied from interface:Targetable
Returns the height of the target, that is, how many levels above its elevation it is for LOS purposes.- Specified by:
getHeight
in interfaceTargetable
- Returns:
- height of the target in elevation levels
-
isDone
public boolean isDone() -
setDone
public void setDone(boolean done) -
setUnloaded
public void setUnloaded(boolean unloaded) This method should only be called when needed to remove a dead swarmer's game turn. -
setLoadedThisTurn
public void setLoadedThisTurn(boolean loaded) -
isActive
public boolean isActive()Determine if this entity participate in the current game phase.- Returns:
true
if this entity is not shut down, is not destroyed, has an active crew, and was not unloaded from a transport this turn.false
otherwise.
-
isActive
public boolean isActive(int turn) -
isSelectableThisTurn
public boolean isSelectableThisTurn()Returns true if this entity is selectable for action. Transported entities can not be selected. -
isLoadableThisTurn
public boolean isLoadableThisTurn()Returns true if this entity could potentially be loaded (did not move from starting hex) -
isUnloadedThisTurn
public boolean isUnloadedThisTurn()Determine if thisEntity
was unloaded previously this turn.- Returns:
true
if this entity was unloaded for any reason during this turn.
-
wasLoadedThisTurn
public boolean wasLoadedThisTurn() -
isTargetable
public boolean isTargetable()Returns true if this entity is targetable for attacks. A unit is targetable if it is not destroyed, not doomed, deployed, not off board, not being transported, and not captured. -
isProne
public boolean isProne() -
setProne
public void setProne(boolean prone) -
isHullDown
public boolean isHullDown() -
setHullDown
public void setHullDown(boolean down) -
isImmobile
public boolean isImmobile()Is this entity shut down or is the crew unconscious?- Specified by:
isImmobile
in interfaceTargetable
- Returns:
- true if the target is immobile (-4 to hit)
-
isImmobileForJump
public boolean isImmobileForJump() -
isImmobile
public boolean isImmobile(boolean checkCrew) Is this entity shut down, or if applicable is the crew unconscious?- Parameters:
checkCrew
- If true, consider the fitness of the crew when determining if the entity is immobile.
-
isPermanentlyImmobilized
public boolean isPermanentlyImmobilized(boolean checkCrew) This method returns true if a unit is permanently immobilized either because its crew is dead/gone or because of damage- Returns:
- true if unit is permanently immobile
-
isCharging
public boolean isCharging() -
isPushing
public boolean isPushing() -
isMakingDfa
public boolean isMakingDfa() -
hasDisplacementAttack
public boolean hasDisplacementAttack() -
getDisplacementAttack
-
setDisplacementAttack
-
isTargetOfDisplacementAttack
public boolean isTargetOfDisplacementAttack()Returns true if any other entities this entity knows of are making a displacement attack on this entity. -
findTargetedDisplacement
Returns any known displacement attacks (should only be one) that this entity is a target of. -
isUnjammingRAC
public boolean isUnjammingRAC() -
setUnjammingRAC
public void setUnjammingRAC(boolean u) -
isFindingClub
public boolean isFindingClub() -
setFindingClub
public void setFindingClub(boolean findingClub) -
setArmsFlipped
public void setArmsFlipped(boolean armsFlipped) Set whether or not the Mek's arms are flipped to the rear -
setArmsFlipped
public void setArmsFlipped(boolean armsFlipped, boolean fireEvent) Set whether or not the Mek's arms are flipped to the rear. Does not fire the game event, useful for when it's called repeatedly such as during bot turn calculations -
getArmsFlipped
public boolean getArmsFlipped()Returns true if the Mek's arms are flipped to the rear -
isMakingVTOLGroundAttack
public boolean isMakingVTOLGroundAttack()- Returns:
- true if the VTOL or LAM is making a VTOL strafe or VTOL/AirMek bomb attack
-
getPosition
- Specified by:
getPosition
in interfaceTargetable
- Returns:
- the coordinates of the hex containing the target
-
getOccupiedCoords
- Returns:
- a set of the coords this Entity occupies
-
setPosition
-
setPosition
Sets the current position of this entity on the board.- Parameters:
position
- the new position.
-
getPriorPosition
- Returns:
- the coords of the second to last position on the passed through vector or the current position if too small
-
setElevation
public void setElevation(int elevation) Sets the current elevation of this entity above the ground. This is the number of levels the unit is above the level of the hex.- Parameters:
elevation
- anint
representing the new elevation.
-
calcElevation
Calculates the elevation of the entity in the next hex.- Parameters:
current
- The current hexnext
- The next hexassumedElevation
- The assumed elevation from the previous hexclimb
- Whether the entity is climbing or not- Returns:
- The elevation of the entity in the next hex
- See Also:
-
calcElevation
-
getElevation
public int getElevation()Description copied from interface:Targetable
Returns the elevation of this target, relative to the position Hex's surface- Specified by:
getElevation
in interfaceTargetable
- Returns:
- The elevation of this Entity, relative to the current Hex's surface. When the unit is transported, returns the elevation of the carrier.
-
canGoDown
public boolean canGoDown() -
canGoDown
is it possible to go down, or are we landed/just above the water/treeline? assuming passed elevation. -
canGoUp
is it possible to go up, or are we at maximum altitude? assuming passed elevation. -
isElevationValid
Check if this entity can legally occupy the requested elevation. Does not check stacking, only terrain limitations -
height
public int height()Returns the height of the unit, that is, how many levels above its elevation it is for LOS purposes. Default is 0. -
relHeight
public int relHeight()Returns the elevation of the entity's highest point relative to the surface of the hex the entity is in, i.e. relHeight() == getElevation() + getHeight()- Specified by:
relHeight
in interfaceTargetable
- Returns:
- elevation of the top (e.g. torso) of the target relative to surface
-
isOnAtmosphericGroundMap
public boolean isOnAtmosphericGroundMap()Convenience method to determine whether this entity is on a ground map with an atmosphere -
isAirborneAeroOnGroundMap
public boolean isAirborneAeroOnGroundMap()Convenience method to determine whether this entity should be treated as an airborne aero on a ground map.- Returns:
- True if this is an airborne aircraft on a ground map.
-
isAeroLandedOnGroundMap
public boolean isAeroLandedOnGroundMap()Convenience method to determine whether this entity should be treated as a landed aero on a ground map.- Returns:
- True if this is an aero landed on a ground map.
-
getDuplicateMarker
public int getDuplicateMarker()Gets the marker used to disambiguate this entity from others with the same name. These are monotonically increasing values, starting from one. -
setDuplicateMarker
public void setDuplicateMarker(int duplicateMarker) Sets the marker used to disambiguate this entity from others with the same name. These are monotonically increasing values, starting from one.- Parameters:
duplicateMarker
- A marker to disambiguate this entity from others with the same name.
-
updateDuplicateMarkerAfterDelete
public boolean updateDuplicateMarkerAfterDelete(int removedMarker) Updates the marker used to disambiguate this entity from others with the same name after one of them has been removed from the game.- Parameters:
removedMarker
- The marker of the removed entity.- Returns:
- A value indicating whether or not this entity updated its duplicate marker.
-
getDisplayName
Returns the display name for this entity.- Specified by:
getDisplayName
in interfaceTargetable
- Returns:
- name of the target for ui purposes
-
setDisplayName
Sets the display name for this entity.- Parameters:
displayName
- The new display name.
-
generateDisplayName
public void generateDisplayName()Generates the display name for this entity.Sub-classes are allowed to override this method. The display name is in the format [Chassis] [Model] ([Player Name]).
-
getShortName
A short name, suitable for displaying above a unit icon. The short name is basically the same as the display name, minus the player name. -
generateShortName
public void generateShortName()Generate the short name for a unitSub-classes are allowed to override this method. The display name is in the format [Chassis] [Model].
-
getShortNameRaw
-
getFacing
public int getFacing()Returns the primary facing, or -1 if n/a -
getFacingName
-
setFacing
public void setFacing(int facing) Sets the primary facing. -
getSecondaryFacing
public int getSecondaryFacing()Returns the secondary facing, or -1 if n/a -
setSecondaryFacing
public void setSecondaryFacing(int sec_facing) -
setSecondaryFacing
public void setSecondaryFacing(int sec_facing, boolean fireEvent) Sets the secondary facing. Optionally does not fire a game change event (useful for bot evaluation) -
postProcessFacingChange
public void postProcessFacingChange()Utility function that handles situations where a facing change imparts some kind of permanent effect to the entity. -
canChangeSecondaryFacing
public abstract boolean canChangeSecondaryFacing()Can this entity change secondary facing at all? -
isValidSecondaryFacing
public abstract boolean isValidSecondaryFacing(int dir) Can this entity torso/turret twist the given direction? -
clipSecondaryFacing
public abstract int clipSecondaryFacing(int dir) Returns the closest valid secondary facing to the given direction.- Returns:
- the closest valid secondary facing.
-
getAlreadyTwisted
public boolean getAlreadyTwisted()- Returns:
- whether this entity already changed a secondary facing in an earlier phase
-
setAlreadyTwisted
public void setAlreadyTwisted(boolean value) Used by TargetingPhaseDisplay.java and FiringDisplay.java- Parameters:
value
- true sets twistedPhase to current phase (or leaves it if set); false unsets twistedPhase
-
canUnjamRAC
public boolean canUnjamRAC()Returns true if the entity has an RAC which is jammed and not destroyed As of 5/22/2012 also returns true if there is a jammed and not destroyed Ultra AC and the unofficial options is enabled. Jammed ACs and LACs can also be unjammed if rapid-fire ACs is turned on. -
canFlipArms
public boolean canFlipArms()Returns true if the entity can flip its arms -
canPickupGroundObject
public boolean canPickupGroundObject()Returns true if the entity can pick up ground objects -
maxGroundObjectTonnage
public double maxGroundObjectTonnage()The maximum tonnage of ground objects that can be picked up by this unit -
pickupGroundObject
Put a ground object into the given location -
dropGroundObject
Remove a specific carried object - useful for when you have the object but not its location, or when an object is being carried in multiple locations. -
dropGroundObject
public void dropGroundObject(int location) Remove a ground object (cargo) from the given location -
dropGroundObjects
public void dropGroundObjects()Convenience method to drop all cargo. TODO HHW - Psi -
getCarriedObject
Get the object carried in the given location. May return null. -
getCarriedObjects
-
setCarriedObjects
TODO HHW - Psi -
getDistinctCarriedObjects
-
getDefaultPickupLocations
A list of the "default" cargo pick up locations for when none is specified -
getValidHalfWeightPickupLocations
A list of all the locations that the entity can use to pick up cargo following the TacOps "one handed" pickup rules -
canFireWeapon
public boolean canFireWeapon(int location) Whether a weapon in a given location can be fired, given the entity's currently carried cargo -
getBlockedFiringLocations
Method that returns the mapping between locations which, if cargo is carried, block other locations from firing. -
getOriginalWalkMP
public int getOriginalWalkMP()Returns this entity's original walking movement points -
setOriginalWalkMP
public void setOriginalWalkMP(int walkMP) Sets this entity's original walking movement points -
getWalkMP
public int getWalkMP()- Returns:
- this entity's walking/cruising mp, factoring in all MP-changing effects.
-
getWalkMP
-
getHeatMPReduction
public int getHeatMPReduction()- Returns:
- The number of movement points (MP) lost due to the current heat level of the unit
-
getStandingHeat
public int getStandingHeat()get the heat generated by this Entity when standing still -
getWalkHeat
public int getWalkHeat()get the heat generated by this Entity when walking/cruising -
getOriginalRunMP
public int getOriginalRunMP()- Returns:
- This entity's unmodified running/flank mp.
-
getRunMP
public int getRunMP()- Returns:
- This entity's running/flank mp modified for all in-game effects.
-
getRunMP
-
getRunMPwithoutMASC
public int getRunMPwithoutMASC()Returns run MP without considering any MASC systems -
getRunMPasString
Returns this entity's running/flank mp as a string. Includes both the base mp and the potential mp with speed enhancers, including the current status of such speed enhancers.- Returns:
- A string like
9(15)
if there is no currentGame
, or a string like9(15) MASC:0(3+)
if there is one.
-
getRunMPasString
Returns this entity's running/flank mp as a string. Includes both the base mp and the potential mp with speed enhancers, optionally including the current status of such speed enhancers.- Parameters:
gameState
- Set this totrue
to include information about the current state of equipment like MASC.- Returns:
- A string like
9(15)
ifgameState
isfalse
or there is no currentGame
, or a string like9(15) MASC:0(3+)
otherwise.
-
getRunHeat
public int getRunHeat()get the heat generated by this Entity when running/flanking -
getSprintMP
public int getSprintMP()Returns this entity's sprinting MP, modified for all its current circumstances such as gravity and damage. SeeMPCalculationSetting.STANDARD
. For units that can't sprint, this is equal to the modified run/flank MP.- Returns:
- This entity's modified sprinting MP
-
getSprintMP
Returns this entity's sprinting MP, modified according to the given setting. For units that can't sprint, this is equal to the modified run/flank MP.- Returns:
- This entity's modified sprinting MP
-
getSprintMPwithOneMASC
public int getSprintMPwithOneMASC()Returns sprint MP without considering MASC -
getSprintMPwithoutMASC
public int getSprintMPwithoutMASC()Returns sprint MP without considering MASC -
getSprintHeat
public int getSprintHeat()get the heat generated by this Entity when sprinting -
getRunningGravityLimit
public int getRunningGravityLimit()get the gravity limit for ground movement -
getOriginalJumpMP
public int getOriginalJumpMP()Returns this entity's original jumping mp. -
getOriginalJumpMP
public int getOriginalJumpMP(boolean ignoreModularArmor) -
setOriginalJumpMP
public void setOriginalJumpMP(int jumpMP) Sets this entity's original jump movement points -
getAnyTypeMaxJumpMP
public int getAnyTypeMaxJumpMP()- Returns:
- In most cases, the same as getJumpMP(). For Meks that have either normal jump MP or mechanical booster jump MP or both, the bigger value is returned.
- See Also:
-
getJumpMP
public int getJumpMP()Returns this entity's current jump jet jumping MP, not affected by terrain, factored for gravity. Note that for Meks, this does not include jumping MP due to mechanical jump boosters. When the difference between the two doesn't matter (Princess or scenario estimations or the like), use getAnyTypeMaxJumpMP() instead.- See Also:
-
getJumpMP
-
getJumpType
public int getJumpType() -
getJumpHeat
public int getJumpHeat(int movedMP) get the heat generated by this Entity when jumping for a certain amount of MP- Parameters:
movedMP
- the number of movement points spent
-
getJumpMPWithTerrain
public int getJumpMPWithTerrain()Returns this entity's current jumping MP, affected by terrain (like water.) -
getMechanicalJumpBoosterMP
public int getMechanicalJumpBoosterMP()- Returns:
- The jump MP for a Mek's mechanical jump boosters, modified for typical gameplay purposes by damage, other equipment (shields) and other effects. Returns 0 for non-Meks.
-
getMechanicalJumpBoosterMP
- Returns:
- The jump MP for a Mek's mechanical jump boosters, modified as given through the MPCalculationSetting. Returns 0 for non-Meks.
-
isEligibleForPavementOrRoadBonus
public boolean isEligibleForPavementOrRoadBonus()Tanks and certain other units can get a +1 bonus to MP if their move is entirely on pavement.- Returns:
- true if the
Entity
gets a movement bonus on pavement
-
elevationOccupied
Returns the absolute elevation above ground level 0 that this entity would be on if it were placed into the specified hex. Hovercraft, naval vessels, and hydrofoils move on the surface of the water -
elevationOccupied
-
isLocationProhibited
Returns true when the given location cannot legally be entered or deployed into by this unit at its present elevation or altitude. Also returns true when the location doesn't exist. Even when this method returns true, the location need not be deadly to the unit.- Parameters:
boardLocation
- The location to test- Returns:
- True when the location is illegal to be in for this unit, regardless of elevation
- See Also:
-
isLocationProhibited
Returns true when the given location cannot legally be entered or deployed into by this unit at the given elevation or altitude. Also returns true when the location doesn't exist. Even when this method returns true, the location need not be deadly to the unit.- Parameters:
boardLocation
- The location to testtestElevation
- The elevation or altitude to test- Returns:
- True when the location is illegal to be in for this unit, regardless of elevation
- See Also:
-
isLocationProhibited
Returns true when the given location cannot legally be entered or deployed into by this unit at the given elevation or altitude. Also returns true when the location doesn't exist. Even when this method returns true, the location need not be deadly to the unit.- Parameters:
testPosition
- The position to testtestBoardId
- The board to testtestElevation
- The elevation or altitude to test- Returns:
- True when the location is illegal to be in for this unit, regardless of elevation
- See Also:
-
isLocationProhibited
Returns true if the specified hex contains some sort of prohibited terrain. legacy - use the board location/board ID methods instead -
isLocationProhibited
- Parameters:
c
-Coords
CoordinatescurrElevation
- Elevation level- Returns:
- true if the specified hex contains some sort of prohibited terrain if the Entity is at the specified elevation. Elevation generally only matters for units like WiGEs or VTOLs. legacy - use the board location/board ID methods instead
-
isBoardProhibited
- Returns:
- True if the given board is prohibited to this unit.
-
isBoardProhibited
- Returns:
- True if the given board is prohibited to this unit.
-
isLocationDeadly
-
isLocationDeadly
Returns true if the specified hex exists and has terrain that is deadly to this unit. Note: Currently this is only overridden for meks and is missing elevation information which makes it incomplete. -
getMovementString
Returns the name of the type of movement used. -
getMovementAbbr
Returns the abbreviation of the name of the type of movement used. -
getLocationName
Returns the name of the location specified. -
getLocationNames
-
getLocationName
Returns the name of the location specified. -
getLocationAbbrs
-
getLocationAbbr
Returns the abbreviated name of the location specified. -
getLocationAbbr
Returns the abbreviated name of the location specified. -
getLocationFromAbbr
Returns the location that the specified abbreviation indicates -
joinLocationAbbr
Joins the abbreviations for the locations into a String with / as the separator. If the number of locations exceeds the provided limit, the result is abbreviated. By default the abbreviation is simply an asterisk, but Meks have specific abbreviations locations that include all torso or leg positions.- Parameters:
locations
- A list of location indiceslimit
- The maximum number of locations to show in full- Returns:
- A string formatted for display that shows the locations
-
rollHitLocation
public abstract HitData rollHitLocation(int table, int side, int aimedLocation, AimingMode aimingMode, int cover) Rolls the to-hit number -
rollHitLocation
Rolls up a hit location -
getTransferLocation
Gets the location that excess damage transfers to. That is, one location inwards. -
getTransferLocation
public int getTransferLocation(int loc) int version -
getDependentLocation
public int getDependentLocation(int loc) Gets the location that is destroyed recursively. That is, one location outwards. -
hasRearArmor
public boolean hasRearArmor(int loc) Does this location have rear armor? -
getArmor
public int getArmor(int loc) Returns the amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED. Only works on front locations. -
getArmor
Returns the amount of armor in the location hit, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED. -
getArmor
public int getArmor(int loc, boolean rear) Returns the amount of armor in the location specified, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED. -
getArmorForReal
public int getArmorForReal(int loc, boolean rear) -
getArmorForReal
public int getArmorForReal(int loc) -
getOArmor
public int getOArmor(int loc) Returns the original amount of armor in the location specified. Only works on front locations. -
getOArmor
Returns the original amount of armor in the location hit. -
getOArmor
public int getOArmor(int loc, boolean rear) Returns the original amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.- Parameters:
loc
- the location to check.rear
- if true inspect the rear armor, else check the front.
-
setArmor
Sets the amount of armor in the location specified. -
setArmor
public void setArmor(int val, int loc) Sets the amount of armor in the front location specified. -
setArmor
public void setArmor(int val, int loc, boolean rear) Sets the amount of armor in the location specified.- Parameters:
val
- the value of the armor (eg how many armor points)loc
- the location of the armorrear
- true iff the armor is rear mounted.
-
refreshLocations
public void refreshLocations() -
firstArmorIndex
public int firstArmorIndex()- Returns:
- The index of the first armored location (skipping vehicle body, et. al.)
-
initializeArmor
public void initializeArmor(int val, int loc) Initializes the armor on the unit. Sets the original and starting point of the armor to the same number. -
getTotalArmor
public int getTotalArmor()Returns the total amount of armor on the entity. -
getTotalOArmor
public int getTotalOArmor()Returns the total amount of armor on the entity. -
getArmorRemainingPercent
public double getArmorRemainingPercent()Returns the percent of the armor remaining -
getInternal
Returns the amount of internal structure in the location hit. -
getInternal
public int getInternal(int loc) Returns the amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED. -
getInternalForReal
public int getInternalForReal(int loc) -
getOInternal
Returns the original amount of internal structure in the location hit. -
getOInternal
public int getOInternal(int loc) Returns the original amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED. -
setInternal
Sets the amount of armor in the location specified. -
setInternal
public void setInternal(int val, int loc) Sets the amount of armor in the location specified. -
initializeInternal
public void initializeInternal(int val, int loc) Initializes the internal structure on the unit. Sets the original and starting point of the internal structure to the same number. -
autoSetInternal
public abstract void autoSetInternal()Sets the internal structure for every location to appropriate undamaged values for the unit and location. -
getTotalInternal
public int getTotalInternal()Returns the total amount of internal structure on the entity. -
getTotalOInternal
public int getTotalOInternal()Returns the total original amount of internal structure on the entity. -
getInternalRemainingPercent
public double getInternalRemainingPercent()Returns the percent of the armor remaining -
isLocationBad
public boolean isLocationBad(int loc) Is this location destroyed or breached? -
isLocationTrulyDestroyed
public boolean isLocationTrulyDestroyed(int loc) -
isLocationDoomed
public boolean isLocationDoomed(int loc) Is this location destroyed or breached? -
getLocationStatus
public int getLocationStatus(int loc) returns exposure or breached flag for location -
setLocationStatus
public void setLocationStatus(int loc, int status) sets location exposure- Parameters:
loc
- the location who's exposure is to be setstatus
- the status to set
-
setLocationStatus
public void setLocationStatus(int loc, int status, boolean allowChange) sets location exposure- Parameters:
loc
- the location who's exposure is to be setstatus
- the status to setallowChange
- allow change of breached locations
-
locationIsLeg
public boolean locationIsLeg(int loc) - Parameters:
loc
- the location to check.- Returns:
- True if the given location is a leg location; this can only be true on Meks.
-
getArmorString
Returns a string representing the armor in the location -
getArmorString
Returns a string representing the armor in the location -
getInternalString
Returns a string representing the internal structure in the location -
armorStringFor
Parses the game's internal armor representation into a human-readable string. -
getHeatFiringModifier
public int getHeatFiringModifier()Returns the modifier to weapons fire due to heat. -
addEquipment
Creates a new mount for this equipment and adds it in.- Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted) throws LocationFullException Creates a new mount for this equipment and adds it in.- Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted) throws LocationFullException Creates a new mount for this equipment and adds it in.- Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted) throws LocationFullException - Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted) throws LocationFullException - Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted, boolean isOmniPodded) throws LocationFullException - Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int nAmmo) throws LocationFullException mounting weapons needs to take account of ammo- Parameters:
equipmentType
-EquipmentType
loc
-rearMounted
-nAmmo
-- Returns:
- Throws:
LocationFullException
-
addBomb
indicate whether this is a bomb mount- Throws:
LocationFullException
-
addBomb
- Throws:
LocationFullException
-
addWeaponGroup
public WeaponMounted addWeaponGroup(EquipmentType equipmentType, int loc) throws LocationFullException - Throws:
LocationFullException
-
addEquipment
public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean dwpMounted) throws LocationFullException indicate whether this is body mounted for BAs- Throws:
LocationFullException
-
addEquipment
protected void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted, int nAmmo) throws LocationFullException - Throws:
LocationFullException
-
addEquipment
protected void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted, boolean isWeaponGroup) throws LocationFullException - Throws:
LocationFullException
-
addEquipment
public void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted) throws LocationFullException - Throws:
LocationFullException
-
addFailedEquipment
-
getEquipmentNum
Returns the equipment number of the specified equipment, or -1 if equipment is not present. -
getEquipment
Returns an enumeration of all equipment -
getEquipment
Returns the equipment, specified by number -
getWeapon
-
getMisc
-
getAmmo
-
getEquipmentType
-
getFailedEquipment
Returns an enumeration which contains the name of each piece of equipment that failed to load. -
getTotalAmmoOfType
-
getTotalMunitionsOfType
Determine how much ammunition (of all munition types) remains which is compatible with the given weapon.- Parameters:
weapon
- The weapon being considered- Returns:
- the
int
count of the amount of shots of all munitions available for the given weapon.
-
getWeaponArc
public abstract int getWeaponArc(int weaponNumber) Returns the Rules.ARC that the weapon, specified by number, fires into.- Parameters:
weaponNumber
- integer equipment number, index from equipment list- Returns:
- arc the specified weapon is in
-
isSecondaryArcWeapon
public abstract boolean isSecondaryArcWeapon(int weaponId) Returns true if this weapon fires into the secondary facing arc. If false, assume it fires into the primary. -
getWeapons
-
getIndividualWeaponList
-
getWeaponList
-
getTotalWeaponList
-
getWeaponBayList
-
getWeaponGroupList
-
isWeaponValidForPhase
Returns true if the given weapon is valid for the current phase.- Parameters:
mounted
- The WeaponMounted to test- Returns:
- True if valid, else false
-
loadAllWeapons
public void loadAllWeapons()Attempts to load all weapons with ammo -
loadWeapon
Tries to load the specified weapon with the first available ammo -
loadWeaponWithSameAmmo
Tries to load the specified weapon with the first available ammo of the same munition type as currently in use. If this fails, use first ammo.If this is a weapon bay, try to load the weapon with ammo in the same bay, and if it fails, load with compatible ammo in the same location.
If this unit is part of a train, also check the vehicles directly connected to it for compatible ammo
-
loadWeapon
Tries to load the specified weapon with the specified ammo. Returns true if successful, false otherwise. -
loadWeaponWithSameAmmo
Tries to load the specified weapon with the specified ammo. Returns true if successful, false otherwise. -
weaponFired
public boolean weaponFired()- Returns:
- True when this unit has fired a weapon has been fired this turn.
-
weaponFiredFrom
public boolean weaponFiredFrom(int loc) - Returns:
- True when a weapon has been fired from the specified location this turn.
-
getAmmo
-
getAmmo
- Parameters:
weapon
- we want to find available ammo for- Returns:
- an ArrayList containing _one_ Mounted ammo for each viable type
-
getMisc
-
getBombs
-
getBombs
Returns a list of operable bombs with shots left and with the given flag (e.g. AmmoType.F_SPACE_BOMB)- Parameters:
flag
- The AmmoType bomb flag to search for- Returns:
- The list of found bombs
- See Also:
-
resetBombAttacks
protected void resetBombAttacks()Reset bomb attacks according to what bombs are available. -
removeMisc
Removes the first misc eq. whose name equals the specified string. Used for removing broken tree clubs. -
clearBombs
public void clearBombs()Clear all bombs and bomb attacks -
getClubs
-
hasWorkingMisc
Check if the entity has an arbitrary type of misc equipment- Parameters:
flag
- A MiscType.F_XXX- Returns:
- true if at least one ready item.
-
hasWorkingMisc
Check if the entity has an arbitrary type of misc equipment- Parameters:
flag
- A MiscType.F_XXXsecondary
- A MiscType.S_XXX or -1 for don't care- Returns:
- true if at least one ready item.
-
hasMisc
Returns true when the entity has a MiscType equipment with the given MiscTypeFlag, regardless of its state. Note that both the flags given in MiscType as well as the "actual" flags in MiscTypeFlag can be used.- Parameters:
flag
- The MiscTypeFlag flag to look for, e.g. F_VTOL_EQUIPMENT- Returns:
- True when the entity has a MiscType equipment with the given flag
- See Also:
-
hasMisc
Returns true when the entity has a MiscType equipment of the given internalName, regardless of its state. When available, use EquipmentTypeLookup internal names (or add one when it is not yet used for a MiscType). Note that any internal name, even of weapons, can be given but this method only searches misc equipment and will not find weapons.- Parameters:
internalName
- The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTER- Returns:
- True when the entity has a MiscType equipment of the given internalName
- See Also:
-
countMisc
Returns the number of MiscType equipment of the given internalName, regardless of state. When available, use EquipmentTypeLookup internal names (or add one when it is not yet used for a MiscType). Note that any internal name, even of weapons, can be given but this method only searches misc equipment and will not find weapons.- Parameters:
internalName
- The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTER- Returns:
- the number of MiscType equipment of the given internalName on the unit
- See Also:
-
hasMisc
Returns true when the entity has a MiscType equipment of the given internalName, regardless of its state, in the given location. When available, use EquipmentTypeLookup internal names (or add one when it is not yet used for a MiscType). Note that any internal name, even of weapons, can be given but this method only searches misc equipment and will not find weapons.- Parameters:
internalName
- The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTERlocation
- The location, e.g. Mek.LOC_LT- Returns:
- True when the entity has a MiscType equipment of the given internalName in the given location
- See Also:
-
getMiscEquipment
-
countEquipment
Returns the number of equipment of the given internal name that are mounted on this unit, regardless of their working condition. Ideally useEquipmentTypeLookup
for the internal name.- Parameters:
internalName
- TheEquipmentType.internalName
of the equipment- Returns:
- The equipment count on this unit
-
countWorkingMisc
return how many misc equipments with the specified flag the unit has- Parameters:
flag
-- Returns:
-
countWorkingMisc
-
countWorkingMisc
-
hasWorkingMisc
Check if the entity has an arbitrary type of misc equipment- Parameters:
name
- MiscType internal name- Returns:
- true if at least one ready item.
-
hasWorkingMisc
Check if the entity has an arbitrary type of misc equipment- Parameters:
flag
- A MiscType.F_XXXsecondary
- A MiscType.S_XXX or -1 for don't carelocation
- The location to check e.g. Mek.LOC_LARM- Returns:
- true if at least one ready item.
-
getCriticalSlots
Returns the CriticalSlots in the given location as a list. The returned list can be empty depending on the unit and the chosen slot but not null. The entries are not filtered in any way (could be null although that is probably an error in the internal representation of the unit.)- Parameters:
location
- The location, e.g. Mek.LOC_HEAD- Returns:
- A list of CriticalSlots in that location, possibly empty
-
hasUndamagedCriticalSlots
public boolean hasUndamagedCriticalSlots()- Returns:
- true if the entity has any critical slot that isn't damaged yet
-
hasSCM
public boolean hasSCM()- Returns:
- True when this unit has a RISC Super-Cooled Myomer System (even if the SCM is destroyed).
-
hasWorkingSCM
public boolean hasWorkingSCM()- Returns:
- True when this unit has an operable RISC Super-Cooled Myomer System.
-
damagedSCMCritCount
public int damagedSCMCritCount() -
scmCritStateCount
-
getHeatCapacity
public int getHeatCapacity()Returns the amount of heat that the entity can sink each turn. -
getHeatCapacity
public int getHeatCapacity(boolean radicalHeatSink) -
formatHeat
Pretty-prints the heat capacity of a unit, including optional heat sinking systems. Typically, this is equivalent togetHeatCapacity()
, but in the presence of Radical Heat Sinks, Coolant Pods, or the RISC Emergency Coolant System, produces strings like "24 [36]" or "12 [+MoS]".- Returns:
- The formatted heat capacity
-
getHeatCapacityWithWater
public int getHeatCapacityWithWater()- Returns:
- The amount of heat that the entity can sink each turn, factoring in whether the entity is standing in water.
-
getEngineCritHeat
public int getEngineCritHeat()- Returns:
- The extra heat generated by engine crits.
-
getCritical
Returns a critical hit slot -
setCritical
Sets a critical hit slot -
addCritical
Adds a critical to the first available slot in the location.- Returns:
- true if there was room for the critical
-
addCritical
Adds a critical to a critical slot, first trying the supplied slot number, and continuing from there if it's full- Parameters:
loc
- location on Unit.cs
-CriticalSlot
to checkslotNumber
- Slot to apply to.- Returns:
- true if there was room for the critical
-
addCritical
Attempts to set the given slot to the given critical. If the desired slot is full, adds the critical to the first available slot.- Returns:
- true if the crit was successfully added to any slot
-
removeCriticals
Removes all matching critical slots from the location -
getEmptyCriticals
public int getEmptyCriticals(int loc) Returns the number of empty critical slots in a location -
getHittableCriticals
public int getHittableCriticals(int loc) Returns the number of operational critical slots remaining in a location -
canTransferCriticals
public boolean canTransferCriticals(int loc) Returns true if this location should transfer criticals to the next location inwards. Checks to see that every critical in this location is either already totally destroyed (not just hit) or was never hittable to begin with. -
getGyroType
public int getGyroType()Only Meks have Gyros but this helps keep the code a bit cleaner.- Returns:
-1
-
getAllGyroCodeName
-
isGyroDestroyed
public boolean isGyroDestroyed()Only Meks have gyros, but this helps keep the code a bit cleaner.- Returns:
- true if the
Entity
is a Mek and has taken enough gyro hits to destroy it
-
getGoodCriticals
public int getGoodCriticals(int type, int index, int loc) Returns the number of operational critical slots of the specified type in the location -
getBadCriticals
public int getBadCriticals(int type, int index, int loc) The number of critical slots that are destroyed or breached in the location or missing along with it (if it was blown off). -
getDamagedCriticals
public int getDamagedCriticals(int type, int index, int loc) Number of slots damaged (but not breached) in a location -
getHitCriticals
public int getHitCriticals(int type, int index, int loc) Number of slots doomed, missing or destroyed in a location -
critStateCount
- Returns:
- the number of critical slots of the equipment given as index for
getEquipment(int)
in location loc wherein the type is the critical slot type that fit the slot state given as slotState Predicate such asCriticalSlot.isDestroyed()
. The critical slots tested are only those in location loc except for Super-Cooled Myomer where all locations are considered.
-
getNoOfSlots
protected abstract int[] getNoOfSlots() -
getNumberOfCriticals
public int getNumberOfCriticals(int loc) Returns the number of total critical slots in a location -
getNumberOfCriticals
public int getNumberOfCriticals(int type, int index, int loc) Returns the number of critical slots present in the section, destroyed or not. -
getNumberOfCriticals
Returns the number of critical slots present in the section, destroyed or not. -
getNumberOfCriticals
Returns the number of critical slots present in the Mek, destroyed or not. -
hasHipCrit
public boolean hasHipCrit()Returns true if the entity has a hip critical slot. Overridden by sub-classes. -
hasLegActuatorCrit
public boolean hasLegActuatorCrit()Returns true if the entity has a leg actuator critical slot -
hasWorkingSystem
public boolean hasWorkingSystem(int system, int loc) Returns true if there is at least 1 functional system of the type specified in the location -
hasSystem
public boolean hasSystem(int system, int loc) - Returns:
- true if the location has a system of the type, whether is destroyed or not
-
hasVibroblades
public boolean hasVibroblades()- Returns:
- True if this unit wields vibroblades
-
getActiveVibrobladeHeat
public int getActiveVibrobladeHeat(int location) - Parameters:
location
- The location to check- Returns:
- The heat generated by active vibroblades in the given location if this unit has any
-
getActiveVibrobladeHeat
public int getActiveVibrobladeHeat(int location, boolean ignoreMode) -
hasShield
public boolean hasShield()Does the Mek have any shields. a Mek can have up to 2 shields.- Returns:
true
ifshieldCount
is greater than 0 elsefalse
-
getNumberOfShields
public int getNumberOfShields(long size) Check to see how many shields of a certain size a mek has. you can have up to shields per Mek. However they can be of different size and each size has its own draw backs. So check each size and add modifiers based on the number shields of that size. -
hasActiveShield
public boolean hasActiveShield(int location, boolean rear) Does the Mek have an active shield This should only be called after hasShield has been called. -
hasActiveShield
public boolean hasActiveShield(int location) Does the Mek have an active shield This should only be called by hasActiveShield(location, rear) -
hasPassiveShield
public boolean hasPassiveShield(int location, boolean rear) Does the Mek have a passive shield This should only be called after hasShield has been called. -
hasPassiveShield
public boolean hasPassiveShield(int location) Does the Mek have a passive shield This should only be called by hasPassiveShield(location, rear) -
hasNoDefenseShield
public boolean hasNoDefenseShield(int location) Does the Mek have an shield in no defense mode -
hasUMU
public boolean hasUMU()This method checks to see if a unit has Underwater Maneuvering Units- Returns:
boolean
if the entity has usable UMU critical slots.
-
getActiveUMUCount
public int getActiveUMUCount()This counts the number of UMU's a Mek has that are still viable- Returns:
- number
int
of usable UMU's
-
getAllUMUCount
public int getAllUMUCount()This returns all UMU a Mek has.- Returns:
int
Total number of UMUs a Mek has.
-
hasActiveECM
public boolean hasActiveECM()Does the Mek have a functioning ECM unit? -
hasActiveECM
public boolean hasActiveECM(boolean stealth) check if we have an active ECM unit for stealth armor purposes- Parameters:
stealth
-- Returns:
-
hasECM
public boolean hasECM() -
hasGhostTargets
public boolean hasGhostTargets(boolean active) Does the Mek have a functioning ECM unit, tuned to ghost target generation? -
hasActiveECCM
public boolean hasActiveECCM()Checks to see if this entity has a functional ECM unit that is using ECCM.- Returns:
true
if the entity has AngeleCM and it is in ECCM modefalse
if the entity does not have angel ecm or it is not in eccm mode or it is damaged.
-
getECMRange
public int getECMRange()What's the range of the ECM equipment? Infantry can have ECM that just covers their own hex.- Returns:
- the
int
range of this unit's ECM. This value will beEntity.NONE
if no ECM is active.
-
hasBAP
public boolean hasBAP()Does the Mek have a functioning BAP? This is just for the basic BAP for Beagle BloodHound WatchDog Clan Active or Light. -
hasBAP
public boolean hasBAP(boolean checkECM) -
getBAPRange
public int getBAPRange()What's the range of the BAP equipment?- Returns:
- the
int
range of this unit's BAP. This value will beEntity.NONE
if no BAP is active.
-
hasDroneOs
public boolean hasDroneOs()Returns whether this entity has a Drone Operating System -
hasTargComp
public boolean hasTargComp()Returns whether or not this entity has a Targeting Computer. -
hasAimModeTargComp
public boolean hasAimModeTargComp()Returns whether or not this entity has a Targeting Computer that is in aimed shot mode. -
hasC3S
public boolean hasC3S()- Returns:
- True if this unit has a C3 Slave.
-
hasCASEII
public boolean hasCASEII()True if the unit has CASE II (on any location in the case of Meks). Only Meks and Fighters can have CASE II so all other entities should return false.- Returns:
- True if the unit has CASE II
-
hasCASEII
public boolean hasCASEII(int location) True if the unit has CASE II in the given location. Only Meks and Fighters can have CASE II so all other entities should return false.- Parameters:
location
- The location to check- Returns:
- True if the unit has CASE II in the given location
-
hasHarJelIn
public boolean hasHarJelIn(int location) Does this entity have an undamaged HarJel system in this location? (Type-dependent, defaults to false.) Does not include Harjel II or Harjel III, as they do not prevent breach checks like Harjel does.- Parameters:
location
- theint
location to check- Returns:
- a
boolean
value indicating a present HarJel system
-
hasBoostedC3
public boolean hasBoostedC3() -
hasC3M
public boolean hasC3M()Checks if the entity has a C3 Master.- Returns:
- true if it has a working C3M computer and has a master.
-
hasC3MM
public boolean hasC3MM() -
hasC3
public boolean hasC3()- Returns:
- True if this unit has any type of standard C3 computer (not C3i), TM p.209.
-
hasActiveNovaCEWS
public boolean hasActiveNovaCEWS()- Returns:
- True if this unit is not off board nor shutdown and has a Nova CEWS that is not offline.
-
hasNovaCEWS
public boolean hasNovaCEWS()- Returns:
- True if this unit is not off board nor shutdown and has a Nova CEWS that is not offline.
-
hasC3i
public boolean hasC3i() -
hasNhC3
public boolean hasNhC3()Returns true if the unit has a non hierarchic C3 system (C3i, NC3 or Nova CEWS). -
hasHierarchicalC3
public boolean hasHierarchicalC3()Checks if the unit has a hierarchic C3 system. (Inverse ofhasNhC3()
- Returns:
true
if the unit has a C3 system that is not a C3i, NC3 or Nova CEWS.
-
hasAnyC3System
public boolean hasAnyC3System()Returns true if the unit has a standard C3M/S, a Naval C3 or C3i or a Nova CEWS. -
getC3NetId
-
getOriginalNovaC3NetId
-
newRoundNovaNetSwitch
public void newRoundNovaNetSwitch()Switches the C3 network Id to the new network ID. -
setNewRoundNovaNetworkString
Set the C3 network ID to be used on the next turn. Used for reconfiguring a C3 network with Nova CEWS.- Parameters:
str
-
-
getNewRoundNovaNetworkString
- Returns:
- C3 network id that will be switched to on the next turn.
-
setC3NetId
-
setC3NetIdSelf
public void setC3NetIdSelf() -
setC3NetId
Explicitly set the C3 Net ID using a string.- Parameters:
c3NetId
- string value the id should be set to- See Also:
-
calculateFreeC3MNodes
public int calculateFreeC3MNodes()Determine the remaining number of other C3 Master computers that can connect to thisEntity
.Please note, if this
Entity
does not have two C3 Master computers, then it must first be identified as a company commander; otherwise the number of free nodes will be zero.- Returns:
- a non-negative
int
value.
-
calculateFreeC3Nodes
public int calculateFreeC3Nodes()Determine the remaining number of other C3 computers that can connect to thisEntity
.Please note, if this
Entity
has two C3 Master computers, then this function only returns the remaining number of C3 Slave computers that can connect.- Returns:
- a non-negative
int
value.
-
getC3Top
- Returns:
- the entity "above" this entity in our c3 network, or this entity itself, if none is above this
-
getC3Master
Return the unit that is current master of this unit's C3 network. If the master unit has been destroyed or had it's C3 master computer damaged, then this unit is out of the C3 network for the rest of the game. If the master unit has shut down, then this unit may return to the C3 network at a later time.- Returns:
- the
Entity
that is the master of this unit's C3 network. This value may benull
. If the value master unit has shut down, then the value will be non-null
after the master unit restarts.
-
getC3MasterId
public int getC3MasterId()Get the ID of the master unit in this unit's C3 network. If the master unit has shut down, then the ID will still be returned. The only times when the value,Entity.NONE
is returned is when this unit is permanently out of the C3 network, or when it was never in a C3 network.- Returns:
- the
int
ID of the unit that is the master of this unit's C3 network, orEntity.NONE
.
-
C3MasterIs
Determines if the passedEntity
is the C3 Master of this unit.Please note, that when an
Entity
is it's own C3 Master, then it is a company commander.Also note that when
null
is the master for thisEntity
, then it is an independent master.- Parameters:
e
- - theEntity
that may be this unit's C3 Master.- Returns:
- a
boolean
that istrue
when the passedEntity
is this unit's commander. If the passed unit isn't this unit's commander, this routine returnsfalse
.
-
setC3Master
Set anotherEntity
as C3 Master. Pass (null, true) to disconnect the entity from a C3 network that isn't its own (C3 Net id with its own id).- Parameters:
e
- - theEntity
that should be set as our C3 Master.
-
setC3Master
public void setC3Master(int entityId, boolean reset) - Parameters:
entityId
-
-
onSameC3NetworkAs
-
onSameC3NetworkAs
Checks if another entity is on the same c3 network as this entity- Parameters:
e
- TheEntity
to check against this entityignoreECM
- aboolean
indicating if ECM should be ignored, we need this for c3i- Returns:
- a
boolean
that istrue
if the given entity is on the same network,false
if not.
-
locationHasCase
public boolean locationHasCase(int loc) Returns whether there is CASE protecting the location. -
hasCase
public boolean hasCase()Returns whether there is CASE anywhere on thisEntity
. -
hitAllCriticals
public void hitAllCriticals(int loc, int slot) Hits all critical slots of the system occupying the specified critical slot. Used, for example, in a gauss rifle capacitor discharge. Does not apply any special effect of hitting the critical slots, like ammo explosion. -
newRound
public void newRound(int roundNumber) Start a new round- Specified by:
newRound
in interfaceRoundUpdated
- Parameters:
roundNumber
- theint
number of the new round
-
applyDamage
public void applyDamage()Applies any damage that the entity has suffered. When anything gets hit it is simply marked as "hit" but does not stop working until this is called. -
reloadEmptyWeapons
public void reloadEmptyWeapons()Attempts to reload any empty weapons with the first ammo found -
getActiveAMS
- Returns:
- currently operable AMS mounted in this Entity.
-
assignTMAMS
Assign AMS systems to an incoming telemissile attack. This allows AMS bays to work against these modified physical attacks. -
assignAMS
Assign AMS systems to the most dangerous incoming missile attacks. This should only be called once per turn, or AMS will get extra attacks -
isNarcedBy
public boolean isNarcedBy(int nTeamID) has the team attached a narc pod to me? -
attachNarcPod
add a narc pod from this team to the Mek. Non-removable- Parameters:
pod
- TheNarcPod
to be attached.
-
attachINarcPod
attach an iNarcPod- Parameters:
pod
- TheINarcPod
to be attached.
-
isINarcedBy
public boolean isINarcedBy(int nTeamID) Have we been iNarced with a homing pod from that team?- Parameters:
nTeamID
- The id of the team that we are wondering about.- Returns:
- true if the Entity is narced by that team.
-
isINarcedWith
public boolean isINarcedWith(long type) Have we been iNarced with the named pod from any team?- Parameters:
type
- theint
type of iNarc pod.- Returns:
true
if we have.
-
removeAllINarcPods
public void removeAllINarcPods()Remove all attached iNarc Pods -
hasINarcPodsAttached
public boolean hasINarcPodsAttached()Returns true if any iNarc pods are attached to this unit. -
hasNarcPodsAttached
public boolean hasNarcPodsAttached()Returns true if any Narc pods are attached to this unit. (Ignores iNarc) -
hasAnyTypeNarcPodsAttached
public boolean hasAnyTypeNarcPodsAttached()Returns true if any Narc or iNarc pods are attached to this unit. -
getINarcPodsAttached
Get anEnumeration
ofINarcPod
s that are attached to this entity.- Returns:
- an
Enumeration
ofINarcPod
s.
-
removeINarcPod
Remove anINarcPod
from this entity.- Parameters:
pod
- theINarcPod
to be removed.- Returns:
true
if the pod was removed,false
if the pod was not attached to this entity.
-
calculateBattleValue
public final int calculateBattleValue()Calculates the Battle Value of this unit. Both C3 and crew skill based changes to the BV are taken into account. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value.- Returns:
- The full Battle Value of this unit including C3 and crew skill modifications or the manual BV in case this unit uses a manual BV value
-
calculateBattleValue
public final int calculateBattleValue(boolean ignoreC3, boolean ignoreSkill) Calculates the Battle Value of this unit. The parameters can be used to control C3 / skill-based changes to the BV. When both are true, the "base" BV of the unit is calculated. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value.- Parameters:
ignoreC3
- When true, the BV contributions of any C3 computers are not addedignoreSkill
- When true, the skill of the crew / pilot is not taken into account for BV- Returns:
- The Battle Value of this unit
-
calculateBattleValue
Calculates the Battle Value of this unit. Both C3 and crew skill based changes to the BV are taken into account. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value and no calculation report info will be generated.- Parameters:
calculationReport
- A CalculationReport to write the BV calculation to- Returns:
- The full Battle Value of this unit including C3 and crew skill modifications or the manual BV in case this unit uses a manual BV value
-
calculateBattleValue
public int calculateBattleValue(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport) Calculates the Battle Value of this unit. The parameters can be used to control C3 / skill-based changes to the BV. When both are true, the "base" BV of the unit is calculated. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value and no calculation report info will be generated.- Parameters:
ignoreC3
- When true, the BV contributions of any C3 computers are not addedignoreSkill
- When true, the skill of the crew / pilot is not taken into account for BVcalculationReport
- A CalculationReport to write the BV calculation to- Returns:
- The Battle Value of this unit
-
doBattleValueCalculation
protected int doBattleValueCalculation(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport) Calculates and returns the Battle Value of this unit taking into account the parameters. This method should be overridden by subclasses of Entity to provide a unit type specific calculation of the Battle Value. A report of the calculation should be written to the given calculationReport.- Parameters:
ignoreC3
- When true, the BV contributions of any C3 computers are not addedignoreSkill
- When true, the skill of the crew / pilot is not taken into account for BVcalculationReport
- A CalculationReport to write the BV calculation to- Returns:
- The Battle Value of this unit calculated from its current state
-
getGenericBattleValue
public abstract int getGenericBattleValue()Calculates a "generic" Battle Value that is based on the average of all units of this type and tonnage. The purpose of this generic Battle Value is to allow a comparison of this unit's actual BV to that for units of its class. This can be used to balance forces without respect to unit or pilot quality.The generic BV values are calculated by a statistical elasticity model based on all data from the MegaMek database.
- Returns:
- The generic Battle value for this unit based on its tonnage and type
-
victoryReport
Generates a vector containing reports on all useful information about this entity. -
equals
Two entities are equal if their ids are equal- Specified by:
equals
in interfaceTargetable
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceTargetable
- Overrides:
hashCode
in classObject
-
getMovementMode
Get the movement mode of the entity -
getMovementModeAsString
Get the movement mode of the entity as a String. -
setMovementMode
Set the movement type of the entity -
entityIsQuad
public boolean entityIsQuad()Helper function to determine if a entity is a quad -
needsRollToStand
public boolean needsRollToStand()Returns true is the entity needs a roll to stand up -
getBasePilotingRoll
Returns an entity's base piloting skill roll needed Only use this version if the entity is through processing movement -
getBasePilotingRoll
Returns an entity's base piloting skill roll needed -
addEntityBonuses
Add in any piloting skill mods -
addConditionBonuses
Add in any modifiers due to global conditions like light/weather/etc. -
checkGetUp
Checks if the entity is getting up. If so, returns the target roll for the piloting skill check. -
checkRunningWithDamage
Checks if the entity is attempting to run with damage that would force a PSR. If so, returns the target roll for the piloting skill check. -
checkSprintingWithMASCXorSupercharger
public PilotingRollData checkSprintingWithMASCXorSupercharger(EntityMovementType overallMoveType, int used) Checks if the entity is attempting to sprint with MASC or Supercharger engaged (but not both). If so, returns the target roll for the piloting skill check. -
checkSprintingWithMASCAndSupercharger
public PilotingRollData checkSprintingWithMASCAndSupercharger(EntityMovementType overallMoveType, int used) Checks if the entity is attempting to sprint with MASC and supercharger engaged. If so, returns the target roll for the piloting skill check. -
checkUsingOverdrive
Checks if the entity is attempting to sprint with supercharger engaged. If so, returns the target roll for the piloting skill check. -
checkGunningIt
Checks if the entity is attempting to increase two speed categories. If so, returns the target roll for the piloting skill check. -
checkRecklessMove
public PilotingRollData checkRecklessMove(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, Hex prevHex) Checks if an entity is passing through certain terrain while not moving carefully -
checkLandingWithDamage
Checks if the entity is landing (from a jump) with damage that would force a PSR. If so, returns the target roll for the piloting skill check. -
checkLandingWithPrototypeJJ
Checks if the entity is landing (from a jump) with a prototype JJ If so, returns the target roll for the piloting skill check. -
checkLandingInHeavyWoods
Checks if an entity is landing (from a jump) in heavy woods. -
checkLandingOnIce
Checks if the entity is landing (from a jump) on ice-covered water. -
checkLandingOnBlackIce
Checks if the entity is landing (from a jump) on black ice. -
checkMovedTooFast
- Parameters:
step
-- Returns:
PilotingRollData
checking for whether this Entity moved too fast due to low gravity
-
checkSkid
public PilotingRollData checkSkid(EntityMovementType moveType, Hex prevHex, EntityMovementType overallMoveType, MoveStep prevStep, MoveStep currStep, int prevFacing, int curFacing, Coords lastPos, Coords curPos, boolean isInfantry, int distance) Checks if the entity might skid. If so, returns the target roll for the piloting skill check. -
checkRubbleMove
public PilotingRollData checkRubbleMove(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, boolean isLastStep, boolean isPavementStep) Checks if the entity is moving into rubble. If so, returns the target roll for the piloting skill check. -
checkBogDown
public PilotingRollData checkBogDown(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, int lastElev, boolean isPavementStep) Checks if the entity is moving into a hex that might cause it to bog down. If so, returns the target roll for the piloting skill check. -
checkWaterMove
public PilotingRollData checkWaterMove(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, boolean isPavementStep) Checks if the entity is moving into depth 1+ water. If so, returns the target roll for the piloting skill check. -
checkWaterMove
Checks if the entity is moving into depth 1+ water. If so, returns the target roll for the piloting skill check. -
checkDislodgeSwarmers
Checks if the entity is being swarmed. If so, returns the target roll for the piloting skill check to dislodge them. -
checkMovementInBuilding
Checks to see if an entity is moving through building walls. Note: this method returns true/false, unlike the other checkStuff() methods above.- Returns:
- 0, no eligible building; 1, exiting; 2, entering; 3, both; 4, stepping on roof, 8 changing elevations within a building
-
rollMovementInBuilding
public PilotingRollData rollMovementInBuilding(Building bldg, int distance, String why, EntityMovementType overallMoveType) Calculates and returns the roll for an entity moving in buildings. -
usesTurnMode
public boolean usesTurnMode()Only check for satisfied turn mode for Tanks or QuadVees in vehicle mode, or LAMs in AirMek mode. Except for LAMs, check whether advanced vehicle ground movement is enabled.- Returns:
- True if this
Entity
must make a driving check for turning too sharply.
-
checkTurnModeFailure
public PilotingRollData checkTurnModeFailure(EntityMovementType overallMoveType, int straightLineHexes, int mpUsed, Coords currPos) If using advanced vehicle ground movement, checks whether the unit is required to make a driving roll for turning, and if so whether it succeeds.- Parameters:
overallMoveType
- The type move movement used this turn.straightLineHexes
- The number of hexes that were moved in a straight line before turning.mpUsed
- The total number of movement points used by the entity during the current turn.currPos
- The position of the hex where the turn is taking place, which may modify a roll for terrain.- Returns:
- True if the entity failed a driving check due to turning too sharply.
-
getMovementBeforeSkidPSRModifier
public int getMovementBeforeSkidPSRModifier(int distance) Calculate the piloting skill roll modifier, based upon the number of hexes moved this phase. Used for skidding. -
getMaxElevationChange
public abstract int getMaxElevationChange()The maximum elevation change the entity can cross -
getMaxElevationDown
public int getMaxElevationDown()by default, entities can move as far down as they can move up -
getMaxElevationDown
public int getMaxElevationDown(int currElevation) Returns the maximum number of downward elevation changes a unit can make. For some units (namely, WiGEs), this can depend upon their current elevation (since elevation determines if the WiGEs is using WiGE movement or not).- Parameters:
currElevation
-- Returns:
-
addTransporter
Add a transportation component to this Entity. Please note, this method should only be called during this entity's construction.- Parameters:
component
- - One of this new entity'sTransporter
s.
-
addTransporter
Add a transportation component to this Entity. Please note, this method should only be called during this entity's construction.- Parameters:
component
- - One of this new entity'sTransporter
s.isOmniPod
- - Whether this is part of an omni unit's pod space.
-
removeTransporter
-
removeAllTransporters
public void removeAllTransporters()Remove all transportation components from this Entity. Should probably only be called during construction. -
canLoad
Determines if this object can accept the given unit. The unit may not be of the appropriate type or there may be no room for the unit.- Parameters:
unit
- - theEntity
to be loaded.- Returns:
true
if the unit can be loaded,false
otherwise.
-
canLoad
Description copied from interface:Transporter
Determines if this object can accept the given unit. The unit may not be of the appropriate type or there may be no room for the unit.- Specified by:
canLoad
in interfaceTransporter
- Parameters:
unit
- - theEntity
to be loaded.- Returns:
true
if the unit can be loaded,false
otherwise.
-
load
Load the given unit.- Parameters:
unit
- - theEntity
to be loaded.- Throws:
IllegalArgumentException
- If the unit can't be loaded
-
load
Load the given unit.- Parameters:
unit
- the Entity to be loaded.checkElev
- When true, only allows the load if both units are at the same elevation- Throws:
IllegalArgumentException
- If the unit can't be loaded
-
load
Load the given unit.- Parameters:
unit
- the Entity to be loaded.bayNumber
- The bay to load into- Throws:
IllegalArgumentException
- If the unit can't be loaded
-
load
Load the given unit, checking if the elevation of both units is the same.- Specified by:
load
in interfaceTransporter
- Parameters:
unit
- the Entity to be loaded.- Throws:
IllegalArgumentException
- If the unit can't be loaded
-
recover
Recover the given unit. Only for ASF and Small Craft- Parameters:
unit
- - theEntity
to be loaded.- Throws:
IllegalArgumentException
- If the unit can't be loaded
-
updateBays
public void updateBays()cycle through and update Bays -
damageBayDoor
Damages a randomly determined bay door on the entity, if one exists -
damageDoorRecovery
damage the door of the first bay that can load this unit -
damageDockCollar
public boolean damageDockCollar()Damages a randomly determined docking collar on the entity, if one exists.- Returns:
- true if a docking collar was found, false otherwise
-
pickUp
-
getLoadedUnits
Get aList
of the units currently loaded into this payload.- Specified by:
getLoadedUnits
in interfaceTransporter
- Returns:
- A
List
of loadedEntity
units. This list will never benull
, but it may be empty. The returnedList
is independent from the under- lying data structure; modifying one does not affect the other.
-
getDocks
public int getDocks()- Returns:
- the number of docking collars
-
getDocks
public int getDocks(boolean forCost) - Parameters:
forCost
- Whether this value is being used for cost calculations, in which case drop shuttle bays count as two collars.- Returns:
- The number of docking collars
-
getBayLoadedUnitIds
- Returns:
- list of the Ids of entities stored in bays. Used by MHQ in cases where we can't get the entities via Game
-
getBay
- Parameters:
loaded
-- Returns:
- bay that the given entity is loaded into
-
getBayById
-
getCollarById
Returns the DockingCollar with the given ID or null if this unit doesn't have such a Docking Collar.- Returns:
- the DockingCollar with the given ID or null
-
getLaunchableFighters
- Returns:
- only entities in ASF Bays that can be launched (i.e. not in recovery)
-
getDroppableUnits
- Returns:
- only entities in that can be combat dropped
-
getUnitsUnloadableFromBays
- Returns:
- All Entities that can at this point be unloaded from any of the bays of this Entity. This does not include any units that were loaded this turn or any bays where the door capacity has been exceeded this turn. Note that the returned list may be unmodifiable.
- See Also:
-
getUnitsUnloadableFromNonBays
- Returns:
- All Entities that can at this point be unloaded from any transports of this Entity which are not Bays. This does not include any units that were loaded this turn. Note that the returned list may be unmodifiable.This shouldn't return towed entities, they're tracked separately.
- See Also:
-
getUnloadableUnits
- Returns:
- All Entities that can at this point be unloaded from any transports of this Entity. This does not include any units that were loaded this turn nor units from bays where the door capacity has been exceeded this turn.
- See Also:
-
getFighterBays
- Returns:
- get the bays separately
-
getDockingCollars
Returns a list of all Docking Collars (Hard points) of this unit.- Returns:
- a list of all Docking Collars.
-
getTransports
- Returns:
- A vector of Transporter objects this unit uses/has
-
isPodMountedTransport
-
getTransportBays
-
resetBayDoors
public void resetBayDoors()do any damage to bay doors -
resetBays
public void resetBays() -
getLaunchableSmallCraft
-
getLaunchableDropships
Returns a list of DropShips launchable from any of the Transport facilities of this unit. The list may be empty but not null.- Returns:
- A list of launchable DropShips.
-
unload
Description copied from interface:Transporter
Unload the given unit.- Specified by:
unload
in interfaceTransporter
- Parameters:
unit
- - theEntity
to be unloaded.- Returns:
true
if the unit was contained in this space,false
otherwise.
-
resetTransporter
public void resetTransporter()Description copied from interface:Transporter
clear out all troops listed in the transporter. Used by MHQ to reset units after game- Specified by:
resetTransporter
in interfaceTransporter
-
getUnusedString
Description copied from interface:Transporter
Return a string that identifies the unused capacity of this transporter.- Specified by:
getUnusedString
in interfaceTransporter
- Returns:
- A
String
meant for a human.
-
getUnused
public double getUnused()- Specified by:
getUnused
in interfaceTransporter
- Returns:
- the number of unused spaces in this transporter.
-
getUnused
Returns the current amount of cargo space for an entity of the given type.- Parameters:
e
- An entity that defines the unit class- Returns:
- The number of units of the given type that can be loaded in this Entity
-
getUnusedString
Return a string that identifies the unused capacity of this transporter.- Returns:
- A
String
meant for a human.
-
isWeaponBlockedAt
public boolean isWeaponBlockedAt(int loc, boolean isRear) Description copied from interface:Transporter
Determine if transported units prevent a weapon in the given location from firing.- Specified by:
isWeaponBlockedAt
in interfaceTransporter
- Parameters:
loc
- the location attempting to fire.isRear
- true if the weapon is rear-facing- Returns:
- True if a transported unit is in the way, false if the weapon can fire.
-
getExteriorUnitAt
Description copied from interface:Transporter
If a unit is being transported on the outside of the transporter, it can suffer damage when the transporter is hit by an attack. Currently, no more than one unit can be at any single location; that same unit can be "spread" over multiple locations.- Specified by:
getExteriorUnitAt
in interfaceTransporter
- Parameters:
loc
- - theint
location hit by attack.isRear
- - aboolean
value stating if the given location is rear facing; iffalse
, the location is front facing.- Returns:
- The
Entity
being transported on the outside at that location. This value will benull
if no unit is transported on the outside at that location.
-
getExternalUnits
- Specified by:
getExternalUnits
in interfaceTransporter
- Returns:
- list of all units carried externally by this transporter
-
getCargoMpReduction
- Specified by:
getCargoMpReduction
in interfaceTransporter
- Returns:
- the MP reduction due to cargo carried by this transporter
-
getTrooperAtLocation
-
setTransportId
public void setTransportId(int transportId) Record the ID of theEntity
that has loaded this unit. A unit that is unloaded can neither move nor attack for the rest of the turn.- Parameters:
transportId
- - theint
ID of our transport. The ID is not validated. This value should beEntity.NONE
if this unit has been unloaded.
-
getBayPersonnel
public int getBayPersonnel()- Returns:
- The number of additional crew capacity provided by quarters in transport bays.
-
getTransportId
public int getTransportId()Get the IDEntity
that has loaded this one.- Returns:
- the
int
ID of our transport. The ID may be invalid. This value should beEntity.NONE
if this unit has not been loaded.
-
isStealthActive
public boolean isStealthActive()Determine if this unit has an active and working stealth system.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a stealth system that is currently active and it's actually working,false
if there is no stealth system or if it is inactive.
-
isStealthOn
public boolean isStealthOn()Determine if this unit has an active and working stealth system.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a stealth system that is currently active and it's actually working,false
if there is no stealth system or if it is inactive.
-
isNullSigActive
public boolean isNullSigActive()Determine if this unit has an active null-signature system.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a null signature system that is currently active,false
if there is no stealth system or if it is inactive.
-
isNullSigOn
public boolean isNullSigOn()Determine if this unit has an active null-signature system.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a null signature system that is currently active,false
if there is no stealth system or if it is inactive.
-
isVoidSigActive
public boolean isVoidSigActive()Determine if this unit has an active void signature system that is providing its benefits.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a void signature system that is currently active,false
if there is no stealth system or if it is inactive.
-
isVoidSigOn
public boolean isVoidSigOn()Determine if this unit has an active void signature system.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a void signature system that is currently active,false
if there is no stealth system or if it is turned off.
-
isChameleonShieldActive
public boolean isChameleonShieldActive()Determine if this unit has an active chameleon light polarization field.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a void signature system that is currently active,false
if there is no stealth system or if it is inactive.
-
isChameleonShieldOn
public boolean isChameleonShieldOn()Determine if this unit has an active chameleon light polarization field.Sub-classes are encouraged to override this method.
- Returns:
true
if this unit has a void signature system that is currently active,false
if there is no stealth system or if it is inactive.
-
getStealthModifier
Determine the stealth modifier for firing at this unit from the given range. If the value supplied forrange
is not one of theEntity
class range constants, anIllegalArgumentException
will be thrown.Sub-classes are encouraged to override this method.
- Parameters:
range
- - anint
value that must match one of theCompute
class range constants.ae
- - the entity making the attack, who maybe immune to certain kinds of stealth- Returns:
- a
TargetRoll
value that contains the stealth modifier for the given range.
-
setSwarmTargetId
public void setSwarmTargetId(int id) Record the ID of theEntity
that is the current target of a swarm attack by this unit. A unit that stops swarming can neither move nor attack for the rest of the turn.- Parameters:
id
- - theint
ID of the swarm attack's target. The ID is not validated. This value should beEntity.NONE
if this unit has stopped swarming.
-
getSwarmTargetId
public int getSwarmTargetId()Get the ID of theEntity
that is the current target of a swarm attack by this unit.- Returns:
- the
int
ID of the swarm attack's target The ID may be invalid. This value should beEntity.NONE
if this unit is not swarming.
-
setSwarmAttackerId
public void setSwarmAttackerId(int id) Record the ID of theEntity
that is attacking this unit with a swarm attack.- Parameters:
id
- - theint
ID of the swarm attack's attacker. The ID is not validated. This value should beEntity.NONE
if the swarm attack has ended.
-
getSwarmAttackerId
public int getSwarmAttackerId()Get the ID of theEntity
that is attacking this unit with a swarm attack.- Returns:
- the
int
ID of the swarm attack's attacker The ID may be invalid. This value should beEntity.NONE
if this unit is not being swarmed.
-
hasInfernoAmmo
public boolean hasInfernoAmmo()Scans through the ammo on the unit for any inferno rounds.- Returns:
true
if the unit is still loaded with Inferno rounds.false
if no rounds were ever loaded or if they have all been fired.
-
antiTSMVulnerable
public boolean antiTSMVulnerable()Check for vulnerability to anti-TSM munitions. ATSM affects Meks with prototype TSM and any industrial TSM created before 3050, and conventional infantry with TSM implants.- Returns:
- Whether the unit is affected by ATSM munitions
-
setSalvage
public void setSalvage(boolean canSalvage) Record if the unit is just combat-lossed or if it has been utterly destroyed.- Parameters:
canSalvage
- - aboolean
that istrue
if the unit can be repaired (given time and parts); if this value isfalse
, the unit is utterly destroyed.
-
isSalvage
public boolean isSalvage()Determine if the unit is just combat-lossed or if it has been utterly destroyed.- Returns:
- A
boolean
that istrue
if the unit has salvageable components; if this value isfalse
the unit is utterly destroyed. - See Also:
-
isRepairable
public boolean isRepairable()Determine if the unit can be repaired, or only harvested for spares.- Returns:
- A
boolean
that istrue
if the unit can be repaired (given enough time and parts); if this value isfalse
, the unit is only a source of spares. - See Also:
-
getRemovalCondition
public int getRemovalCondition()Getter for property removalCondition.- Returns:
- Value of property removalCondition.
-
setRemovalCondition
public void setRemovalCondition(int removalCondition) Setter for property removalCondition.- Parameters:
removalCondition
- New value of property removalCondition.
-
isClearingMinefield
public boolean isClearingMinefield()- Returns:
- whether this entity is clearing a minefield.
-
setClearingMinefield
public void setClearingMinefield(boolean clearingMinefield) -
isSpotting
public boolean isSpotting()- Returns:
- True if this entity is spotting this round.
-
setSpotting
public void setSpotting(boolean spotting) Sets if this unit is spotting this round.- Parameters:
spotting
- True if this unit is to be set as spotting
-
canSpot
public boolean canSpot()Um, basically everything can spot for LRM indirect fire. Except for off-board units, units that sprinted, and units evading.- Returns:
- true, if the entity is eligible to spot
-
toString
-
statusToString
This returns a textual description of the entity for visually impaired users. -
statusToString
This returns a textual description of a specific location of the entity for visually impaired users.- Parameters:
loc
- the location- Returns:
- a string describing the status of the location.
-
statusToString
- Parameters:
str
- a string defining the location- Returns:
- the status of the given location.
-
setDeployRound
public void setDeployRound(int deployRound) The round the unit will be deployed. We will deploy at the end of a round. So if deployRound is set to 5, we will deploy when round 5 is over.- Parameters:
deployRound
- an int
-
getDeployRound
public int getDeployRound()The round the unit will be deployed- Specified by:
getDeployRound
in interfaceDeployable
- Returns:
- an int
-
setDeployed
public void setDeployed(boolean deployed) Toggles if an entity has been deployed -
isDeployed
public boolean isDeployed()Checks to see if an entity has been deployed- Specified by:
isDeployed
in interfaceDeployable
-
wasNeverDeployed
public boolean wasNeverDeployed()Checks to see if entity was never deployed -
setNeverDeployed
public void setNeverDeployed(boolean neverDeployed) Toggles if an entity has been deployed -
shouldDeploy
public boolean shouldDeploy(int round) Returns true if the entity should be deployed -
shouldOffBoardDeploy
public boolean shouldOffBoardDeploy(int round) Returns true if the off board entity should be deployed this round.- Parameters:
round
- The current round number.- Returns:
- True if and only if the off board entity should deploy this round, otherwise false.
-
setUnitNumber
public void setUnitNumber(short unit) Set the unit number for this entity.- Parameters:
unit
- the number for the low-level unit that this entity belongs to. This entity can be removed from its unit by passing the value,
.BTObject.NONE
-
getUnitNumber
public short getUnitNumber()Get the unit number of this entity.- Returns:
- The unit number. If the entity does not belong to a unit,
will be returned.BTObject.NONE
-
canFlee
public final boolean canFlee()Returns true when this unit can flee from its current position. This requires the unit to have mobility and be in control as well as its position being eligible for fleeing. When no special flee area is set by a scenario, the latter will typically be true when the unit is at the edge of its board. The position of units with a null position as well as offboard units are considered to be eligible for fleeing.- Returns:
- True when the unit can flee given its position and status
-
canFlee
Returns true when this unit can flee from the given position. This requires the unit to have mobility and be in control as well as the position being eligible for fleeing. When no special flee area is set by a scenario, the latter will typically be true when the position is at the edge of its board. A null position as well as offboard units are considered to be eligible for fleeing.- Returns:
- True when the unit can flee from the given position, given its current status
-
setEverSeenByEnemy
public void setEverSeenByEnemy(boolean b) -
isEverSeenByEnemy
public boolean isEverSeenByEnemy() -
setVisibleToEnemy
public void setVisibleToEnemy(boolean b) -
isVisibleToEnemy
public boolean isVisibleToEnemy() -
setDetectedByEnemy
public void setDetectedByEnemy(boolean b) -
isDetectedByEnemy
public boolean isDetectedByEnemy() -
addBeenSeenBy
-
getWhoCanSee
-
setWhoCanSee
-
clearSeenBy
public void clearSeenBy() -
hasSeenEntity
Returns true if the given player can see this Entity, including teammates if team_vision is on. -
addBeenDetectedBy
-
getWhoCanDetect
-
setWhoCanDetect
-
clearDetectedBy
public void clearDetectedBy() -
hasDetectedEntity
- Returns:
- true if the given player can see this Entity, including teammates if team_vision is on.
-
isSensorReturn
Returns whether this Entity is a sensor return to the given player.- Parameters:
spotter
- The player trying to view this unit- Returns:
- True if the given player can only see this Entity as a sensor return
-
applyGravityEffectsOnMP
protected int applyGravityEffectsOnMP(int MP) -
canCharge
public boolean canCharge()- Returns:
- Whether this type of unit can perform charges
-
canDFA
public boolean canDFA()- Returns:
- Whether this type of unit can perform DFA attacks
-
canRam
public boolean canRam()- Returns:
- Whether this type of unit can perform Ramming attacks
-
isUsingManAce
public boolean isUsingManAce() -
getKills
-
getKillNumber
public int getKillNumber() -
addKill
-
getGaveKillCredit
public boolean getGaveKillCredit() -
getKillerId
public int getKillerId() -
isEligibleFor
Determines if an entity is eligible for a phase. -
canAssist
Determines if an entity is eligible for a phase. Called only if at least one entity returned true to isEligibleFor() This is for using searchlights in physical and off board phase, without forcing the phase to be played when not needed. However, it could be used for other things in the future -
isEligibleForFiring
public boolean isEligibleForFiring()An entity is eligible for firing if it's not taking some kind of action that prevents it from firing, such as a full-round physical attack or sprinting. -
isEligibleForMovement
public boolean isEligibleForMovement()Pretty much anybody's eligible for movement. If the game option is toggled on, inactive and immobile entities are not eligible. OffBoard units are always ineligible- Returns:
- whether or not the entity is allowed to move
-
isEligibleForOffboard
public boolean isEligibleForOffboard() -
isAttackingThisTurn
public boolean isAttackingThisTurn() -
isEligibleForPhysical
public boolean isEligibleForPhysical()Check if the entity has any valid targets for physical attacks. -
isEligibleForArtyAutoHitHexes
public boolean isEligibleForArtyAutoHitHexes()- Returns:
- True if this Entity is eligible to pre-designate hexes as auto-hits. Per TacOps pg 180, if a player has off board artillery they get 5 pre-designated hexes per map sheet.
-
isEligibleForTargetingPhase
public boolean isEligibleForTargetingPhase() -
getTroopCarryingSpace
public double getTroopCarryingSpace() -
getPodMountedTroopCarryingSpace
public double getPodMountedTroopCarryingSpace() -
hasBattleArmorHandles
public boolean hasBattleArmorHandles() -
isOffBoard
public boolean isOffBoard()- Specified by:
isOffBoard
in interfaceTargetable
- Returns:
- if this is off the board
-
setOffBoard
Set the unit as an off board deployment. If a non-zero distance is chosen, the direction must not beEntity.NONE
. If a direction other thanEntity.NONE
is chosen, the distance must not be zero (0).- Parameters:
distance
- theint
distance in hexes that the unit will be deployed from the board; this value must not be negative.direction
- theint
direction from the board that the unit will be deployed; a valid value must be selected from: NONE, NORTH, SOUTH, EAST, or WEST.- Throws:
IllegalArgumentException
- if a negative distance, an invalid direction is selected, or the distance does not match the direction.
-
getOffBoardDistance
public int getOffBoardDistance()Get the distance in hexes from the board that the unit will be deployed. If the unit is to be deployed onboard, the distance will be zero (0).- Returns:
- the
int
distance from the board the unit will be deployed (in hexes); this value will never be negative.
-
getOffBoardDirection
Returns the direction off the board that the unit will be deployed. If the unit is deployed onboard, IOffBoardDirections.NONE is returned, otherwise one of the values:IOffBoardDirections.NORTH
IOffBoardDirections.SOUTH
IOffBoardDirections.EAST
IOffBoardDirections.WEST
-
deployOffBoard
public void deployOffBoard(int round) Deploy this offboard entity at the previously specified distance and direction. This should only be invoked by theServer
after the board has been selected and all the players are ready to start. The side effects of this methods set the unit's position and facing as appropriate (as well as deploying the unit).Onboard units (units with an offboard distance of zero and a direction of
Entity.NONE
) will be unaffected by this method.- Parameters:
round
- The current round number.
-
getPickedUpMekWarriors
-
isCaptured
public boolean isCaptured()Has this entity been captured?- Returns:
true
if it has.
-
setCaptured
public void setCaptured(boolean arg) Specify that this entity has been captured.- Parameters:
arg
- theboolean
value to assign.
-
setExternalSearchlight
public void setExternalSearchlight(boolean arg) -
hasExternalSearchlight
public boolean hasExternalSearchlight()- Returns:
- True if this unit has an external searchlight (does not consider mounted ones).
-
hasSearchlight
public boolean hasSearchlight()- Returns:
- True if the unit has a usable searchlight. It considers both externally mounted searchlights and internally mounted ones.
-
destroyOneSearchlight
public void destroyOneSearchlight()Method to destroy a single searchlight on an entity. Searchlights can be destroyed on a roll of 7+ on a torso hit on a mek or on a front/side hit on a combat vehicle. -
setSearchlightState
public void setSearchlightState(boolean arg) -
isIlluminated
public boolean isIlluminated() -
setIlluminated
public void setIlluminated(boolean arg) -
isUsingSearchlight
public boolean isUsingSearchlight() -
setUsedSearchlight
public void setUsedSearchlight(boolean arg) -
usedSearchlight
public boolean usedSearchlight() -
isStuck
public boolean isStuck()Is the Entity stuck in a swamp? -
setStuck
public void setStuck(boolean arg) Set weather this Entity is stuck in a swamp or not- Parameters:
arg
- theboolean
value to assign
-
canUnstickByJumping
public boolean canUnstickByJumping()Is the Entity stuck in a swamp? -
setCanUnstickByJumping
public void setCanUnstickByJumping(boolean arg) Set whether this Entity is stuck in a swamp or not- Parameters:
arg
- theboolean
value to assign
-
destroy
-
addTargetedBySwarm
public void addTargetedBySwarm(int entityId, int weaponId) Add a targeting by a swarm volley from a specified entity- Parameters:
entityId
- Theint
id of the shooting entityweaponId
- Theint
id of the shooting lrm launcher
-
getTargetedBySwarm
public boolean getTargetedBySwarm(int entityId, int weaponId) Were we targeted by a certain swarm/swarm-i volley this turn?- Parameters:
entityId
- Theint
id of the shooting entity we are checkingweaponId
- Theint
id of the launcher to check- Returns:
- a fitting
boolean
value
-
getShortRangeModifier
public int getShortRangeModifier() -
getMediumRangeModifier
public int getMediumRangeModifier() -
getLongRangeModifier
public int getLongRangeModifier() -
getExtremeRangeModifier
public int getExtremeRangeModifier() -
getLOSRangeModifier
public int getLOSRangeModifier() -
setArmorType
public void setArmorType(int armType) -
setArmorType
public void setArmorType(int armType, int loc) -
setStructureType
public void setStructureType(int structureType) -
setStructureTechLevel
public void setStructureTechLevel(int level) -
setArmorType
-
setArmorType
-
setStructureType
-
getArmorType
public int getArmorType(int loc) -
setArmorTechLevel
public void setArmorTechLevel(int newTL) -
setArmorTechLevel
public void setArmorTechLevel(int newTL, int loc) -
getArmorTechLevel
public int getArmorTechLevel(int loc) -
getStructureType
public int getStructureType() -
getStructureTechLevel
public int getStructureTechLevel() -
setWeaponHit
-
setTaggedBy
public void setTaggedBy(int tagger) -
getTaggedBy
public int getTaggedBy() -
getCost
public final double getCost(boolean ignoreAmmo) Calculates and returns the C-bill cost of the unit. The parameter can be used to include or exclude ("dry cost") the cost of ammunition on the unit.- Parameters:
ignoreAmmo
- When true, the cost of ammo on the unit will be excluded from the cost- Returns:
- The cost in C-Bills of the 'Mek in question.
-
getCost
Calculates and returns the C-bill cost of the unit. The parameter ignoreAmmo can be used to include or exclude ("dry cost") the cost of ammunition on the unit. A report for the cost calculation will be written to the given calcReport.- Parameters:
calcReport
- A CalculationReport to write the report for the cost calculation toignoreAmmo
- When true, the cost of ammo on the unit will be excluded from the cost- Returns:
- The cost in C-Bills of the 'Mek in question.
-
getPriceMultiplier
public double getPriceMultiplier()Returns a multiplier that combines multiplicative construction cost modifiers for this Entity.This includes only modifiers that apply to an Entity's final, total cost (e.g. - the 1.25x modifier for being an omni-unit, or the 32.0x for being an aerodyne DropShip). It does NOT include multipliers that only apply to a sub-part of the unit (e.g. the weight based multiplier that applies to a vehicle's internal structure cost).
This allows MekHQ to scale the price of a Unit's Parts in a more appropriate manner.
Defaults to 1.0
-
implicitClanCASE
public int implicitClanCASE()Used to for cost calculations. Though the TM rules allow a Clan unit to be designed without CASE, MM assumes that CASE is present in any location that has explosive equipment.- Returns:
- The number of locations protected by Clan CASE beyond what is explicitly mounted.
-
removePartialCoverHits
public boolean removePartialCoverHits(int location, int cover, int side) -
doomedInExtremeTemp
public boolean doomedInExtremeTemp()- Returns:
- True when this unit will not survive temperatures outside of -30 to +50 C.
-
doomedInVacuum
public boolean doomedInVacuum()- Returns:
- True when this unit will not survive vacuum conditions.
-
doomedOnGround
public boolean doomedOnGround()- Returns:
- True when this unit is not allowed to be or will not survive in any hex of a ground map (unless it is being transported).
-
doomedInAtmosphere
public boolean doomedInAtmosphere()- Returns:
- True when this unit is not allowed to be or will not survive in any hex of a low altitude a.k.a. atmospheric map (unless it is being transported). Note that this has nothing to do with the atmosphere (or lack of it, depending on planetary conditions), only the map type and scale.
-
doomedInSpace
public boolean doomedInSpace()- Returns:
- True when this unit is not allowed to be or will not survive in any hex of a space map (unless it is being transported).
-
getArmorWeight
public double getArmorWeight(int loc) Prior to TacOps errata 3.3, armor was rounded up to the nearest half ton As of TacOps errata 3.3, patchwork armor is not rounded by location. Previous editions of the rules required it to be rounded up to the nearest half ton by location. Note: Unless overridden, this should only be called on units with patchwork armor, as rounding behavior is not guaranteed to be correct or even the same for others and units with a single overall armor type have no real reason to specifically care about weight per location anyway.- Parameters:
loc
- The code value for the location in question (unit type-specific).- Returns:
- The weight of the armor in the location in tons.
-
getArmorWeight
public double getArmorWeight()The total weight of the armor on this unit. This is guaranteed to be rounded properly for both single-type and patchwork armor.- Returns:
- The armor weight in tons.
-
hasTAG
public boolean hasTAG() -
isCanon
public boolean isCanon() -
setCanon
public void setCanon(boolean canon) -
climbMode
public boolean climbMode()Get the entity's "climbing mode"- Returns:
- True or false, where true = climb up and false = go through
-
setClimbMode
public void setClimbMode(boolean state) -
usedTag
public boolean usedTag() -
hasEiCockpit
public boolean hasEiCockpit() -
hasActiveEiCockpit
public boolean hasActiveEiCockpit() -
isLayingMines
public boolean isLayingMines() -
setLayingMines
public void setLayingMines(boolean laying) -
canLayMine
public boolean canLayMine() -
sideTable
- Specified by:
sideTable
in interfaceTargetable
- Returns:
- side hit from location
-
sideTable
- Specified by:
sideTable
in interfaceTargetable
- Returns:
- side hit from location
-
sideTable
-
sideTable
-
canGoHullDown
public boolean canGoHullDown()Method to determine if an entity is currently capable of going hull-down. Note, this is *not* whether the entity can ever go hull-down.- Returns:
- True if the entity is able to go hull-down, else false.
-
canAssaultDrop
public boolean canAssaultDrop() -
setAssaultDropInProgress
public void setAssaultDropInProgress(boolean flag) -
setLandedAssaultDrop
public void setLandedAssaultDrop() -
isAssaultDropInProgress
public boolean isAssaultDropInProgress() -
addPilotingModifierForTerrain
Apply PSR modifier for difficult terrain at the specified coordinates.- Parameters:
roll
- the PSR to modifyc
- the coordinates where the PSR happensboardId
- the board ID where the PSR happens
-
addPilotingModifierForTerrain
public void addPilotingModifierForTerrain(PilotingRollData roll, Coords c, int boardId, boolean enteringRubble) Apply PSR modifier for difficult terrain at the specified coordinates- Parameters:
roll
- the PSR to modifyc
- the coordinates where the PSR happensboardId
- the board ID where the PSR happensenteringRubble
- True if entering rubble
-
addPilotingModifierForTerrain
Apply PSR modifier for difficult terrain at the move step position- Parameters:
roll
- the PSR to modifystep
- the move step the PSR occurs at
-
addPilotingModifierForTerrain
Apply PSR modifier for difficult terrain in the current position- Parameters:
roll
- the PSR to modify
-
fixElevation
public boolean fixElevation()defensively check and correct elevation -
getEngine
-
getEngineType
public int getEngineType()- Returns:
- The type of engine if it has an engine, or Engine.NONE, if it has no engine.
-
hasEngine
public boolean hasEngine() -
setEngine
-
itemOppositeTech
-
getRetreatedDirection
- Returns:
- Returns the retreatedDirection.
-
setRetreatedDirection
- Parameters:
retreatedDirection
- The retreatedDirection to set.
-
setLastTarget
public void setLastTarget(int id) -
getLastTarget
public int getLastTarget() -
setLastTargetDisplayName
-
getLastTargetDisplayName
-
isSufferingEMI
public boolean isSufferingEMI()- Returns:
- whether the unit is suffering from Electromagnetic Interference
-
setEMI
public void setEMI(boolean inVal) -
getMotiveSideMod
public int getMotiveSideMod(int side) The attack direction modifier for rolls on the motive system hits table for the given side (as defined inToHitData
). This will return 0 if Tactical Operations vehicle effectiveness rules are in effect or if the side parameter falls outside ToHitData's range of "fixed" side values; in particular, it will return 0 if handedToHitData.SIDE_RANDOM
.- Parameters:
side
- The attack direction as specified above.- Returns:
- The appropriate directional roll modifier.
-
isNuclearHardened
public abstract boolean isNuclearHardened()Checks if the unit is hardened against nuclear strikes.- Returns:
- true if this is a hardened unit.
-
setHidden
public void setHidden(boolean inVal) Set the hidden state of this entity (used for hidden units rules, TW pg 259). -
setMadePointblankShot
public void setMadePointblankShot(boolean inVal) -
setHiddenActivationPhase
- Parameters:
phase
- the phase for this hidden unit to become active in.
-
isHidden
public boolean isHidden()Returns true if this unit is currently hidden (hidden units, TW pg 259). -
madePointblankShot
public boolean madePointblankShot()- Returns:
- True if this unit has already made a pointblank shot this round.
-
getHiddenActivationPhase
- Returns:
- the phase that this hidden unit will activate in (generally this will be Game.Phase.UNKNOWN, indicating that the unit isn't activating).
-
isCarcass
public boolean isCarcass()Is this unit a carcass, a carcass can take no action -
setCarcass
public void setCarcass(boolean carcass) Sets if this unit is a carcass.- Parameters:
carcass
- true if this unit should be a carcass, false otherwise.- See Also:
-
destroyLocation
public void destroyLocation(int loc) Marks all equipment in a location on this entity as destroyed.- Parameters:
loc
- The location that is destroyed.
-
destroyLocation
public void destroyLocation(int loc, boolean blownOff) Marks all equipment in a location on this entity as destroyed.- Parameters:
loc
- The location that is destroyed.blownOff
- true if the location was blown off
-
clearDestroyedNarcPods
public void clearDestroyedNarcPods()Iterates over all Narc and iNarc pods attached to this entity and removes those still 'stuck' to destroyed or missing locations. -
clearNarcAndiNarcPods
public void clearNarcAndiNarcPods()This clears all Narc and iNarc Pods from an Entity. It is used in MekHQ to clear this transient data. -
checkSideSlip
public PilotingRollData checkSideSlip(EntityMovementType moveType, Hex prevHex, EntityMovementType overallMoveType, MoveStep prevStep, int prevFacing, int curFacing, Coords lastPos, Coords curPos, int distance, boolean speedBooster) -
isAirborneVTOLorWIGE
public boolean isAirborneVTOLorWIGE()- Specified by:
isAirborneVTOLorWIGE
in interfaceTargetable
- Returns:
- is the entity airborne in the fashion of a VTOL
Not used for aerospace units, see
Targetable.isAirborne()
-
setSpotTargetId
public void setSpotTargetId(int targetId) -
getSpotTargetId
public int getSpotTargetId() -
setCommander
public void setCommander(boolean arg) -
isCommander
public boolean isCommander() -
hasLinkedMGA
-
setReckless
public void setReckless(boolean b) -
isReckless
public boolean isReckless() -
isCapitalFighter
public boolean isCapitalFighter() -
isCapitalFighter
public boolean isCapitalFighter(boolean lounge) -
isCapitalScale
public boolean isCapitalScale()- Returns:
- True when this unit has capital-scale armor.
-
usesWeaponBays
public boolean usesWeaponBays()- Returns:
- True if this unit is using weapons bays
-
whichBay
return the bay of the current weapon or ammo- Parameters:
equipmentId
- The equipment index- Returns:
- The bay mount, or null if the equipment is not in a bay
-
getHeatInArc
public int getHeatInArc(int location, boolean rearMount) -
getVectors
public int[] getVectors() -
setVectors
public void setVectors(int[] v) -
getVector
public int getVector(int vectorFacing) -
getVelocity
public int getVelocity() -
chooseSide
-
getHeading
return the heading of the unit based on its active vectors if vectors are tied then return two headings -
setPlayerPickedPassThrough
-
getPlayerPickedPassThrough
-
setPassedThrough
-
getPassedThrough
-
setPassedThroughFacing
-
getPassedThroughFacing
-
getPassedThroughBoardId
public int getPassedThroughBoardId() -
setPassedThroughBoardId
public void setPassedThroughBoardId(int passedThroughBoardId) -
addPassedThrough
-
passedOver
Returns true if this Entity passed over the given target during its current path.- Parameters:
target
- The target- Returns:
- True if this unit passed over the target this turn
-
passedThrough
-
passedWithin
Did the entity pass within a certain number of hexes of these coords? -
passedThroughPrevious
What coords were passed through previous to the given one -
setRamming
public void setRamming(boolean b) -
isRamming
public boolean isRamming() -
resetFiringArcs
public void resetFiringArcs() -
hasArcFired
public boolean hasArcFired(int location, boolean rearMount) -
setArcFired
public void setArcFired(int location, boolean rearMount) -
setRapidFire
public void setRapidFire()Force rapid fire mode to the highest level on RAC and UAC - this is for aerospace -
extendBlade
public void extendBlade(int loc) Set the retractable blade in the given location as extended Takes the first piece of appropriate equipment -
destroyRetractableBlade
public void destroyRetractableBlade(int loc) destroys the first retractable blade critical slot found -
getTMTracker
-
setGrappled
public void setGrappled(int id, boolean attacker) -
isGrappleAttacker
public boolean isGrappleAttacker() -
getGrappled
public int getGrappled() -
isChainWhipGrappled
public boolean isChainWhipGrappled() -
isGrappledThisRound
public boolean isGrappledThisRound() -
setGrappledThisRound
public void setGrappledThisRound(boolean grappled) -
setGameOptions
public void setGameOptions() -
setGrappleSide
public void setGrappleSide(int side) -
getGrappleSide
public int getGrappleSide() -
hasFunctionalArmAES
public boolean hasFunctionalArmAES(int location) -
hasFunctionalLegAES
public boolean hasFunctionalLegAES() -
isEvading
public boolean isEvading() -
setEvading
public void setEvading(boolean evasion) -
getEvasionBonus
public int getEvasionBonus() -
setCarefulStand
public void setCarefulStand(boolean stand) -
isCarefulStand
public boolean isCarefulStand() -
setTurnInterrupted
public void setTurnInterrupted(boolean interrupted) -
turnWasInterrupted
public boolean turnWasInterrupted()This should eventually be true for any situation where the entity's turn was interrupted, e.g. walking over a minefield -
endOfTurnCargoInteraction
public boolean endOfTurnCargoInteraction() -
getSensors
-
getActiveSensor
-
getNextSensor
-
setNextSensor
-
getSensorCheck
public int getSensorCheck() -
isAeroSensorDestroyed
public boolean isAeroSensorDestroyed()A method to determine if an aero has suffered 3 sensor hits. When double-blind is on, this affects both standard visibility and sensor rolls -
hasModularArmor
public boolean hasModularArmor() -
hasModularArmor
public boolean hasModularArmor(int loc) -
getDamageReductionFromModularArmor
-
getGhostTargetRoll
-
getGhostTargetRollMoS
public int getGhostTargetRollMoS() -
getGhostTargetOverride
public int getGhostTargetOverride() -
getCoolantFailureAmount
public int getCoolantFailureAmount() -
addCoolantFailureAmount
public void addCoolantFailureAmount(int amount) This is implemented in subclasses, do nothing in general- Parameters:
amount
- Amount of Coolant to add
-
resetCoolantFailureAmount
public void resetCoolantFailureAmount()This is implemented in subclasses, do nothing in generalResets the coolant failure amount
-
getExtraCommGearTons
public int getExtraCommGearTons()- Returns:
- the tonnage of additional mounted communications equipment
-
isTransported
public boolean isTransported()- Returns:
- True if this unit is being transported by another.
-
getECMInfo
- Returns:
- Information (range, location, strength) about ECM if the unit has active ECM or null if it doesn't. In the case of multiple ECCM systems, the best one takes precedence, as a unit can only have one active ECCM at a time.
-
getECCMInfo
- Returns:
- Information (range, location, strength) about ECCM if the unit has active ECCM or null if it doesn't. In the case of multiple ECCM system, the best one takes precedence, as a unit can only have one active ECCM at a time.
-
getECMStrength
public double getECMStrength()- Returns:
- the strength of the ECM field this unit emits
-
getECCMStrength
public double getECCMStrength()- Returns:
- the strength of the ECCM field this unit emits
-
getTotalCommGearTons
public abstract int getTotalCommGearTons()- Returns:
- the total tonnage of communications gear in this entity
-
getHQIniBonus
public int getHQIniBonus()- Returns:
- the initiative bonus this Entity grants for HQ
-
getQuirkIniBonus
public int getQuirkIniBonus()- Returns:
- the initiative bonus this Entity grants for quirks
-
getBayByAmmo
Returns the Bay that the given ammo is associated with.- Parameters:
ammoMounted
- an AmmoMounted to search for- Returns:
- The bay (WeaponMounted) that the ammo works with
-
getVibroClaws
public int getVibroClaws()Return how many BA vibroclaws thisEntity
is equipped with -
taserShutdown
public void taserShutdown(int turns, boolean baTaser) shut this unit down due to a Taser attack- Parameters:
turns
- - the amount of rounds for which this Entity should be shutdownbaTaser
- - was this due to a BA taser?
-
getTaserShutdownRounds
public int getTaserShutdownRounds()- Returns:
- the number of rounds for which this unit should be shutdown by taser
-
setTaserShutdownRounds
public void setTaserShutdownRounds(int rounds) -
isBATaserShutdown
public boolean isBATaserShutdown() -
setBATaserShutdown
public void setBATaserShutdown(boolean value) -
getTaserInterferenceHeat
public boolean getTaserInterferenceHeat() -
setTaserFeedback
public void setTaserFeedback(int rounds) set this entity to suffer from taser feedback- Parameters:
rounds
- - the number of rounds to suffer from taser feedback
-
getTaserFeedBackRounds
public int getTaserFeedBackRounds()- Returns:
- The rounds for which this entity suffers from taser feedback.
-
setTaserInterference
public void setTaserInterference(int value, int rounds, boolean heat) -
getTaserInterference
public int getTaserInterference() -
getTaserInterferenceRounds
public int getTaserInterferenceRounds() -
addIMPHits
public void addIMPHits(int missiles) -
isMilitary
public boolean isMilitary()returns whether the unit is a military unit (as opposed to a civilian unit). -
isLargeCraft
public boolean isLargeCraft()is this entity a large craft? (dropship, jumpship, warship, or space station, see TW p.20) -
loadedUnitsHaveActiveECM
public boolean loadedUnitsHaveActiveECM()Do units loaded onto this entity still have active ECM/ECCM/etc.? -
isPartOfFighterSquadron
public boolean isPartOfFighterSquadron()is this entity loaded into a fighter squadron? -
getBARRating
public int getBARRating(int loc) Return the BAR-rating of this Entity's armor- Returns:
- the BAR rating
-
hasBARArmor
public boolean hasBARArmor(int loc) - Returns:
- True if this unit has BAR armor of a rating of less than 10 in the given location.
-
setBARRating
public void setBARRating(int rating) Sets the barrier armor rating for support vehicles. Has no effect on other unit types.- Parameters:
rating
- The BAR
-
setBARRating
public void setBARRating(int rating, int loc) Sets the barrier armor rating in a specific location for support vehicles. Has no effect on other unit types.- Parameters:
rating
- The BARloc
- The location index
-
hasArmoredChassis
public boolean hasArmoredChassis()- Returns:
- True if this entity has an armored chassis.
-
hasEnvironmentalSealing
public boolean hasEnvironmentalSealing()- Returns:
- True if this unit has Environmental Sealing
-
doCheckEngineStallRoll
Possibly do a ICE-Engine stall PSR (only intended for Meks, both Industrial and Battle). -
checkUnstall
Check for uninstalling of this Entity's engine (only used for ICE-powered 'Meks).- Parameters:
vPhaseReport
- theReport
Vector
containing the phase reports
-
hasArmoredEngine
public boolean hasArmoredEngine() -
isStalled
public boolean isStalled()Is this Entity's ICE Engine stalled?- Returns:
- if this Entity's ICE engine is stalled
-
isNightwalker
public boolean isNightwalker()Determines if the pilot has the Nightwalker SPA- Returns:
- true when pilots have the SPA and are not in a flying vehicle.
-
setSource
Sets the source (TRO or other) of the creation of this entity.- Parameters:
source
- The source name
-
getSource
-
setQuirks
-
getQuirks
Retrieves the quirks object for entity. DO NOT USE this to check boolean options, as it will not check game options for quirks. UsehasQuirk(String)
instead!- Returns:
- This unit's quirks, independently of the game's settings
- See Also:
-
hasQuirk
-
getPartialRepairs
-
clearPartialRepairs
public void clearPartialRepairs() -
countQuirks
public int countQuirks()count all the quirks for this unit, positive and negative -
countWeaponQuirks
public int countWeaponQuirks() -
countPartialRepairs
public int countPartialRepairs() -
countQuirks
count the quirks for this unit, for a given group name -
getQuirkList
Returns a string of all the quirk "codes" for this entity, using sep as the separator -
getForwardArc
public int getForwardArc()Returns the forward firing arc for this entity - overrided by some units -
getRearArc
public int getRearArc()Returns the rear firing arc for this entity - overrided by some units -
isAirborne
public boolean isAirborne()- Specified by:
isAirborne
in interfaceTargetable
- Returns:
- Is the entity airborne in the fashion of an aerospace unit?
Does not include VTOL movement (see
Targetable.isAirborneVTOLorWIGE()
-
isSpaceborne
public boolean isSpaceborne()Returns true when this unit is currently on a space board, either close to a planet ("high altitude") or in deep space but only if its position is valid, i.e. not when it is transported or otherwise has a null position or is off board or undeployed. On a high altitude board, a unit is spaceborne even if it happens to be in an atmosphere hex.This method is safe to call when game is null.
- Returns:
- True when in space
-
isNOE
public final boolean isNOE()- Returns:
- True if this unit is flying at the Nap of the Earth (NOE), i.e. one altitude above ground.
-
getStartingPos
public int getStartingPos() -
getStartingPos
public int getStartingPos(boolean inheritFromOwner) -
setStartingPos
public void setStartingPos(int i) -
getAltitude
public int getAltitude()- Specified by:
getAltitude
in interfaceTargetable
- Returns:
- altitude of target
-
setAltitude
public void setAltitude(int a) -
getUseManualBV
public boolean getUseManualBV() -
setUseManualBV
public void setUseManualBV(boolean bv) -
getManualBV
public int getManualBV() -
setManualBV
public void setManualBV(int bv) -
getInitialBV
public int getInitialBV()Gets the initial BV of a unit.Useful for comparisons with the current BV.
- Returns:
- The initial BV of a unit.
-
setInitialBV
public void setInitialBV(int bv) Sets the initial BV for a unit.Called when the game is initialized.
- Parameters:
bv
- The initial BV of a unit.
-
getBombLoadout
- Returns:
- an int array of the number of bombs of each type based on the current bomb list
-
getBombLoadout
-
getInternalBombLoadout
-
getExternalBombLoadout
-
getSecondaryPositions
- Specified by:
getSecondaryPositions
in interfaceTargetable
-
hasActiveBlueShield
public boolean hasActiveBlueShield()Checks to see if this unit has a functional Blue Shield Particle Field Damper that is turned on- Returns:
true
if the entity has a working, switched on blue fieldfalse
otherwise
-
getBlueShieldRounds
public int getBlueShieldRounds() -
isDropping
public boolean isDropping() -
hasStealth
public boolean hasStealth()- Returns:
- True if this unit has working stealth armor (not patchwork armor).
-
getPowerAmplifierWeight
public double getPowerAmplifierWeight()Computes and returns the power amplifier weight for this entity, if any. Returns 0.0 if the entity needs no amplifiers due to engine type or not carrying any weapons requiring them.- Returns:
- the power amplifier weight in tons.
-
getLoadedKeepers
-
setLoadedKeepers
-
getExtraC3BV
public int getExtraC3BV(int baseBV) -
hasUnloadedUnitsFromBays
public boolean hasUnloadedUnitsFromBays() -
getMovedBackwards
public boolean getMovedBackwards() -
setMovedBackwards
public void setMovedBackwards(boolean back) -
isPowerReverse
public boolean isPowerReverse() -
setPowerReverse
public void setPowerReverse(boolean isPowerReverse) -
wigeLiftoffHover
public boolean wigeLiftoffHover()Tracks whether a WiGE lifted off this turn (or a LAM hovered). Needed to track state in case movement is continued from an interruption, so that the unit does not have a minimum movement for the turn.- Returns:
- whether a WiGE lifted off during this turn's movement
-
setWigeLiftoffHover
public void setWigeLiftoffHover(boolean lifted) -
setHardenedArmorDamaged
-
isHardenedArmorDamaged
do we have a half-hit hardened armor point in the location struck by this?- Parameters:
hit
-- Returns:
-
setLocationBlownOff
public void setLocationBlownOff(int loc, boolean damaged) -
isLocationBlownOff
public boolean isLocationBlownOff(int loc) -
setLocationBlownOffThisPhase
public void setLocationBlownOffThisPhase(int loc, boolean damaged) Marks the location as blown off in the current phase. This should be called together withsetLocationBlownOff(int, boolean)
whenever a location gets blown off during play, to allow relevant methods (notablyisLocationBad(int)
) to distinguish between fresh and preexisting damage. A location's "newly blown off" status resets with the next call toapplyDamage()
.- Parameters:
loc
- Subclass-dependent code for the location.damaged
- The location's "recently blown off" status.
-
isLocationBlownOffThisPhase
public boolean isLocationBlownOffThisPhase(int loc) Has the indicated location been blown off this phase (as opposed to either earlier or not at all)?- Parameters:
loc
- Subclass-dependent code for the location.- Returns:
- The locations "recently blown off" status.
-
hasPatchworkArmor
public boolean hasPatchworkArmor()- Returns:
- True if this unit has patchwork armor.
-
hasHardenedArmor
public boolean hasHardenedArmor() -
getMASCTurns
public int getMASCTurns()Get the number of turns MASC has been used continuously.This method should only be used during serialization.
- Returns:
- the
int
number of turns MASC has been used.
-
isMASCUsed
public boolean isMASCUsed()Determine if MASC has been used this turn.- Returns:
true
if MASC has been used.
-
getSuperchargerTurns
public int getSuperchargerTurns()Get the number of turns Supercharger has been used continuously.This method should only be used during serialization.
- Returns:
- the
int
number of turns Supercharger has been used.
-
isSuperchargerUsed
public boolean isSuperchargerUsed()Determine if Supercharger has been used this turn.- Returns:
true
if Supercharger has been used.
-
incrementMASCAndSuperchargerLevels
protected void incrementMASCAndSuperchargerLevels() -
setMASCUsed
public void setMASCUsed(boolean used) Set whether MASC has been used.This method should only be used during deserialization.
- Parameters:
used
- Theboolean
whether MASC has been used.
-
getMASCTarget
public int getMASCTarget() -
setSuperchargerUsed
public void setSuperchargerUsed(boolean used) Set whether Supercharger has been used.This method should only be used during deserialization.
- Parameters:
used
- Theboolean
whether Supercharger has been used.
-
getSuperchargerTarget
public int getSuperchargerTarget() -
checkForMASCFailure
public boolean checkForMASCFailure(MovePath md, Vector<Report> vDesc, HashMap<Integer, List<CriticalSlot>> vCriticalSlots) This function checks for masc failure.- Parameters:
md
- the movement path.vDesc
- the description off the masc failure. used as output.vCriticalSlots
- contains tuple of integer and critical slot. used as output.- Returns:
- true if there was a masc failure.
-
checkForSuperchargerFailure
public boolean checkForSuperchargerFailure(MovePath md, Vector<Report> vDesc, HashMap<Integer, List<CriticalSlot>> vCriticalSlots) This function checks for Supercharger failure.- Parameters:
md
- the movement path.vDesc
- the description off the Supercharger failure. used as output.vCriticalSlots
- contains tuple of integer and critical slot. used as output.- Returns:
- true if there was a Supercharger failure.
-
getMASC
- Returns:
- non-supercharger MASC mounted on this entity
-
getSuperCharger
- Returns:
- An operable Supercharger if there is one on this unit.
-
getBoobyTrap
- Returns:
- an operable Booby Trap if there is one on this unit.
-
hasBoobyTrap
public boolean hasBoobyTrap() -
getBoobyTrapDamage
public int getBoobyTrapDamage() -
getEngineHits
public abstract int getEngineHits() -
damagedJumpJets
public int damagedJumpJets()Returns the number of destroyed jump jets. -
getLocationDamage
-
canEscape
public boolean canEscape()- Returns:
- true if this unit can reasonably escape from the board. It can be used to determine whether some non-destroyed units should be considered possible salvage.
-
isCrippled
public abstract boolean isCrippled()Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.- Returns:
- boolean
-
isCrippled
public abstract boolean isCrippled(boolean checkCrew) Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258. Excepting dead or non-existing crew issues- Returns:
- boolean
-
isDmgHeavy
public abstract boolean isDmgHeavy()Returns TRUE if the entity has been heavily damaged.- Returns:
- boolean
-
isDmgModerate
public abstract boolean isDmgModerate()Returns TRUE if the entity has been moderately damaged.- Returns:
- boolean
-
isDmgLight
public abstract boolean isDmgLight()Returns TRUE if the entity has been lightly damaged.- Returns:
- boolean
-
getDamageLevel
public int getDamageLevel()Returns the entity's current damage level.- Returns:
- DMG_CRIPPLED, DMG_HEAVY, DMG_MODERATE, DMG_LIGHT or DMG_NONE.
-
getDamageLevel
public int getDamageLevel(boolean checkCrew) Returns the entity's current damage level.- Returns:
- DMG_CRIPPLED, DMG_HEAVY, DMG_MODERATE, DMG_LIGHT or DMG_NONE.
-
setC3UUID
public void setC3UUID() -
setC3UUIDAsString
-
getC3UUIDAsString
-
setC3MasterIsUUIDAsString
-
getC3MasterIsUUIDAsString
-
setC3iNextUUIDAsString
-
getC3iNextUUIDAsString
-
getFreeC3iUUID
public int getFreeC3iUUID() -
setNC3NextUUIDAsString
-
getNC3NextUUIDAsString
-
getFreeNC3UUID
public int getFreeNC3UUID() -
isC3CompanyCommander
public boolean isC3CompanyCommander() -
isC3IndependentMaster
public boolean isC3IndependentMaster() -
wasStruck
public boolean wasStruck()- Returns:
- True if a unit was physically struck (punch, kick, DFA, etc).
-
setStruck
public void setStruck(boolean struck) Sets if a unit was physically struck (punch, kick, DFA, etc). -
hasFallen
public boolean hasFallen()- Returns:
- True if a unit has fallen in the current phase.
-
setFallen
public void setFallen(boolean fell) Sets if the unit has fallen in the current phase.- Parameters:
fell
- True if the unit should be considered to have fallen this phase
-
getAlternateCost
public double getAlternateCost()- Returns:
- An alternative cost that will be added to the MekSummaryCache - at the moment it is primarily used to rework infantry costs for MekHQ, but it could be applied to other unit types as well - defaults to -1, so there is no confusion.
-
isTrapped
public boolean isTrapped()Are we trapped inside of a destroyed transport? If so we shouldn't count for BV, which is why we have this check. -
getCamouflage
-
getCamouflageOrElseOwners
-
getCamouflageOrElse
-
getCamouflageOrElse
-
setCamouflage
-
isBoobyTrapInitiated
public boolean isBoobyTrapInitiated() -
setBoobyTrapInitiated
public void setBoobyTrapInitiated(boolean boobyTrapInitiated) -
getSelfDestructing
public boolean getSelfDestructing() -
setSelfDestructing
public void setSelfDestructing(boolean selfDestructing) -
getSelfDestructInitiated
public boolean getSelfDestructInitiated() -
setSelfDestructInitiated
public void setSelfDestructInitiated(boolean tf) -
getSelfDestructedThisTurn
public boolean getSelfDestructedThisTurn() -
setSelfDestructedThisTurn
public void setSelfDestructedThisTurn(boolean tf) -
setIsJumpingNow
public void setIsJumpingNow(boolean jumped) -
getIsJumpingNow
public boolean getIsJumpingNow() -
setConvertingNow
public void setConvertingNow(boolean converting) -
isConvertingNow
public boolean isConvertingNow() -
getConversionMode
public int getConversionMode() -
setConversionMode
public void setConversionMode(int mode) Sets the unit to be in the given mode.- Parameters:
mode
- The new mode
-
nextConversionMode
Entities that can convert movement modes (LAMs, QuadVees) report the next mode to assume when a convert movement command is processed. This provides a set order for cycling through available modes.- Parameters:
afterMode
- The movement mode to convert from.- Returns:
- The next movement mode in the sequence.
-
toggleConversionMode
public void toggleConversionMode()Sets the movement mode to the next in the conversion sequence for QuadVees, LAMs, and Meks with tracks. In most cases this switches between two available modes, but LAMs that start the turn in AirMek mode have three available. -
canFall
public boolean canFall(boolean gyroLegDamage) Only applicable to Meks, but here for convenience. Meks that are already prone, or QuadVees and LAMs in non-leg mode are not subject to PSRs for falling. Note that PSRs are sometimes required for other reasons.- Parameters:
gyroLegDamage
- Whether the potential fall is due to damage to gyro or leg actuators, in which case Meks using tracks are not subject to falls.- Returns:
- Whether the
Entity
is required to make PSRs to avoid falling.
-
canFall
public boolean canFall()Only applicable to Meks, but here for convenience. Meks that are already prone, or QuadVees and LAMs in fighter mode are not subject to PSRs for falling. Note that PSRs are sometimes required for other reasons.- Returns:
- Whether the
Entity
is required to make PSRs to avoid falling.
-
setTraitorId
public void setTraitorId(int id) -
getTraitorId
public int getTraitorId() -
sideTableRam
Used to determine net velocity of ramming attack -
sideTableRam
-
setArmorTonnage
public void setArmorTonnage(double ton) -
getLabArmorTonnage
public double getLabArmorTonnage() -
getLabTotalArmorPoints
public int getLabTotalArmorPoints() -
loadDefaultCustomWeaponOrder
public void loadDefaultCustomWeaponOrder() -
loadQuirks
-
getEquipmentForWeaponQuirk
Returns the Mounted that is referred to by the quirkEntry (which must be a weapon quirk). FIXME: This is very specialized code that is only needed because we need to identify a weapon in the blk/mtf file. It might be better to write the weapon quirk directly to the weapon, removing the need to find it. Note the override in ProtoMek that doesnt use critical slots. For meks, this is challenge as the specific weapon in a location must still be addressed.- Parameters:
quirkEntry
- The weapon quirk entry- Returns:
- The Mounted at the specified location
-
assignWeaponQuirk
-
newPhase
- Specified by:
newPhase
in interfacePhaseUpdated
-
isUnderwater
public boolean isUnderwater()- Returns:
- True if this entity is completely submerged.
-
hasOccupiedHex
public boolean hasOccupiedHex()- Returns:
- True if this entity has a non-null occupied hex, i.e. it has a game, a position, a board etc.
-
getTechLevelYear
public int getTechLevelYear() -
getTargetBay
public int getTargetBay() -
setTargetBay
public void setTargetBay(int tb) -
getEntityType
public abstract long getEntityType() -
hasETypeFlag
public boolean hasETypeFlag(long flag) Convenience method that checks whether a bit is set in the entity type field.- Parameters:
flag
- An ETYPE_* value- Returns:
- true if getEntityType() has the flag set
-
getEntityMajorTypeName
Given an Entity type, return the name of the major class it belongs to (eg: Mek, Aero, Tank, Infantry).- Parameters:
typeId
- The type Id to get a major name for- Returns:
- The major class name for the given type id
-
getEntityTypeName
Returns the specific entity type name for the given type id (eg: Biped Mek, Conventional Fighter, VTOL).- Parameters:
typeId
- The ETYPE_* type- Returns:
- A String representation of the given type
-
damageSystem
public void damageSystem(int type, int slot, int hits) -
damageSystem
public int damageSystem(int type, int slot, int loc, int hits) -
isEjectionPossible
public boolean isEjectionPossible() -
getAllowedPhysicalAttacks
public int getAllowedPhysicalAttacks() -
getMaxWeaponRange
public int getMaxWeaponRange()The max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range. Assumes target is not airborne if we are on a ground map.- Returns:
- The maximum weapon range of weapons on this unit
-
getMaxWeaponRange
public int getMaxWeaponRange(boolean targetIsAirborne) The max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range, and whether the target is airborne.- Parameters:
targetIsAirborne
- True to assume the target is airborne- Returns:
- The maximum weapon range of weapons on this unit
-
getHeat
public int getHeat() -
getTsempHitsThisTurn
public int getTsempHitsThisTurn() -
addTsempHitThisTurn
public void addTsempHitThisTurn() -
getTsempEffect
public int getTsempEffect() -
setTsempEffect
public void setTsempEffect(int tsempEffect) -
isFiredTsempThisTurn
public boolean isFiredTsempThisTurn() -
setFiredTsempThisTurn
public void setFiredTsempThisTurn(boolean firedTsempThisTurn) -
hasFiredTsemp
public boolean hasFiredTsemp() -
setHasFiredTsemp
public void setHasFiredTsemp(boolean hasFiredTSEMP) -
setASEWAffected
public void setASEWAffected(int turns) Sets the number of rounds that the entity is affected by an ASEW missile- Parameters:
turns
- - integer specifying the number of end phases that the effects last through Technically, about 1.5 turns elapse per the rules for ASEW missiles in TO
-
getASEWAffected
public int getASEWAffected()- Returns:
- the number of rounds that the entity is affected by an ASEW missile
-
hasActivatedRadicalHS
public boolean hasActivatedRadicalHS() -
deactivateRadicalHS
public void deactivateRadicalHS() -
getConsecutiveRHSUses
public int getConsecutiveRHSUses() -
setConsecutiveRHSUses
public void setConsecutiveRHSUses(int consecutiveRHSUses) -
hasDamagedRHS
public boolean hasDamagedRHS() -
setHasDamagedRHS
public void setHasDamagedRHS(boolean hasDamagedRHS) -
addAttackedByThisTurn
public void addAttackedByThisTurn(int entityId) -
addGroundAttackedByThisTurn
public void addGroundAttackedByThisTurn(int entityId) -
clearAttackedByThisTurn
public void clearAttackedByThisTurn() -
getAttackedByThisTurn
-
getGroundAttackedByThisTurn
-
getWeaponSortOrder
-
setWeaponSortOrder
-
getCustomWeaponOrder
-
setCustomWeaponOrder
-
getCustomWeaponOrder
-
setCustomWeaponOrder
-
isWeapOrderChanged
public boolean isWeapOrderChanged() -
setWeapOrderChanged
public void setWeapOrderChanged(boolean weaponOrderChanged) -
getMpUsedLastRound
public int getMpUsedLastRound() -
isPrimitive
public boolean isPrimitive()- Returns:
- Whether the unit uses primitive or retro tech construction rules
-
getStructuralTechRating
-
setStructuralTechRating
-
setStructuralTechRating
public void setStructuralTechRating(int structuralTechRating) -
getBaseEngineValue
public double getBaseEngineValue()- Returns:
- the base engine value for support vehicles, see TM pg 120. Non-support vehicle entities will return 0.
-
getBaseChassisValue
public double getBaseChassisValue()- Returns:
- the base chassis value for support vehicles, see TM pg 120. Non-support vehicle entities will return 0.
-
getArmorTechRating
-
setArmorTechRating
-
setArmorTechRating
public void setArmorTechRating(int armorTechRating) -
getEngineTechRating
-
setEngineTechRating
-
setEngineTechRating
public void setEngineTechRating(int engineTechRating) -
getBaseChassisFireConWeight
public double getBaseChassisFireConWeight()Used by omni support vehicles to track the weight of fire control systems. This limits the tonnage that can be devoted to weapons in pods.- Returns:
- The fixed weight of fire control systems.
-
setBaseChassisFireConWeight
public void setBaseChassisFireConWeight(double weight) Used by omni support vehicles to set the weight of fixed fire control systems in the base chassis.- Parameters:
weight
- The weight of fixed fire control systems.
-
getOriginalBuildYear
public int getOriginalBuildYear()Units with construction data that varies by year (such as engine and control system weight for some primitive aerospace units) require tracking the original build year separately from the intro year for the model to account for refits that don't affect the core components.- Returns:
- The year to use for core component construction data.
-
setOriginalBuildYear
public void setOriginalBuildYear(int year) -
getSubEntities
This method (and getActiveSubEntities()) is meant for groups of entities handled as a singular one. Examples include fighter squadrons on space maps or lances in BattleForce game modes.To check if a given entity consists of multiple sub-entities, use
if (entity.getSubEntities().isPresent()) { ... }
To iterate over entities (if present), use:
entity.getSubEntities().ifPresent(entities -> entities.forEach( subEntity -> { ... });
- Returns:
- an optional collection of sub-entities, if this entity is considered a grouping of them.
-
getActiveSubEntities
A list of all active sub-entities. In most cases, this is simply an empty list.- Returns:
- an optional collection of sub-entities, if this entity is considered a grouping of them, pre-filtered to only contain active (non-destroyed and non-doomed) entities.
-
getSpriteDrawPriority
public int getSpriteDrawPriority()Used to determine the draw priority of different Entity subclasses. This allows different unit types to always be draw above/below other types. -
getTilesetModeString
Entities that use different sprites for different modes should override this- Returns:
- a code identifying the mode, or an empty string for the default sprite
-
isTrailer
public boolean isTrailer()Used to determine if this vehicle can be towed by a tractor -
isTractor
public boolean isTractor()Used to determine if this vehicle can be the engine/tractor for a bunch of trailers -
getHitchLocations
- Returns:
- A Set of Coords that need to be checked for entities that can be towed. This accounts for the hexes occupied by each entity in the 'train', plus hexes in front of or behind each trailer hitch.
-
getHitchCarrying
Finds the trailer hitch transporter that is carrying a given entityId Hitches move around in Transports on loading a saved game- Parameters:
id
- - the id of the loaded Entity we're trying to find- Returns:
- the
TankTrailerHitch
corresponding to the passed-in value
-
canTow
public boolean canTow(int trailerId) Determines if this vehicle is currently able to tow designated trailer.- Parameters:
trailerId
- - the ID of theEntity
to be towed.- Returns:
true
if the trailer can be towed,false
otherwise.
-
getTowing
public int getTowing()- Returns:
- the entity to be towed
-
setTowing
public void setTowing(int id) Change the towed status of this entity- Parameters:
id
- - the ID of the entity being towed
-
getTractor
public int getTractor()- Returns:
- the tractor towing the train this entity is part of
-
setTractor
public void setTractor(int id) Sets the tractor towing the train this entity is part of- Parameters:
id
- - id of the tractor towing this train
-
getTowedBy
public int getTowedBy()- Returns:
- the Entity that is directly towing this one
-
setTowedBy
public void setTowedBy(int id) Sets the Entity that is directly towing this one- Parameters:
id
- - the id of the Entity towing this trailer
-
getConnectedUnits
- Returns:
- the entities towed behind this entity
-
towUnit
public void towUnit(int id) Attaches a trailer to this train- Parameters:
id
- - if of the entity to be added to this train
-
disconnectUnit
public void disconnectUnit(int id) Detaches an entity from this entity's towing mechanism also detaches all trailers behind this one from the whole train- Parameters:
id
- - the id of entity to be detached
-
getAllTowedUnits
- Returns:
- a list of all entities towed behind this tractor.
-
addTowedUnit
public void addTowedUnit(int id) Adds an entity to this tractor's train -
removeTowedUnit
public void removeTowedUnit(int id) Removes an entity from this tractor's train -
getLoadedTrailers
Get aList
of the trailers currently loaded into this payload.- Returns:
- A
List
of loadedEntity
units. This list will never benull
, but it may be empty. The returnedList
is independent from the under- lying data structure; modifying one does not affect the other.This will only return loaded trailers
-
isWeaponBlockedByTowing
public boolean isWeaponBlockedByTowing(int loc, int secondaryFacing, boolean isRear) Determine if a connected tractor/trailer prevents a weapon in the given location from firing.- Parameters:
loc
- - theint
location attempting to fire.secondaryFacing
- - theint
direction the turret is facing if the weapon is mounted there.isRear
- - aboolean
value stating if the given location is rear facing; iffalse
, the location is front facing.- Returns:
true
if a tractor/trailer unit is in the way,false
if the weapon can fire.
-
hasAbility
determine if an entity has an ability that is identified by its presence or absence only. The entity may gain this ability from different places, not exclusively the crew.- Parameters:
name
- - name of the ability as recorded in the options- Returns:
- true if the entity has this ability from some source
-
hasAbility
determine if an entity has an ability at a given level. The entity may gain this ability from different places, not exclusively the crew.- Parameters:
name
- - name of the ability as recorded in the options mechoice
- - A string indicating the given level being asked about- Returns:
- true if the entity has this ability at the given choice from some source
-
modifyPhysicalDamageForMeleeSpecialist
public int modifyPhysicalDamageForMeleeSpecialist() -
getSensorContacts
Retrieves the IDs of all entities that this entity has detected with sensors- Returns:
- the contents of this entity's sensorContacts set
-
hasSensorContactFor
public boolean hasSensorContactFor(int targetId) Checks the sensorContacts set for a specific target's ID number- Parameters:
targetId
- the ID number of the target entity to check for- Returns:
- true if the entity's sensorContacts set contains the passed-in target ID
-
addSensorContact
public void addSensorContact(int targetId) Adds the specified target entity's ID to this entity's sensorContacts- Parameters:
targetId
- the ID number of the target entity to add
-
removeSensorContact
Removes the specified target entity's ID from this entity's sensorContacts- Parameters:
targetIds
- the ID number of the target entity to remove
-
clearSensorContacts
public void clearSensorContacts()Empties this entity's sensorContacts Used when it dies or moves offboard -
getFiringSolutions
Retrieves the IDs of all entities that this entity has established firing solutions on- Returns:
- the contents of this entity's firingSolutions set
-
hasFiringSolutionFor
public boolean hasFiringSolutionFor(int targetId) Checks the firingSolutions set for a specific target's ID number- Parameters:
targetId
- the ID number of the target entity to check for- Returns:
- true if the entity's firingSolutions set contains the passed-in target ID
-
addFiringSolution
public void addFiringSolution(int targetId) Adds the specified target entity's ID to this entity's firingSolutions- Parameters:
targetId
- the ID number of the target entity to add
-
removeFiringSolution
Removes the specified target entity's ID from this entity's firingSolutions- Parameters:
targetIds
- the ID number of the target entity to remove
-
clearFiringSolutions
public void clearFiringSolutions()Empties this entity's firingSolutions Used when it dies or moves offboard -
addOffBoardObserver
public void addOffBoardObserver(int teamID) Indicate that an off-board artillery attack by this entity has been observed by a particular team -
isOffBoardObserved
public boolean isOffBoardObserved(int teamID) Has the given team observed an off-board artillery attack by this entity? -
getForceString
Description copied from interface:ForceAssignable
Returns a String representation of the force hierarchy this entity belongs to. The String contains all forces from top to bottom separated by backslash with no backslash at beginning or end. Each force is followed by a unique id separated by the vertical bar. E.g.
Regiment|1||Battalion B|11||Alpha Company|18||Battle Lance II|112
If this is not empty, the server will attempt to reconstruct the force hierarchy when it receives this entity and will empty the string. This should be used for loading/saving MULs or transfer from other sources that don't have access to the current MM game's forces, such as MekHQ or the Force Generators. At all other times, forceId should be used instead and this should return an empty string.- Specified by:
getForceString
in interfaceForceAssignable
- Returns:
- The string representation of this ForceAssignable's force
-
setForceString
Description copied from interface:ForceAssignable
Sets the force string, seeForceAssignable.getForceString()
.- Specified by:
setForceString
in interfaceForceAssignable
- Parameters:
f
- The new force string
-
getForceId
public int getForceId()- Specified by:
getForceId
in interfaceForceAssignable
- Returns:
- The unique id of the force this ForceAssignable belongs to.
-
setForceId
public void setForceId(int newId) Description copied from interface:ForceAssignable
Sets the unique id of the force this ForceAssignable belongs to.- Specified by:
setForceId
in interfaceForceAssignable
- Parameters:
newId
- the id of the new force to assign this ForceAssignable to.
-
setBloodStalkerTarget
public void setBloodStalkerTarget(int value) -
getStartingOffset
public int getStartingOffset() -
getStartingOffset
public int getStartingOffset(boolean inheritFromOwner) -
setStartingOffset
public void setStartingOffset(int startingOffset) -
getStartingWidth
public int getStartingWidth() -
getStartingWidth
public int getStartingWidth(boolean inheritFromOwner) -
setStartingWidth
public void setStartingWidth(int startingWidth) -
getStartingAnyNWx
public int getStartingAnyNWx() -
getStartingAnyNWx
public int getStartingAnyNWx(boolean inheritFromOwner) -
setStartingAnyNWx
public void setStartingAnyNWx(int i) -
getStartingAnyNWy
public int getStartingAnyNWy() -
getStartingAnyNWy
public int getStartingAnyNWy(boolean inheritFromOwner) -
setStartingAnyNWy
public void setStartingAnyNWy(int i) -
getStartingAnySEx
public int getStartingAnySEx() -
getStartingAnySEx
public int getStartingAnySEx(boolean inheritFromOwner) -
setStartingAnySEx
public void setStartingAnySEx(int i) -
getStartingAnySEy
public int getStartingAnySEy() -
getStartingAnySEy
public int getStartingAnySEy(boolean inheritFromOwner) -
setStartingAnySEy
public void setStartingAnySEy(int i) -
getBloodStalkerTarget
public int getBloodStalkerTarget() -
canActivateBloodStalker
public boolean canActivateBloodStalker()Whether this entity can activate the "blood stalker" ability -
braceLocation
public int braceLocation() -
setBraceLocation
public void setBraceLocation(int location) -
isBracing
public boolean isBracing()- Specified by:
isBracing
in interfaceTargetable
-
canBrace
public boolean canBrace() -
getBraceMPCost
public int getBraceMPCost() -
getValidBraceLocations
-
getMPBoosters
- Returns:
- does this Mek have MASC, Supercharger or both?
-
getArmedMPBoosters
- Returns:
- does this Mek have Armed MASC, Supercharger or both?
-
getMPBoosters
- Returns:
- if this Mek has MASC, Supercharger or both?
-
getMulId
public int getMulId()Returns this entity's MUL ID linking it to a unit on the online Master Unit List. Use hasMulID() to check if the entity has a valid MUL ID. -
setMulId
public void setMulId(int newId) -
hasMulId
public boolean hasMulId()Returns true when this entity has a useful MUL ID, meaning it is a unit from an official source and can be linked to a unit on the online Master Unit List. -
addClanCase
public void addClanCase()For clan units that get automatic Clan CASE, adds clan CASE in every location that has potentially explosive equipment (this includes uncharged PPC Capacitors).As clan CASE does not need critical slots, this method does not perform checks whether other CASE types are already present on a location.
This method does nothing by default and must be overridden for unit types that get Clan CASE.
-
getsAutoExternalSearchlight
public boolean getsAutoExternalSearchlight()- Returns:
- True for unit types that have an automatic external searchlight (Meks and Tanks).
-
getStrength
public int getStrength()Description copied from interface:InGameObject
Returns the current (remaining) battle strength of this unit or object. For combat units, this is the battle value (BV) or the point value (PV).- Specified by:
getStrength
in interfaceInGameObject
- Returns:
- The current battle strength (BV/PV)
-
getBvCalculator
- Returns:
- The persistent BV Calculator object for this entity.
-
gameOptions
Returns the GameOptions of this Entity's game if it has one. If game is null (happens in unit construction in MML), a new (default) options object is returned. Prefer this method over directly calling game.getOptions() to avoid NPEs in places where game is null.- Returns:
- The GameOptions of this Entity's game if it has one, otherwise a default options object.
-
setUnitRole
-
getRole
- Specified by:
getRole
in interfaceCombatRole
- Returns:
- The battlefield role (UnitRole) of this combat unit.
-
slotNumber
Returns the slot in which the given mounted equipment is in its main location. Returns -1 when the mounted is not in a valid location or cannot be found.- Parameters:
mounted
- the equipment to look for- Returns:
- the (first) slot number that holds the mounted or -1 if none can be found
-
getFluffImage
Description copied from interface:BTObject
Returns a fluff image for this unit or object to be shown e.g. in the unit summary. Important: This method returns only a fluff image that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for fluff images in the fluff images directories. For GUI, useFluffImageHelper.getFluffImage(BTObject)
instead; that method will retrieve either a unit's own fluff image or an image from the fluff images directories (if there is one). The default implementation returns null. For canon units, this will return null, as they do not store fluff images in the unit files.- Specified by:
getFluffImage
in interfaceBTObject
- Returns:
- A fluff image for this object/unit if it contains one as part of the object/unit
-
generalName
Description copied from interface:BTObject
Returns the general name or type name of this unit/object. For standard individual units, this is the chassis. For other types of units or objects this can be the full designation or a general part of the designation. Much like the chassis, this can be much more narrow than the general type of unit ("Mek"). The general name should not be empty and not return null. Return the chassis in Entity and AlphaStrikeElement.- Specified by:
generalName
in interfaceBTObject
- Returns:
- The general name / chassis
-
specificName
Description copied from interface:BTObject
Returns the specific name or type name of this unit/object. For standard individual units, this is the model. For other types of units or objects this can be a part of the designation, or empty. The specific name should not return null. Return the model in Entity and AlphaStrikeElement.- Specified by:
specificName
in interfaceBTObject
- Returns:
- The specific name / model
-
getIcon
Description copied from interface:BTObject
Returns an icon for this unit or object for the game board. Note that this is the 84 x 72 standard size icon; icons for landed large craft are not handled by this method. Important: This method returns only an icon that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for the icon through the mekset. The default implementation returns null. For canon units, this will return null, as they do not store icon images in the unit files. -
setIcon
Sets the embedded icon for this unit to the given base64 string. -
hasEmbeddedIcon
public boolean hasEmbeddedIcon()Returns true when this unit has an embedded icon, i.e. an icon stored in the unit file rather than found by the MekSet. Currently, returns false when a mode-specific icon is needed (LAMs/QVs)- Returns:
- True when this unit has an embedded icon
-
getBase64Icon
- Returns:
- The embedded icon of this unit in the full Base64Image form.
-
countForStrengthSum
public boolean countForStrengthSum()Description copied from interface:InGameObject
Returns true when the current (remaining) battle strength of this unit/object should be counted for a strength sum, e.g. if it should count for the summed battle value of a player or team. This may be false when the unit is destroyed or trapped or otherwise permanently kept from acting or when it is part of a unit group and its strength will be counted through that unit group (e.g. FighterSquadrons). SeeInGameObject.getStrength()
.- Specified by:
countForStrengthSum
in interfaceInGameObject
- Returns:
- True when the strength of this should be counted in a strength sum
-
shouldUseEdge
- Returns:
- True if the unit should use Edge based on the current options and assigned Edge points
-
hasFlotationHull
public boolean hasFlotationHull() -
hasFleeZone
public boolean hasFleeZone()- Specified by:
hasFleeZone
in interfaceDeployable
- Returns:
- True if this unit has its own area it is allowed to flee the board(s) from; false if the unit's owner should be asked instead.
-
getFleeZone
- Specified by:
getFleeZone
in interfaceDeployable
- Returns:
- The area of the board(s) this unit is allowed to flee from; the return value is only valid when
Deployable.hasFleeZone()
returns true. Normally this method should not be called, useAbstractGame.canFleeFrom(Deployable, Coords)
instead. - See Also:
-
setFleeZone
Sets the board area this unit may flee from. The area may be empty, in which case the unit may not flee. Also sets this unit to know that it has a flee zone and the owning player should not be asked to provide this information.- Parameters:
fleeZone
- The new flee zone
-
setInvalidSourceBuildReasons
public void setInvalidSourceBuildReasons(List<Entity.InvalidSourceBuildReason> invalidSourceBuildReasons) -
getInvalidSourceBuildReasons
-
canonUnitWithInvalidBuild
public boolean canonUnitWithInvalidBuild() -
isJumpingWithMechanicalBoosters
public boolean isJumpingWithMechanicalBoosters() -
setJumpingWithMechanicalBoosters
public void setJumpingWithMechanicalBoosters(boolean jumpingWithMechanicalBoosters) -
getBoardId
public int getBoardId()- Specified by:
getBoardId
in interfaceDeployable
- Specified by:
getBoardId
in interfaceTargetable
- Returns:
- The board ID of the board this targetable is on. This defaults to 0 so that any code that doesn't support multiple boards yet safely points to the first (and only) board; should eventually default to -1
-
setBoardId
public void setBoardId(int boardId) -
isInBuilding
public boolean isInBuilding()- Returns:
- True when this unit is inside of a building. Returns false when it does not have a game, is not on a board, its hex has no building or its elevation is below the basement or on or above the building.
-
isActiveOption
Returns true when this Entity's game is not null and the given boolean game option is active in the game. This is a convenience method to avoid NPEs.- Parameters:
optionName
- The name of the game option, e.g. OptionsConstants.ADVAERORULES_STRATOPS_ECM- Returns:
- True when the Entity is part of a game and the option is active in that game
-