Class Entity
- All Implemented Interfaces:
Serializable,ICarryable,Transporter,InGameObject,CombatRole,ForceAssignable,ITechnology,ITurnOrdered,PhaseUpdated,RoundUpdated,BTObject,Deployable,Targetable
- Direct Known Subclasses:
AbstractBuildingEntity,Aero,BattlefieldSupportAsset,HandheldWeapon,Infantry,Mek,ProtoMek,Tank
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface megamek.common.equipment.ICarryable
ICarryable.CarriedObjectDamageAllocation -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intThe round number when abandonment was announced.protected static int[]protected static int[]protected intaltitude is different from elevation.protected List<AmmoMounted> A list of all mounted ammo.protected int[]protected TechRatingUsed by support vehicles to define tech rating of armor.protected doubleprotected int[]protected booleanprotected intKeeps track of the current ASEW effect on this entitybooleanstatic final intprotected booleanprotected List<BombMounted> A list of all mounted bombs.protected booleanprotected booleanstatic final Stringprotected intprotected intprotected Stringprotected Camouflageprotected booleanprotected booleanprotected Stringprotected StringThe special chassis name for Clan Meks such as Timber Wolf for the Mad Cat.protected booleanprotected intprotected intKeeps track of the number of consecutive turns a radical heat sink has been used.protected booleanintprotected CriticalSlot[][]This matrix stores critical slots in the format [location][slot #].intintprotected booleanintprotected booleanprotected booleanprotected DisplacementAttackActionstatic final intstatic final intstatic final intstatic final intstatic final intbooleanstatic final intprotected booleanprotected booleanprotected booleanprotected intthis is the elevation of the Entity--with respect to the surface of the hex it's in.protected booleanprotected intprotected intintprotected TechRatingUsed by support vehicles to define tech rating of armor.A list of all mounted equipment.static final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longEntity Type ID Definitions These are used to identify the type of Entity, such as 'Mek or aero.static final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longprotected StringID settable by external sources (such as mm.net)protected intprotected booleanprotected booleanContains the ids of all entities that this entity has established a firing solution on.protected EntityFluffprotected Gamebooleanstatic final intstatic final intstatic final intprotected boolean[]protected booleanKeeps track of whether this Entity has a critically hit radical heat sink.protected booleanTrue when the entity has an undestroyed searchlight that is neither a Quirk searchlight nor a mounted (0.5t / 1slot) searchlight.intintintprotected intprotected GamePhaseKeeps track of whether this Entity should activate in a particular game phase.protected booleanprotected Base64ImageThe icon for this unit; This is empty unless the unit file has an embedded icon.protected intprotected IGameprotected booleanprotected 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 intbooleanprotected booleanprotected booleanprotected booleanFlag that determines if this Entity is a hidden unit or not (see TW pg 259).protected booleanprotected intprotected intprotected intprotected Stringprotected booleanstatic final intstatic final intprotected boolean[]protected boolean[]protected longprotected longprotected booleanUsed to determine if this Entity has made a pointblank shot so far this round.protected intprotected booleanprotected static int[]static final intstatic final intstatic final intprotected booleanprotected List<MiscMounted> A list of all remaining equipment.protected booleanprotected Stringprotected EntityMovementModeStores the current movement mode.intprotected intprotected intIf this is a unit from an official source, the MUL ID links it to its corresponding entry in the online Master Unit List.protected intprotected intprotected intprotected intprotected intstatic final StringMarker value for legacy obsolete quirk with unknown yearprotected booleanprotected Playerprotected intprotected booleanIndicates this unit has announced abandonment during the End Phase.protected EntityMovementModeprotected booleanprotected Stringbooleanbooleanprotected booleanTracks whether the RHS consecutive uses counter increased last turn.booleanprotected booleanprotected booleanprotected intUsed for Entities that are bigger than a single hex.protected booleanprotected booleanprotected booleanContains the ids of all entities that have been detected by this entity's sensors.protected booleanprotected booleanprotected booleanprotected Stringbooleanstatic final intprotected booleanprotected booleanprotected TechRatingUsed by support vehicles to define the structural tech rating (TM pg 117).protected intprotected intprotected booleanprotected static final TechAdvancementprotected static final TechAdvancementprotected static final TechAdvancementprotected static final TechAdvancementprotected intprotected intprotected intprotected intprotected booleanprotected intprotected intprotected FactionThe tech faction associated with this Entity, used to filter available tech by faction.protected intprotected List<WeaponMounted> A list of every weapon mount, including bay mounts and weapon group mountsprotected intprotected GamePhaseintprotected booleanstatic final intprotected booleanprotected booleanTracks whether the radical heat sink was actually used (processed in heat phase) last turn.protected booleanprotected booleanprotected booleanprotected int[]protected intprotected 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 doubleintprotected intFields inherited from interface megamek.common.interfaces.ITechnology
DATE_ES, DATE_NONE, DATE_PSFields inherited from interface megamek.common.units.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_I_NARC_POD, TYPE_MINEFIELD_CLEAR, TYPE_MINEFIELD_DELIVER, TYPE_SATURATION, TYPE_SEARCHLIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.voidaddAttackedByThisTurn(int entityId) voidvoidMounted<?> addBomb(EquipmentType equipmentType, int loc) indicate whether this is a bomb mountprotected voidvoidFor 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.voidaddCoolantFailureAmount(int amount) This is implemented in subclasses, do nothing in generalbooleanaddCritical(int loc, int slot, CriticalSlot cs) Attempts to set the given slot to the given critical.booleanaddCritical(int loc, CriticalSlot cs) Adds a critical to the first available slot in the location.booleanaddCritical(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 PilotingRollDataAdd 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) final voidaddEquipment(Mounted<?> mounted, int loc) Adds the given mounted equipment to the unit in the given location (front-facing).voidaddEquipment(Mounted<?> mounted, int loc, boolean rearMounted) Adds the given mounted equipment to the unit in the given location, possibly rear-facing depending on the given parameter.protected voidaddEquipment(Mounted<?> mounted, int loc, boolean rearMounted, boolean isWeaponGroup) protected voidaddEquipment(Mounted<?> mounted, int loc, boolean rearMounted, int nAmmo) voidvoidaddFiringSolution(int targetId) Adds the specified target entity's ID to this entity's firingSolutionsvoidaddGhostTargetDefensiveBonus(int amount) Increment the defensive ghost target bonus (attacks against this unit are harder).voidaddGhostTargetOffensiveBonus(int amount) Increment the offensive ghost target bonus (attacks by this unit are harder).voidaddGroundAttackedByThisTurn(int entityId) voidaddIMPHits(int missiles) Records Improved Magnetic Pulse (iATM IMP) missile hits on this unit (IO IMP rules).voidSome entities will always have certain transporters.voidvoidaddOffBoardObserver(int teamID) Indicate that an off-board artillery attack by this entity has been observed by a particular teamvoidvoidApply PSR modifier for difficult terrain in the current positionvoidaddPilotingModifierForTerrain(PilotingRollData roll, Coords c, int boardId) Apply PSR modifier for difficult terrain at the specified coordinates.voidaddPilotingModifierForTerrain(PilotingRollData roll, Coords c, int boardId, boolean enteringRubble) Apply PSR modifier for difficult terrain at the specified coordinatesvoidaddPilotingModifierForTerrain(PilotingRollData roll, MoveStep step) Apply PSR modifier for difficult terrain at the move step positionvoidvoidaddSensorContact(int targetId) Adds the specified target entity's ID to this entity's sensorContactsprotected voidaddSystemTechAdvancement(CompositeTechLevel techLevel) Incorporate dates for components that are not in the equipment list, such as engines and structure.voidaddTargetedBySwarm(int entityId, int weaponId) Add a targeting by a swarm volley from a specified entityprotected voidaddTechComponent(ITechnology tech) voidaddTowedUnit(int id) Adds an entity to this tractor's trainvoidaddTransporter(Transporter component) Add a transportation component to this Entity.voidaddTransporter(Transporter component, boolean isOmniPod) Add a transportation component to this Entity.voidaddWeaponGroup(EquipmentType equipmentType, int loc) booleanCheck for vulnerability to anti-TSM munitions.voidApplies any damage that the entity has suffered.protected intapplyGravityEffectsOnMP(int MP) voidapplyMagneticPulse(int missiles, int heatDivisor) Applies a Magnetic Pulse (MP) missile salvo that hit this unit (TO:AUE p.182).static StringarmorStringFor(int value) Parses the game's internal armor representation into a human-readable string.voidassignAMS(List<WeaponHandler> attacks) Assign AMS systems to the most dangerous incoming missile attacks.voidassignTMAMS(TeleMissileAttackAction telemissileAttack) Assign AMS systems to an incoming telemissile attack.protected voidassignWeaponQuirk(QuirkEntry quirkEntry) voidattachINarcPod(INarcPod pod) attach an iNarcPodvoidattachNarcPod(NarcPod pod) add a narc pod from this team to the Mek.abstract voidSets the internal structure for every location to appropriate undamaged values for the unit and location.intbooleanC3MasterIs(Entity e) Determines if the passedEntityis the C3 Master of this unit.intcalcElevation(Hex current, Hex next) intcalcElevation(Hex current, Hex next, int assumedElevation, boolean climb) Calculates the elevation of the entity in the next hex.final intCalculates the Battle Value of this unit.final intcalculateBattleValue(boolean ignoreC3, boolean ignoreSkill) Calculates the Battle Value of this unit.intcalculateBattleValue(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport) Calculates the Battle Value of this unit.intcalculateBattleValue(CalculationReport calculationReport) Calculates the Battle Value of this unit.intDetermine the remaining number of other C3 Master computers that can connect to thisEntity.intDetermine the remaining number of other C3 computers that can connect to thisEntity.booleanWhether this entity can activate the "blood stalker" abilitybooleanChecks whether this unit can announce abandonment of its crew in the End Phase.booleanbooleanDetermines if an entity is eligible for a phase.booleancanBePickedUp(boolean isCarrierHullDown) Returns true if the carryable object is able to be picked up.booleancanBrace()abstract booleanCan this entity change secondary facing at all?booleanbooleancanDFA()booleanReturns whether this unit's crew could leave it now: eject or abandon, the way the server's abandonEntity resolves it.booleanbooleancanFall()Only applicable to Meks, but here for convenience.booleancanFall(boolean gyroLegDamage) Only applicable to Meks, but here for convenience.booleancanFireWeapon(int location) Whether a weapon in a given location can be fired, given the entity's currently carried cargobooleancanFlee()Returns true when this unit can flee from its current position in its current state.booleanReturns true when this unit can flee from the given position in its current state.booleancanFleeFrom(Coords position) Returns true when this unit can flee from the given position.final booleanReturns true when this unit can flee in its current state.booleanReturns true if the entity can flip its armsbooleanbooleanis it possible to go down, or are we landed/just above the water/treeline? assuming passed elevation.booleanMethod to determine if an entity is currently capable of going hull-down.booleanis it possible to go up, or are we at maximum altitude? assuming passed elevation.booleancanHide()Returns whether this unit can be hidden at all (hidden units, TW pg 259): a unit in the air cannot, and unit types that can never hide override this.booleanDetermines if this entity can initiate infantry vs infantry combat (TO:AR p.169).booleanReturns true when this unit is infantry carrying a working demolition charge while in a hex containing a structure that charges can be rigged on, i.e.booleanbooleanDetermines if this object can accept the given unit.booleanDetermines if this object can accept the given unit.booleanDetermines if this object can accept the given unit.booleanbooleanDetermines whether salvage operations can be performed on the ground.booleanDetermines whether salvage operations can be performed in space scenarios.booleancanPickupCarryableObject(ICarryable carryable) booleanReturns true if the entity can pick up ground objectsbooleancanRam()booleanDetermines if this entity can reinforce ongoing infantry vs infantry combat.booleanReturns whether this unit can shut down its EI Interface.booleancanSpot()Um, basically everything can spot for LRM indirect fire.booleancanTow(int trailerId) Determines if this vehicle is currently able to tow designated trailer.booleancanTransferCriticalSlots(int loc) Returns true if this location should transfer criticalSlots to the next location inwards.booleanReturns 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.booleanIs the Entity stuck in a swamp?voidchangeHeatBuildup(int heat, String reason) Adjusts this turn's runningheatBuildupby a signed amount and records the contribution under a source label so it can be shown as an itemized breakdown on the heat-phase report.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.booleancheckForMASCFailure(MovePath md, Vector<Report> vDesc, HashMap<Integer, List<CriticalSlot>> vCriticalSlots) This function checks for masc failure.booleancheckForSuperchargerFailure(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) intcheckMovementInBuilding(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, int distance) 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.voidcheckUnstall(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.intchooseSide(Coords attackPos, boolean usePrior) voidvoidClear all bombs and bomb attacksvoidIterates over all Narc and iNarc pods attached to this entity and removes those still 'stuck' to destroyed or missing locations.voidvoidEmpties this entity's firingSolutions Used when it dies or moves offboardvoidClears the itemized heat breakdown (both buildup and dissipation).voidClear all infantry combat state (called when combat ends).voidThis clears all Narc and iNarc Pods from an Entity.voidvoidvoidEmpties this entity's sensorContacts Used when it dies or moves offboardbooleanGet the entity's "climbing mode"abstract intclipSecondaryFacing(int dir) Returns the closest valid secondary facing to the given direction.longcountEquipment(String internalName) Returns the number of equipment of the given internal name that are mounted on this unit, regardless of their working condition.booleanReturns true when the current (remaining) battle strength of this unit/object should be counted for a strength sum, e.g.intReturns the number of MiscType equipment of the given internalName, regardless of state.intintcount all the quirks for this unit, positive and negativeintcountQuirks(String grpKey) count the quirks for this unit, for a given group nameintintcountWorkingMisc(String internalName, int location) intreturn how many misc equipments with the specified flag the unit hasintcountWorkingMisc(EquipmentFlag flag, int location) protected booleanShared by thecanEjectCrew()overrides: a crew can only leave while it is aboard and alive.protected intcritStateCount(int type, int index, int loc, Predicate<CriticalSlot> slotState) booleandamage(double amount) Damages this carryable object by the given amount of damage.Damages a randomly determined bay door on the entity, if one existsintReturns the number of destroyed jump jets.booleanDamages a randomly determined docking collar on the entity, if one exists.voiddamage the door of the first bay that can load this unitintvoiddamageSystem(int type, int slot, int hits) intdamageSystem(int type, int slot, int loc, int hits) voidvoiddeployOffBoard(int round) Deploy this offboard entity at the previously specified distance and direction.voiddestroyLocation(int loc) Marks all equipment in a location on this entity as destroyed.voiddestroyLocation(int loc, boolean blownOff) Marks all equipment in a location on this entity as destroyed.voidMethod to destroy a single searchlight on an entity.voiddestroyRetractableBlade(int loc) destroys the first retractable blade critical slot foundvoiddisconnectUnit(int id) Detaches an entity from this entity's towing mechanism also detaches all trailers behind this one from the whole trainprotected intdoBattleValueCalculation(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).booleanbooleanbooleanbooleanbooleanvoiddropCarriedObject(int location) Remove a ground object (cargo) from the given locationvoiddropCarriedObject(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.voidDeprecated, for removal: This API element is subject to removal in a future version.intelevationOccupied(Hex hex) Returns the absolute elevation above ground level 0 that this entity would be on if it were placed into the specified hex.intelevationOccupied(Hex hex, int elevation) booleanbooleanHelper function to determine if an entity is a quadbooleanTwo entities are equal if their ids are equalvoidextendBlade(int loc) Set the retractable blade in the given location as extended Takes the first piece of appropriate equipmentfactionTechLevel(Faction techFaction) Returns any known displacement attacks (should only be one) that this entity is a target of.intbooleandefensively check and correct elevationPretty-prints the heat capacity of a unit, including optional heat sinking systems.protected final IGameOptionsReturns the GameOptions of this Entity's game if it has one.Returns the general name or type name of this unit/object.voidGenerates the display name for this entity.voidGenerate the short name for a unitintReturns the round number when abandonment was announced.A list of all active sub-entities.intThis counts the number of UMU's a Mek has that are still viableintgetActiveVibrobladeHeat(int location) intgetActiveVibrobladeHeat(int location, boolean ignoreMode) intintThis returns all UMU a Mek has.booleandoubleintgetAmmo()getAmmo(int index) getAmmo(WeaponMounted weapon) intintgetArmor(int loc) Returns the amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.intgetArmor(int loc, boolean rear) Returns the amount of armor in the location specified, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.intReturns the amount of armor in the location hit, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.static TechAdvancementintgetArmorForReal(int loc) intgetArmorForReal(int loc, boolean rear) doubleReturns 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 locationintgetArmorTechLevel(int loc) intgetArmorType(int loc) doubleThe total weight of the armor on this unit.doublegetArmorWeight(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.booleanReturns true if the Mek's arms are flipped to the rearintWhat entity is using this weapon to attack?intgetBadCriticalSlots(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).intWhat's the range of the BAP equipment?intgetBARRating(int loc) Return the BAR-rating of this Entity's armorgetBaseAvailability(Era era) doubleUsed by omni support vehicles to track the weight of fire control systems.doubledoubleReturns 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) intMethod that returns the mapping between locations which, if cargo is carried, block other locations from firing.intintintReturns this entity'sBoardLocation, reusing a cached instance while the position and board id are unchanged.intDetermines 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.intintbooleangetC3iNextUUIDAsString(int pos) Return the unit that is current master of this unit's C3 network.intGet the ID of the master unit in this unit's C3 network.getC3Top()getCamouflageOrElse(Camouflage camouflage) getCamouflageOrElse(Camouflage camouflage, boolean checkForces) intgetCargoMpReduction(Entity carrier) getCarriedObject(int location) Get the object carried in the given location.intReturns the number of levels the player chose to climb this turn.getClubs()getCollarById(int collarNumber) Returns the DockingCollar with the given ID or null if this unit doesn't have such a Docking Collar.intintabstract TechAdvancementreturn - the base construction option tech advancementintintfinal doublegetCost(boolean ignoreAmmo) Calculates and returns the C-bill cost of the unit.abstract doublegetCost(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.intgetCustomWeaponOrder(WeaponMounted weapon) intgetDamagedCriticalSlots(int type, int index, int loc) Number of slots damaged (but not breached) in a locationintReturns the entity's current damage level.intgetDamageLevel(boolean checkCrew) Returns the entity's current damage level.intgetDamageReductionFromModularArmor(HitData hit, int damage, Vector<Report> vDesc) A list of the "default" cargo pick up locations for when none is specifiedintgetDependentLocation(int loc) Gets the location that is destroyed recursively.intThe round the unit will be deployedReturns the display name for this entity.Returns a list of all Docking Collars (Hard points) of this unit.intgetDocks()intgetDocks(boolean forCost) Get a map of location names / transporter names and their location / index that have cargo that can be dropped.intGets the marker used to disambiguate this entity from others with the same name.intdoubleintWhat's the range of the ECM equipment? Infantry can have ECM that just covers their own hex.doubleintReturns the elevation of this target, relative to the position Hex's surfaceintintintgetEmptyCriticalSlots(int loc) Returns the number of empty critical slots in a locationintabstract intintstatic StringgetEntityMajorTypeName(long typeId) Given an Entity type, return the name of the major class it belongs to (eg: Mek, Aero, Tank, Infantry).abstract longstatic StringgetEntityTypeName(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).intgetEquipmentNum(Mounted<?> mounted) Returns the equipment number of the specified equipment, or -1 if equipment is not present.intgetExteriorUnitAt(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.intThis returns the external ID.intintgetExtinctionDate(boolean clan, Faction faction) intgetExtraC3BV(int baseBV) intintintReturns 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.Returns the Force Generator availability entries declared in this unit's file.intReturns a String representation of the force hierarchy this entity belongs to.intReturns the forward firing arc for this entity - overrided by some unitsintintgetGame()This returns the game this Entity belongs to.booleanabstract intCalculates a "generic" Battle Value that is based on the average of all units of this type and tonnage.intintintintintgetGoodCriticalSlots(int type, int index, int loc) Returns the number of operational critical slots of the specified type in the locationintintintOnly 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 headingsintgetHeat()intReturns the amount of heat that the entity can sink each turn.intgetHeatCapacity(boolean radicalHeatSink) intintReturns the modifier to weapons fire due to heat.intgetHeatInArc(int location, boolean rearMount) intintReturns 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 gameintgetHitCriticalSlots(int type, int index, int loc) Number of slots doomed, missing or destroyed in a locationintgetHittableCriticalSlots(int loc) Returns the number of operational critical slots remaining in a locationintgetIcon()Returns an icon for this unit or object for the game board.intgetId()Returns this InGameObject's id.intDeprecated, for removal: This API element is subject to removal in a future version.intintGet anEnumerationofINarcPods that are attached to this entity.intGet the ID of the target entity this infantry is engaged in combat with.intGet the number of turns this entity has been in infantry combat.intGets the initial BV of a unit.intgetInternal(int loc) Returns the amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.intgetInternal(HitData hit) Returns the amount of internal structure in the location hit.intgetInternalForReal(int loc) doubleReturns the percent of the armor remaininggetInternalString(int loc) Returns a string representing the internal structure in the locationintintgetIntroductionDate(boolean clan, Faction faction) booleanintgetJumpHeat(int movedMP) get the heat generated by this Entity when jumping for a certain amount of MPintReturns this entity's current jump jet jumping MP, not affected by terrain, factored for gravity.intgetJumpMP(MPCalculationSetting mpCalculationSetting) intReturns this entity's current jumping MP, affected by terrain (like water.)intintintgetKills()doubleintintReturns a list of DropShips launchable from any of the Transport facilities of this unit.Get aListof the trailers currently loaded into this payload.Get aListof 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[]getLocationDamage(int loc) intgetLocationFromAbbr(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[]intgetLocationStatus(int loc) returns exposure or breached flag for locationintintintintgetMASC()intintGet the number of turns MASC has been used continuously.intThe maximum elevation change the entity can crossintby default, entities can move as far down as they can move upintgetMaxElevationDown(int currElevation) Returns the maximum number of downward elevation changes a unit can make.intThe max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range.intgetMaxWeaponRange(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.intintgetMechanicalJumpBoosterMP(MPCalculationSetting mpCalculationSetting) intgetMisc()getMisc(int index) Returns the Force Generator mission roles declared in this unit's file as raw comma-separated text, e.g.static TechAdvancementgetModel()Returns the unit code for this entity.intgetMotiveSideMod(int side) The attack direction modifier for rolls on the motive system hits table for the given side (as defined inToHitData).booleanabstract StringgetMovementAbbr(EntityMovementType movementType) Returns the abbreviation of the name of the type of movement used.intgetMovementBeforeSkidPSRModifier(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 StringgetMovementString(EntityMovementType movementType) Returns the name of the type of movement used.getMPBoosters(boolean onlyArmed) intintgetMulId()Returns this entity's MUL ID linking it to a unit on the online Master Unit List.getNC3NextUUIDAsString(int pos) intgetNCrew()protected StringReturns the current neural interface mode from game options.intprotected abstract int[]intintgetNumberOfCriticalSlots(int location) intgetNumberOfCriticalSlots(int type, int index, int loc) Returns the number of critical slots present in the section, destroyed or not.intgetNumberOfCriticalSlots(EquipmentType equipmentType) Returns the number of critical slots present in the Mek, destroyed or not.intgetNumberOfCriticalSlots(EquipmentType equipmentType, int loc) Returns the number of critical slots present in the section, destroyed or not.intgetNumberOfShields(MiscTypeFlag shieldSize) Check to see how many shields of a certain size a mek has.intgetOArmor(int loc) Returns the original amount of armor in the location specified.intgetOArmor(int loc, boolean rear) Returns the original amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.intReturns the original amount of armor in the location hit.Gets the obsolete quirk value as a raw string.intgetObsoleteRepairModifier(int gameYear) Calculates the repair/parts target number modifier for an obsolete unit.doublegetObsoleteResaleModifier(int gameYear) Calculates the resale price modifier for an obsolete unit.intGets the first year when production of this obsolete unit ceased.intgetObsoleteYearForModifiers(int checkYear) Gets the most recent obsolete period start year that applies to the given year.Parses the obsolete quirk value into a list of years.Returns the direction off the board that the unit will be deployed.intGet the distance in hexes from the board that the unit will be deployed.intgetOInternal(int loc) Returns the original amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.intgetOInternal(HitData hit) Returns the original amount of internal structure in the location hit.static TechAdvancementstatic TechAdvancementintUnits 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.intReturns this entity's original jumping mp.intgetOriginalJumpMP(boolean ignoreModularArmor) intintReturns this entity's original walking movement pointsgetOwner()Returns the player that "owns" this entity.intReturns the unique id of this InGameObject's owning player.intintDeprecated, for removal: This API element is subject to removal in a future version.static TechAdvancementReturns the pending Variable Range Targeting mode to be applied next round.getPickupLocationMap(ICarryable cargo) Get a map of location names / transporter names and their location / index that could be used to transport the provided cargo.getPlayerPickedPassThrough(int attackerId) doubledoubleComputes and returns the power amplifier weight for this entity, if any.doubleReturns a multiplier that combines multiplicative construction cost modifiers for this Entity.intintgetProductionDate(boolean clan, Faction faction) intintgetPrototypeDate(boolean clan, Faction faction) intgetQuirkList(String sep) Returns a string of all the quirk "codes" for this entity, using sep as the separatorRetrieves the quirks object for entity.intReturns the rear firing arc for this entity - overrided by some unitsintReturns the recovery time for this entity in minutes.intintintgetReintroductionDate(boolean clan, Faction faction) intGetter for property removalCondition.getRole()intget the heat generated by this Entity when running/flankingintgetRunMP()intgetRunMP(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.intReturns run MP without considering any MASC systemsintget the gravity limit for ground movementbooleanbooleanintReturns the secondary facing, or -1 if n/abooleanbooleanbooleanintRetrieves the IDs of all entities that this entity has detected with sensorsA short name, suitable for displaying above a unit icon.intintintget the heat generated by this Entity when sprintingintReturns this entity's sprinting MP, modified for all its current circumstances such as gravity and damage.intgetSprintMP(MPCalculationSetting mpCalculationSetting) Returns this entity's sprinting MP, modified according to the given setting.intReturns sprint MP without considering MASCintReturns sprint MP without considering MASCintUsed to determine the draw priority of different Entity subclasses.intget the heat generated by this Entity when standing stillintintgetStartingAnyNWx(boolean inheritFromOwner) intintgetStartingAnyNWy(boolean inheritFromOwner) intintgetStartingAnySEx(boolean inheritFromOwner) intintgetStartingAnySEy(boolean inheritFromOwner) intintgetStartingOffset(boolean inheritFromOwner) intintgetStartingPos(boolean inheritFromOwner) intintgetStartingWidth(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.intReturns the current (remaining) battle strength of this unit or object.intintThis method (and getActiveSubEntities()) is meant for groups of entities handled as a singular one.intintGet the number of turns Supercharger has been used continuously.intGet the ID of theEntitythat is attacking this unit with a swarm attack.intGet the ID of theEntitythat is the current target of a swarm attack by this unit.intintbooleangetTargetedBySwarm(int entityId, int weaponId) Were we targeted by a certain swarm/swarm-i volley this turn?intintintbooleanintintintDeprecated, for removal: This API element is subject to removal in a future version.intReturns the unit tech for this entity.intEntities that use different sprites for different modes should override thisdoubleintintReturns the total amount of armor on the entity.intintReturns the total amount of internal structure on the entity.intgetTotalMunitionsOfType(WeaponMounted weapon) Determine how much ammunition (of all munition types) remains which is compatible with the given weapon.intReturns the total amount of armor on the entity.intReturns the total original amount of internal structure on the entity.intintintintintgetTransferLocation(int loc) int versionabstract HitDataGets the location that excess damage transfers to.intGet the IDEntitythat has loaded this one.doublegetTrooperAtLocation(HitData hit, Entity transport) intintshortGet the unit number of this entity.abstract intdoubledoubleReturns 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.booleanA list of all the locations that the entity can use to pick up cargo following the TacOps "one-handed" pickup rulesReturns the current Variable Range Targeting mode.intgetVariableRangeTargetingModifier(int rangeType) Returns the Variable Range Targeting modifier for the specified range type.intgetVector(int vectorFacing) int[]intintReturn how many BA vibroclaws thisEntityis equipped withintget the heat generated by this Entity when walking/cruisingintintgetWalkMP(MPCalculationSetting mpCalculationSetting) getWeapon(int index) abstract intgetWeaponArc(int weaponNumber) Returns the Rules.ARC that the weapon, specified by number, fires into.intgetWeaponFiringHeight(WeaponMounted weapon) What height is this weapon physically firing from?getWeaponFiringPosition(WeaponMounted weapon) WhatCoordsis this weapon physically firing from?Returns the values ofgetWeaponList()plus any weapons added by handheld weapons.doubleintintgetYear()booleanhasAbility(String name) determine if an entity has an ability that is identified by its presence or absence only.booleanhasAbility(String name, String choice) determine if an entity has an ability at a given level.booleanbooleanChecks to see if this unit has a functional Blue Shield Particle Field Damper that is turned onbooleanReturns whether this unit has an active DNI system providing bonuses.booleanChecks to see if this entity has a functional ECM unit that is using ECCM.booleanDoes the Mek have a functioning ECM unit?booleanhasActiveECM(boolean stealth) check if we have an active ECM unit for stealth armor purposesbooleanReturns whether this unit has an active Enhanced Imaging (EI) cockpit system.booleanbooleanReturns whether this entity has a Targeting Computer or EI Interface that is in aimed shot mode.booleanReturns true if the unit has a standard C3M/S, a Naval C3 or C3i or a Nova CEWS.booleanReturns true if any Narc or iNarc pods are attached to this unit.booleanhasArcFired(int location, boolean rearMount) booleanbooleanbooleanbooleanbooleanhasBAP()Does the Mek have a functioning BAP? This is just for the basic BAP for Beagle BloodHound WatchDog Clan Active or Light.booleanhasBAP(boolean checkECM) booleanhasBARArmor(int loc) booleanbooleanbooleanbooleanhasC3()booleanhasC3i()booleanhasC3M()Checks if the entity has a C3 Master.booleanhasC3MM()booleanhasC3S()booleanhasCase()Returns whether there is CASE anywhere on thisEntity.booleanTrue if the unit has CASE II (on any location in the case of Meks).booleanhasCASEII(int location) True if the unit has CASE II in the given location.booleanUnits 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.booleanbooleanbooleanbooleanReturns whether this unit has the DNI Cockpit Modification equipment installed.booleanReturns whether the pilot has any DNI-compatible implant (VDNI, BVDNI, or Proto DNI).booleanReturns whether this unit has DNI-induced Hard to Pilot quirk.booleanReturns whether this entity has a Drone Operating SystembooleanhasECM()booleanReturns whether this entity has an Enhanced Imaging (EI) Interface.booleanReturns true when this unit has an embedded icon, i.e.booleanbooleanbooleanReturnstrueif this unit's pre-end declaration is made per unit (it needs its own turn), as opposed to the player-wide declarations (Nova networks, Variable Range Targeting, crew abandonment, minesweeper) that a player makes once for all their units through a single dialog.booleanbooleanhasETypeFlag(long flag) Convenience method that checks whether a bit is set in the entity type field.booleanbooleanbooleanbooleanhasFiringSolutionFor(int targetId) Checks the firingSolutions set for a specific target's ID numberbooleanbooleanbooleanChecks if this entity has a working front-mounted bulldozer.booleanChecks if this entity has a front-mounted chainsaw or dual saw.booleanhasFunctionalArmAES(int location) booleanbooleanChecks if this entity has any equipment set to a Ghost Targets mode, without checking PSR success, spaceborne status, or shutdown state.booleanhasGhostTargets(boolean active) Does the Mek have a functioning ECM unit, tuned to ghost target generation?booleanbooleanhasHarJelIn(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.inthashCode()booleanChecks if the unit has a hierarchic C3 system.booleanReturns true if the entity has a hip critical slot.booleanReturns true if any iNarc pods are attached to this unit.booleanScans through the ammo on the unit for any inferno rounds.booleanReturns true if the entity has a leg actuator critical slotbooleanhasLinkedMGA(WeaponMounted mounted) booleanhasLoweredShield(int location) Does the Mek have a passive shield This should only be called by hasPassiveShield(location, rear)booleanhasLoweredShield(int location, boolean rear) Does the Mek have a passive shield This should only be called after hasShield has been called.booleanbooleanReturns true when the entity has a MiscType equipment of the given internalName, regardless of its state or location (it may be unallocated).booleanReturns true when the entity has a MiscType equipment of the given internalName, regardless of its state, in the given location.booleanhasMisc(EquipmentFlag flag) Returns true when the entity has a MiscType equipment with the given MiscTypeFlag, regardless of its state.booleanbooleanhasModularArmor(int loc) booleanhasMulId()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.booleanReturns true if any Narc pods are attached to this unit.booleanbooleanhasNhC3()Returns true if the unit has a non-hierarchic C3 system (C3i, NC3 or Nova CEWS).booleanhasNoDefenseShield(int location) Does the Mek have a shield in no defense modebooleanbooleanChecks if this unit has the Obsolete quirk set, regardless of whether the year is known.booleanbooleanbooleanbooleanbooleanhasRaisedShield(int location) Does the Mek have an active shield This should only be called by hasActiveShield(location, rear)booleanhasRaisedShield(int location, boolean rear) Does the Mek have an active shield This should only be called after hasShield has been called.booleanhasRearArmor(int loc) Does this location have rear armor?booleanChecks if this entity has a working rear-mounted bulldozer.booleanbooleanhasSCM()booleanbooleanReturns true if the given player can see this Entity, including teammates if team_vision is on.booleanhasSensorContactFor(int targetId) Checks the sensorContacts set for a specific target's ID numberbooleanDoes the Mek have any shields.booleanbooleanhasSystem(int system, int loc) booleanhasTAG()booleanReturns whether this entity has a Targeting Computer.booleanReturns whether this entity has Triple-Core Processor aimed shot capability.booleanhasUMU()This method checks to see if a unit has Underwater Maneuvering UnitsbooleanbooleanbooleanbooleanChecks if this entity has the Variable Range Targeting quirk.protected booleanbooleanbooleanChecks if this entity has a working backhoe.booleanChecks if this entity has a working bulldozer in any location.booleanhasWorkingMisc(String name) Check if the entity has an arbitrary type of misc equipmentbooleanhasWorkingMisc(EquipmentFlag flag) Check if the entity has an arbitrary type of misc equipmentbooleanhasWorkingMisc(EquipmentFlag flag, MiscTypeFlag secondaryFlag) Check if the entity has an arbitrary type of misc equipmentbooleanhasWorkingMisc(EquipmentFlag flag, MiscTypeFlag secondaryFlag, int location) Check if the entity has an arbitrary type of misc equipmentbooleanbooleanbooleanhasWorkingSystem(int system, int loc) Returns true if there is at least 1 functional system of the type specified in the locationintheight()Returns the height of the unit, that is, how many levels above its elevation it is for LOS purposes.voidhitAllCriticalSlots(int loc, int slot) Hits all critical slots of the system occupying the specified critical slot.intUsed to for cost calculations.voidDeprecated, for removal: This API element is subject to removal in a future version.protected voidvoidinitializeArmor(int val, int loc) Initializes the armor on the unit.voidinitializeInternal(int val, int loc) Initializes the internal structure on the unit.voidprotected voidSets initial TechAdvancement without equipment based on construction options.booleanReturns true if this unit has been abandoned (crew ejected but unit not destroyed).booleanisActive()Determine if this entity participate in the current game phase.booleanisActive(int turn) protected booleanisActiveOption(String optionName) Returns true when this Entity's game is not null and the given boolean game option is active in the game.booleanConvenience method to determine whether this entity should be treated as a landed aero on a ground map.booleanA method to determine if an aero has suffered 3 sensor hits.booleanbooleanConvenience method to determine whether this entity should be treated as an airborne aero on a ground map.booleanbooleanbooleanbooleanbooleanDetermines if this entity can be boarded by infantry for interior combat.booleanisBoardProhibited(Board board) booleanisBoardProhibited(BoardType boardType) booleanbooleanbooleanbooleanbooleanisCanon()booleanbooleanisCapitalFighter(boolean lounge) booleanbooleanHas this entity been captured?booleanIs this unit a carcass, a carcass can take no actionbooleanbooleanFor future reference.booleanbooleanDetermine if this unit has an active chameleon light polarization field.booleanDetermine if this unit has an active chameleon light polarization field.booleanbooleanReturns whether this unit is a chassis-familiarity-eligible type for MekHQ's Familiarity systembooleanisClan()Checks if this is a clan unit.booleanisClanArmor(int loc) booleanbooleanReturns true if this entity is currently clearing woods with a saw.booleanReturns true if this entity is currently climbing or dangling from a cliff face (TO:AR p.20).booleanbooleanabstract booleanReturns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.abstract booleanisCrippled(boolean checkCrew) Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.booleanReturns true if this entity is currently dangling from a cliff face as part of a Dangle-and-Drop maneuver (TO:AR p.20).booleanChecks to see if an entity has been deployedbooleanbooleanbooleanabstract booleanReturns TRUE if the entity has been heavily damaged.abstract booleanReturns TRUE if the entity has been lightly damaged.abstract booleanReturns TRUE if the entity has been moderately damaged.booleanisDone()booleanisDoomed()booleanbooleanReturns whether the EI Interface is currently shut down (in "Off" mode).booleanbooleanisElevationValid(int assumedElevation, Hex hex) Check if this entity can legally occupy the requested elevation.booleanisEligibleFor(GamePhase phase) Determines if an entity is eligible for a phase.booleanbooleanAn 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.booleanCheck if the entity can participate in ONGOING infantry vs.booleanPretty much anybody's eligible for movement.booleanbooleanTanks and certain other units can get a +1 bonus to MP if their move is entirely on pavement.booleanCheck if the entity has any valid targets for physical attacks.booleanChecks whether this entity has any declaration to make in the PREEND_DECLARATIONS phase, and so should be granted a turn.booleanbooleanReturns true if the other entity is an enemy of this entity.booleanbooleanbooleanbooleanbooleanReturns whether this unit is a firefighting engineer - specialized infantry that can extinguish an adjacent burning hex in place of a weapon attack (TO:AuE p.153).booleanisGhostTargetCapable(MiscMounted equipment) Returns true if the given equipment is currently set to a Ghost Targets mode and is operational.booleanbooleanbooleanOnly Meks have gyros, but this helps keep the code a bit cleaner.booleando we have a half-hit hardened armor point in the location struck by this?booleanisHidden()Returns true if this unit is currently hidden (hidden units, TW pg 259).booleanbooleanbooleanReturns true if the target is considered immobile (-4 to hit) as a target and also if it is considered immobile or temporarily or permanently immbolized for active movement.booleanisImmobile(boolean checkCrew) Returns true if the target is considered immobile (-4 to hit) as a target and also if it is considered immobile or temporarily or permanently immbolized for active movement.booleanbooleanbooleanisINarcedBy(int nTeamID) Have we been iNarced with a homing pod from that team?booleanisINarcedWith(long type) Have we been iNarced with the named pod from any team?booleanbooleanReturns true when this unit is in a hex containing a structure that demolition charges can be rigged on: a building, a bridge or a fuel tank, TO:AUE p.152.booleanCheck if this entity is the attacker in infantry combat.booleanCheck if this entity wants to withdraw from infantry combat.booleanbooleanReturns true if this carryable object should never take damage nor be destroyed, false otherwise.booleanbooleanis this entity a large craft? (dropship, jumpship, warship, or space station, see TW p.20)booleanbooleanReturns true if this entity could potentially be loaded (did not move from starting hex)booleanisLocationBad(int loc) Is this location destroyed or breached?booleanisLocationBlownOff(int loc) booleanisLocationBlownOffThisPhase(int loc) Has the indicated location been blown off this phase (as opposed to either earlier or not at all)?booleanbooleanisLocationDeadly(Coords c, int boardId) Returns true if the specified hex exists and has terrain that is deadly to this unit.booleanisLocationDoomed(int loc) Is this location destroyed or breached?final booleanisLocationProhibited(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 booleanisLocationProhibited(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 booleanReturns true if the specified hex contains some sort of prohibited terrain.final booleanisLocationProhibited(Coords c, int currElevation) booleanisLocationProhibited(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.booleanisLocationTrulyDestroyed(int loc) booleanbooleanbooleanbooleanDetermine if MASC has been used this turn.booleanreturns whether the unit is a military unit (as opposed to a civilian unit).booleanbooleanisNarcedBy(int nTeamID) has the team attached a narc pod to me?booleanisNaval()Is this a naval vessel?protected booleanReturns whether neural interface rules are enabled (either Pilot Only or Full Tracking mode).protected booleanReturns whether neural interface rules are in Full Tracking mode (hardware + pilot required).booleanDetermines if the pilot has the Nightwalker SPAfinal booleanisNOE()booleanstatic booleanisNonCanonBySource(String source, String published) booleanbooleanChecks if the unit is hardened against nuclear strikes.booleanDetermine if this unit has an active null-signature system.booleanDetermine if this unit has an active null-signature system.booleanisObsoleteInYear(int checkYear) Checks if the unit is obsolete in a given year.booleanbooleanisOffBoardObserved(int teamID) Has the given team observed an off-board artillery attack by this entity?booleanisOmni()booleanConvenience method to determine whether this entity is on a ground map with an atmospherebooleanis this entity loaded into a fighter squadron?booleanReturns true if this unit has announced abandonment and is waiting for the crew to exit during the next End Phase.booleanisPermanentlyImmobilized(boolean checkCrew) This method returns true if a unit is permanently immobilized either because its crew is dead/gone or because of damagebooleanbooleanbooleanbooleanisProne()booleanbooleanbooleanbooleanDetermine if the unit can be repaired, or only harvested for spares.booleanDetermine if the unit is just combat-losses or if it has been utterly destroyed.abstract booleanisSecondaryArcWeapon(int weaponId) Returns true if this weapon fires into the secondary facing arc.booleanReturns true if this entity is selectable for action.booleanisSensorReturn(Player spotter) Returns whether this Entity is a sensor return to the given player.booleanbooleanbooleanReturns 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.booleanbooleanIs this Entity's ICE Engine stalled?booleanbooleanDetermine if this unit has an active and working stealth system.booleanDetermine if this unit has an active and working stealth system.booleanisStuck()Is the Entity stuck in a swamp?booleanbooleanDetermine if Supercharger has been used this turn.booleanbooleanis this a naval vessel on the surface of the water?booleanReturns true if this entity is targetable for attacks.booleanReturns true if any other entities this entity knows of are making a displacement attack on this entity.booleanUsed to determine if this vehicle can be the engine/tractor for a bunch of trailersbooleanUsed to determine if this vehicle can be towed by a tractorbooleanbooleanAre we trapped inside a destroyed transport? If so we shouldn't count for BV, which is why we have this check.booleanbooleanbooleanbooleanDetermine if thisEntitywas unloaded previously this turn.booleanbooleanbooleanabstract booleanisValidSecondaryFacing(int dir) Can this entity torso/turret twist the given direction?booleanbooleanDetermine if this unit has an active void signature system that is providing its benefits.booleanDetermine if this unit has an active void signature system.booleanisWeaponBlockedAt(int loc, boolean isRear) Determine if transported units prevent a weapon in the given location from firing.booleanisWeaponBlockedByTowing(int loc, int secondaryFacing, boolean isRear) Determine if a connected tractor/trailer prevents a weapon in the given location from firing.booleanbooleanisWeaponValidForPhase(WeaponMounted mounted) Returns true if the given weapon is valid for the current phase.booleanjoinLocationAbbr(List<Integer> locations, int limit) Joins the abbreviations for the locations into a String with / as the separator.voidLoad the given unit, checking if the elevation of both units is the same.voidLoad the given unit.voidLoad the given unit.voidLoad the given unit.voidAttempts to load all weapons with ammovoidbooleanDo units load onto this entity still have active ECM/ECCM/etc.?voidloadQuirks(List<QuirkEntry> quirks) voidloadWeapon(WeaponMounted mounted) Tries to load the specified weapon with the first available ammobooleanloadWeapon(WeaponMounted mounted, AmmoMounted mountedAmmo) Tries to load the specified weapon with the specified ammo.voidloadWeaponWithSameAmmo(WeaponMounted mounted) Tries to load the specified weapon with the first available ammo of the same munition type as currently in use.booleanloadWeaponWithSameAmmo(WeaponMounted mounted, AmmoMounted mountedAmmo) Tries to load the specified weapon with the specified ammo.booleanlocationHasCase(int loc) Returns whether there is CASE protecting the location.booleanlocationIsLeg(int loc) abstract intReturns the number of locations in the entitybooleandoubleThe maximum tonnage of ground objects that can be picked up by this unitintbooleanReturns true is the entity needs a roll to stand upvoidvoidnewRound(int roundNumber) Start a new roundvoidApplies pending Nova CEWS network ID change at the start of a new round.voidApplies pending Variable Range Targeting mode change at the start of a new round.nextConversionMode(EntityMovementMode afterMode) Entities that can convert movement modes (LAMs, QuadVees) report the next mode to assume when a convert movement command is processed.booleanbooleanonSameC3NetworkAs(Entity e, boolean ignoreECM) Checks if another entity is on the same c3 network as this entitybooleanReturnstrueif this unit's owner has a demolition charge set on any building, so the owner can announce its detonation in the End Phase (TO:AUE p.152).booleanpassedOver(Targetable target) Returns true if this Entity passed over the given target during its current path.booleanWhat coords were passed through previous to the given onebooleanpassedWithin(Coords c, int dist) Did the entity pass within a certain number of hexes of these coords?voidvoidvoidpickUp(MekWarrior mw) voidpickupCarryableObject(ICarryable carryable, Integer location) Put a ground object into the given locationvoidUtility function that handles situations where a facing change imparts some kind of permanent effect to the entity.voidprocessPickupStep(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget, EntityMovementType overallMoveType) protected voidprocessPickupStepEntity(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget) voidResets techAdvancement to initial value and adjusts for all installed equipment.recordedTechLevel(Faction techFaction, int evaluationYear) Rebuilds this unit's composite tech level, recording each component as it is folded in so that a report can show where the unit's tech level comes from.voidRecover the given unit.voidvoidintReturns the elevation of the entity's highest point relative to the surface of the hex the entity is in, i.e.voidAttempts to reload any empty weapons with the first ammo foundvoidRemove all attached iNarc PodsvoidRemove all transportation components from this Entity.voidremoveCriticalSlots(int loc, CriticalSlot cs) Removes all matching critical slots from the locationvoidremoveFiringSolution(Collection<Integer> targetIds) Removes the specified target entity's ID from this entity's firingSolutionsbooleanremoveINarcPod(INarcPod pod) Remove anINarcPodfrom this entity.voidremoveMisc(String toRemove) Removes the first misc eq.booleanremovePartialCoverHits(int location, int cover, int side) voidremoveSensorContact(Collection<Integer> targetIds) Removes the specified target entity's ID from this entity's sensorContactsvoidremoveTowedUnit(int id) Removes an entity from this tractor's trainvoidvoiddo any damage to bay doorsvoidprotected voidReset bomb attacks according to what bombs are available.voidThis is implemented in subclasses, do nothing in generalvoidvoidClear the Vector of picked-up MekWarrior IDs so that MegaMek issue #3191 does not recur.voidclear out all troops listed in the transporter.voidrestore()Restores the entity after serializationabstract HitDatarollHitLocation(int table, int side) Rolls up a hit locationabstract HitDatarollHitLocation(int table, int side, int aimedLocation, AimingMode aimingMode, int cover) Rolls the to-hit numberrollMovementInBuilding(IBuilding bldg, int distance, String why, EntityMovementType overallMoveType) Calculates and returns the roll for an entity moving in buildings.protected intscmCritStateCount(Predicate<CriticalSlot> slotState) voidsetAbandonmentAnnouncedRound(int round) Sets the round number when abandonment was announced.voidsetAlreadyTwisted(boolean value) Used by TargetingPhaseDisplay.java and FiringDisplay.javavoidsetAltitude(int a) voidsetArcFired(int location, boolean rearMount) voidsetArmor(int val, int loc) Sets the amount of armor in the front location specified.voidsetArmor(int val, int loc, boolean rear) Sets the amount of armor in the location specified.voidSets the amount of armor in the location specified.voidsetArmorTechLevel(int newTL) voidsetArmorTechLevel(int newTL, int loc) voidsetArmorTechRating(int armorTechRating) voidsetArmorTechRating(TechRating armorTechRating) voidsetArmorTonnage(double ton) voidsetArmorType(int armType) voidsetArmorType(int armType, int loc) voidsetArmorType(String armType) voidsetArmorType(String armType, int loc) voidsetArmsFlipped(boolean armsFlipped) Set whether the Mek's arms are flipped to the rearvoidsetArmsFlipped(boolean armsFlipped, boolean fireEvent) Set whether the Mek's arms are flipped to the rear.voidsetASEWAffected(int turns) Sets the number of rounds that the entity is affected by an ASEW missilevoidsetAssaultDropInProgress(boolean flag) voidsetBARRating(int rating) Sets the barrier armor rating for support vehicles.voidsetBARRating(int rating, int loc) Sets the barrier armor rating in a specific location for support vehicles.voidsetBaseChassisFireConWeight(double weight) Used by omni support vehicles to set the weight of fixed fire control systems in the base chassis.voidsetBATaserShutdown(boolean value) voidsetBloodStalkerTarget(int value) voidsetBoardId(int boardId) voidsetBoobyTrapInitiated(boolean boobyTrapInitiated) voidsetBraceLocation(int location) voidsetC3ecmAffected(boolean ecmAffect) voidsetC3iNextUUIDAsString(int pos, String c3id) voidsetC3Master(int entityId, boolean reset) voidsetC3Master(Entity e, boolean reset) Set anotherEntityas C3 Master.voidvoidsetC3NetId(String c3NetId) Explicitly set the C3 Net ID using a string.voidsetC3NetId(Entity e) voidvoidvoidsetC3UUIDAsString(String c3id) voidsetCamouflage(Camouflage camouflage) voidsetCanon(boolean canon) voidsetCanUnstickByJumping(boolean arg) Set whether this Entity is stuck in a swamp or notvoidsetCaptured(boolean arg) Specify that this entity has been captured.voidsetCarcass(boolean carcass) Sets if this unit is a carcass.voidsetCarefulStand(boolean stand) voidsetCarriedObjects(Map<Integer, ICarryable> value) Deprecated, for removal: This API element is subject to removal in a future version.voidsetChassis(String chassis) sets the chassis name for this entity.voidsetClanChassisName(String name) Sets theclanChassisNamefor this unit, e.g.voidsetClearingMinefield(boolean clearingMinefield) voidsetClearingWoods(boolean clearingWoods) Sets whether this entity is currently clearing woods with a saw.voidsetClimbing(boolean climbing) Sets the climbing state (TO:AR p.20).voidsetClimbingLevelsChosen(int levels) Sets the number of levels to climb this turn.voidsetClimbMode(boolean state) voidsetCommander(boolean arg) voidsetConsecutiveRHSUses(int consecutiveRHSUses) voidsetConversionMode(int mode) Sets the unit to be in the given mode.voidsetConvertingNow(boolean converting) voidvoidsetCritical(int loc, int slot, CriticalSlot cs) Sets a critical hit slotvoidsetCustomWeaponOrder(Map<Integer, Integer> customWeaponOrder) voidsetCustomWeaponOrder(WeaponMounted weapon, int order) voidsetDangling(boolean dangling) Sets the dangling state for the Dangle-and-Drop maneuver (TO:AR p.20).voidsetDeployed(boolean deployed) Toggles if an entity has been deployedvoidsetDeployRound(int deployRound) The round the unit will be deployed.voidsetDesignValid(boolean designValid) voidsetDestroyed(boolean destroyed) voidsetDetectedByEnemy(boolean b) voidsetDisplacementAttack(DisplacementAttackAction displacementAttack) protected voidsetDisplayName(String displayName) Sets the display name for this entity.voidsetDone(boolean done) voidsetDoomed(boolean doomed) voidsetDuplicateMarker(int duplicateMarker) Sets the marker used to disambiguate this entity from others with the same name.voidsetEiShutdown(boolean shutdown) Sets the EI shutdown state by changing the EI Interface equipment mode.voidsetElevation(int elevation) Sets the current elevation of this entity above the ground.voidsetEMI(boolean inVal) voidsetEMPInterference(int rounds, boolean heat) Sets EMP mine interference effect on this entity.voidsetEMPShutdownRounds(int rounds) Sets EMP shutdown duration from EMP mine effect.voidvoidsetEngineTechRating(int engineTechRating) voidsetEngineTechRating(TechRating engineTechRating) voidsetEvading(boolean evasion) voidsetEverSeenByEnemy(boolean b) voidsetExternalId(int id) voidsetExternalIdAsString(String externalId) This sets the external ID.voidsetExternalSearchlight(boolean arg) voidsetFacing(int facing) Sets the primary facing.voidsetFallen(boolean fell) Sets if the unit has fallen in the current phase.voidsetFindingClub(boolean findingClub) voidsetFiredTsempThisTurn(boolean firedTsempThisTurn) voidsetFleeZone(HexArea fleeZone) Sets the board area this unit may flee from.voidsetForceGeneratorAvailability(List<ForceGeneratorAvailability> forceGeneratorAvailability) voidsetForceId(int newId) Sets the unique id of the force this ForceAssignable belongs to.voidSets the force string, seeForceAssignable.getForceString().voidThis sets the game the entity belongs to.voidvoidsetGrappled(int id, boolean attacker) voidsetGrappledThisRound(boolean grappled) voidsetGrappleSide(int side) voidsetHardenedArmorDamaged(HitData hit, boolean damaged) voidsetHasDamagedRHS(boolean hasDamagedRHS) voidsetHasFiredTsemp(boolean hasFiredTSEMP) voidsetHidden(boolean inVal) Set the hidden state of this entity (used for hidden units rules, TW pg 259).voidvoidsetHullDown(boolean down) voidSets the embedded icon for this unit to the given base64 string.voidsetId(int id) Sets the ID number of this Entity, which will also set the display name and short name to null.voidvoidsetIlluminated(boolean arg) voidsetImpLastTurn(int impLastTurn) Deprecated, for removal: This API element is subject to removal in a future version.voidsetInfantryCombatAttacker(boolean isAttacker) Set whether this entity is the attacker in infantry combat.voidsetInfantryCombatTargetId(int targetId) Set the ID of the target entity this infantry is engaged in combat with.voidsetInfantryCombatTurnCount(int turnCount) Set the number of turns in infantry combat.voidsetInfantryCombatWantsWithdrawal(boolean wantsWithdrawal) Set whether this entity wants to withdraw from infantry combat.voidsetInitialBV(int bv) Sets the initial BV for a unit.voidsetInternal(int val, int loc) Sets the amount of armor in the location specified.voidsetInternal(int val, HitData hit) Sets the amount of armor in the location specified.voidsetInvalidSourceBuildReasons(List<Entity.InvalidSourceBuildReason> invalidSourceBuildReasons) voidsetIsJumpingNow(boolean jumped) voidsetJumpingWithMechanicalBoosters(boolean jumpingWithMechanicalBoosters) voidvoidsetLastTarget(int id) voidvoidsetLayingMines(boolean laying) voidvoidsetLoadedThisTurn(boolean loaded) voidsetLocationBlownOff(int loc, boolean damaged) voidsetLocationBlownOffThisPhase(int loc, boolean damaged) Marks the location as blown off in the current phase.voidsetLocationStatus(int loc, int status) sets location exposurevoidsetLocationStatus(int loc, int status, boolean allowChange) sets location exposurevoidsetMadePointblankShot(boolean inVal) voidApplies the Magnetic Pulse (MP) missile effect to this unit (IO p.62).voidsetManualBV(int bv) voidsetManualShutdown(boolean tf) voidsetMASCUsed(boolean used) Set whether MASC has been used.voidsetMissionRoles(String missionRoles) voidsetMixedTech(boolean mixedTech) voidSets the unit code for this Entity.voidsetMovedBackwards(boolean back) voidsetMovementMode(EntityMovementMode movementMode) Set the movement type of the entityvoidsetMulId(int newId) voidsetNC3NextUUIDAsString(int pos, String c3id) voidsetNCrew(int crew) voidsetNeverDeployed(boolean neverDeployed) Toggles if an entity has been deployedvoidsetNewRoundNovaNetworkString(String string) Set the C3 network ID to be used on the next turn.voidvoidsetNMarines(int marines) Updates the number of marines aboardvoidsetNPassenger(int pass) voidsetOffBoard(int distance, OffBoardDirection direction) Set the unit as an off board deployment.voidsetOmni(boolean omni) voidsetOriginalBuildYear(int year) voidsetOriginalJumpMP(int jumpMP) Sets this entity's original jump movement pointsvoidsetOriginalWalkMP(int walkMP) Sets this entity's original walking movement pointsvoidvoidsetOwnerId(int ownerId) Sets the unique id of this InGameObject's owning player.voidsetPassedThrough(Vector<Coords> pass) voidsetPassedThroughBoardId(int passedThroughBoardId) voidsetPassedThroughFacing(List<Integer> passFacing) voidsetPendingAbandon(boolean pendingAbandon) Sets whether this unit has announced abandonment.voidSets the pending Variable Range Targeting mode to be applied at the start of the next round.voidsetPlayerPickedPassThrough(int attackerId, Coords c) voidsetPosition(Coords position) voidsetPosition(Coords position, boolean gameUpdate) Sets the current position of this entity on the board.voidsetPowerReverse(boolean isPowerReverse) voidsetProne(boolean prone) voidsetPublished(String published) Sets the sourcebook where this entity's record sheet was published.voidsetPublishedSources(Collection<String> publishedSources) voidvoidsetRamming(boolean b) voidForce rapid fire mode to the highest level on RAC and UAC - this is for aerospacevoidsetReckless(boolean b) voidsetRecoveryTurn(int r) voidsetRemovalCondition(int removalCondition) Setter for property removalCondition.voidsetRetreatedDirection(OffBoardDirection retreatedDirection) voidsetSalvage(boolean canSalvage) Record if the unit is just combat-losses or if it has been utterly destroyed.voidsetSearchlightOverride(boolean arg) voidsetSearchlightState(boolean arg) voidsetSecondaryFacing(int sec_facing) voidsetSecondaryFacing(int sec_facing, boolean fireEvent) Sets the secondary facing.voidsetSelfDestructedThisTurn(boolean tf) voidsetSelfDestructing(boolean selfDestructing) voidsetSelfDestructInitiated(boolean tf) voidsetShutDown(boolean shutDown) voidsetShutDownThisPhase(boolean shutDown) voidSets the source (TRO or other) of the creation of this entity.voidsetSources(Collection<String> sources) voidsetSpotTargetId(int targetId) voidsetSpotting(boolean spotting) Sets if this unit is spotting this round.voidsetStartingAnyNWx(int i) voidsetStartingAnyNWy(int i) voidsetStartingAnySEx(int i) voidsetStartingAnySEy(int i) voidsetStartingOffset(int startingOffset) voidsetStartingPos(int i) voidsetStartingWidth(int startingWidth) voidsetStartupThisPhase(boolean shutDown) voidsetStruck(boolean struck) Sets if a unit was physically struck (punch, kick, DFA, etc.).voidsetStructuralTechRating(int structuralTechRating) voidsetStructuralTechRating(TechRating structuralTechRating) voidsetStructureTechLevel(int level) voidsetStructureType(int structureType) voidsetStructureType(String structureType) voidsetStuck(boolean arg) Set weather this Entity is stuck in a swamp or notvoidsetSuperchargerUsed(boolean used) Set whether Supercharger has been used.voidsetSwarmAttackerId(int id) Record the ID of theEntitythat is attacking this unit with a swarm attack.voidsetSwarmTargetId(int id) Record the ID of theEntitythat is the current target of a swarm attack by this unit.voidsetTaggedBy(int tagger) voidsetTargetBay(int tb) voidsetTaserFeedback(int rounds) set this entity to suffer from taser feedbackvoidsetTaserInterference(int value, int rounds, boolean heat) voidsetTaserShutdownRounds(int rounds) voidsetTechFaction(Faction faction) Sets the tech faction for this entity.voidsetTechLevel(int techLevel) Sets the tech level for this Entity.voidsetTowedBy(int id) Sets the Entity that is directly towing this onevoidsetTowing(int id) Change the towed status of this entityvoidsetTractor(int id) Sets the tractor towing the train this entity is part ofvoidsetTraitorId(int id) voidsetTransportId(int transportId) Record the ID of theEntitythat has loaded this unit.voidsetTsempEffect(int tsempEffect) voidsetTurnInterrupted(boolean interrupted) voidsetUnitFileUUID(String unitFileUUID) voidsetUnitNumber(short unit) Set the unit number for this entity.voidsetUnitRole(UnitRole role) voidsetUnjammingRAC(boolean u) voidsetUnloaded(boolean unloaded) This method should only be called when needed to remove a dead swarmer's game turn.voidsetUsedRHSLastTurn(boolean usedRHSLastTurn) voidsetUsedSearchlight(boolean arg) voidsetUseManualBV(boolean bv) voidSets the current Variable Range Targeting mode.voidsetVectors(int[] v) voidsetVisibleToEnemy(boolean b) voidsetWeaponHit(WeaponMounted which) voidsetWeaponOrderChanged(boolean weaponOrderChanged) voidsetWeaponSortOrder(WeaponSortOrder weaponSortOrder) voidsetWeight(double weight) voidsetWhoCanDetect(Vector<Player> entityDetectedBy) voidsetWhoCanSee(Vector<Player> entitySeenBy) voidsetWigeLiftoffHover(boolean lifted) voidsetYear(int year) booleanshouldDeploy(int round) Returns true if the entity should be deployedbooleanshouldOffBoardDeploy(int round) Returns true if the off board entity should be deployed this round.booleanshouldUseEdge(String option) intintintintintsideTableRam(Coords src) Used to determine net velocity of ramming attackintsideTableRam(Coords src, int facing) intslotNumber(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) voidvoidvoidtaserShutdown(int turns, boolean baTaser) shut this unit down due to a Taser attackvoidSets the movement mode to the next in the conversion sequence for QuadVees, LAMs, and Meks with tracks.toString()voidtowUnit(int id) Attaches a trailer to this trainbooleanThis should eventually be true for any situation where the entity's turn was interrupted, e.g.booleanUnload the given unit.voidcycle through and update BaysbooleanupdateDuplicateMarkerAfterDelete(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.booleanbooleanusedTag()booleanOnly check for satisfied turn mode for Tanks or QuadVees in vehicle mode, or LAMs in AirMek mode.booleanGenerates a vector containing reports on all useful information about this entity.booleanbooleanChecks to see if entity was never deployedbooleanbooleanbooleanweaponFiredFrom(int loc) whichBay(int equipmentId) return the bay of the current weapon or ammobooleanTracks whether a WiGE lifted off this turn (or a LAM hovered).Methods inherited from class megamek.common.turns.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, setInitiativeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.units.BTObject
hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospace, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattlefieldSupportAsset, isBattleMek, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isUnitGroup, isVehicle, isWarShipMethods inherited from interface megamek.common.interfaces.CombatRole
hasRoleMethods inherited from interface megamek.common.interfaces.ForceAssignable
partOfForceMethods inherited from interface megamek.common.equipment.ICarryable
getCarriedObjectDamageAllocation, targetForArmHitToHitCarriedObjectMethods inherited from interface megamek.common.game.InGameObject
hasOwnerMethods inherited from interface megamek.common.interfaces.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, isLegalMethods inherited from interface megamek.common.units.Targetable
isBomber, isBuildingEntityOrGunEmplacement, isHexBeingBombed, isOnBoard, tracksHeatMethods inherited from interface megamek.common.equipment.Transporter
alwaysDamageCargoIfTransportHit, canTow, getCarryables, getNameForRecordSheets, getNumberLoadedThisTurn, getNumberUnloadedThisTurn, getTransporterType, hardpointCost, setEntity
-
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_AEROSPACE_FIGHTER
public static final long ETYPE_AEROSPACE_FIGHTER- See Also:
-
ETYPE_HANDHELD_WEAPON
public static final long ETYPE_HANDHELD_WEAPON- See Also:
-
ETYPE_BUILDING_ENTITY
public static final long ETYPE_BUILDING_ENTITY- See Also:
-
ETYPE_COMBAT_VEHICLE_ESCAPE_POD
public static final long ETYPE_COMBAT_VEHICLE_ESCAPE_POD- See Also:
-
ETYPE_BATTLEFIELD_SUPPORT_ASSET
public static final long ETYPE_BATTLEFIELD_SUPPORT_ASSET- 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:
-
MAX_NOVA_CEWS_NODES
public static final int MAX_NOVA_CEWS_NODES- See Also:
-
C3_NETWORK_ID_SEPARATOR
- See Also:
-
isC3ecmAffected
protected boolean isC3ecmAffected -
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 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 -
climbing
protected boolean climbing -
dangling
protected boolean dangling -
climbingLevelsChosen
protected int climbingLevelsChosen -
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 -
pendingAbandon
protected boolean pendingAbandonIndicates this unit has announced abandonment during the End Phase. The crew will exit during the End Phase of the following turn (TacOps:AR p.165). Only applies to Meks - vehicles abandon immediately. -
abandonmentAnnouncedRound
protected int abandonmentAnnouncedRoundThe round number when abandonment was announced. Used to ensure execution happens in a subsequent round, not the same round. -
hasExternalSearchlight
protected boolean hasExternalSearchlightTrue when the entity has an undestroyed searchlight that is neither a Quirk searchlight nor a mounted (0.5t / 1slot) searchlight. -
searchlightOverride
protected boolean searchlightOverride -
illuminated
protected boolean illuminated -
searchlightIsActive
protected boolean searchlightIsActive -
usedSearchlight
protected boolean usedSearchlight -
eiShutdown
protected boolean eiShutdown -
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 -
reportedVDNIFeedbackThisPhase
public boolean reportedVDNIFeedbackThisPhase -
baVDNINeedsFeedbackMessage
public boolean baVDNINeedsFeedbackMessage -
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
-
published
-
techFaction
The tech faction associated with this Entity, used to filter available tech by faction. -
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 -
empInterferenceRounds
protected int empInterferenceRounds -
empInterferenceHeat
protected boolean empInterferenceHeat -
empShutdownRounds
protected int empShutdownRounds -
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 this Entity has a critically hit radical heat sink. Using a flag will prevent having to iterate over all the Entity's mounted equipment -
consecutiveRHSUses
protected int consecutiveRHSUsesKeeps track of the number of consecutive turns a radical heat sink has been used. -
usedRHSLastTurn
protected boolean usedRHSLastTurnTracks whether the radical heat sink was actually used (processed in heat phase) last turn. This is needed because the equipment mode persists until newRound(), so we can't rely on hasActivatedRadicalHS() to determine if RHS was used in the previous turn. -
rhsWentUp
protected boolean rhsWentUpTracks whether the RHS consecutive uses counter increased last turn. Used to properly decrement when transitioning from using to not using RHS, similar to how MASC handles its failure level. -
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
-
OBSOLETE_UNKNOWN_MARKER
Marker value for legacy obsolete quirk with unknown year- See Also:
-
-
Constructor Details
-
Entity
public Entity()Generates a new, blank, entity.
-
-
Method Details
-
getImpLastTurn
Deprecated, for removal: This API element is subject to removal in a future version. -
setImpLastTurn
Deprecated, for removal: This API element is subject to removal in a future version. -
getUnitType
public abstract int getUnitType()- See Also:
-
defaultCrewType
-
initMilitary
public void initMilitary() -
hasViableWeapons
protected boolean hasViableWeapons() -
restore
public void restore()Restores the entity after serialization -
getId
public int getId()Description copied from interface:InGameObjectReturns 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:
getIdin 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:
setIdin 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) -
getUnitFileUUID
-
setUnitFileUUID
-
regenerateUnitFileUUID
public void regenerateUnitFileUUID() -
getOriginalChassis
-
getOriginalModel
-
getOriginalUnitFileUUID
-
storeOriginalUnitData
public void storeOriginalUnitData() -
storeSavedUnitData
public void storeSavedUnitData() -
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:
setGamein 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 theclanChassisNamefor this unit, e.g. "Timber Wolf". -
getClanChassisName
- Returns:
- The
clanChassisNamefor 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:
isIntroLevelin interfaceITechnology
-
isUnofficial
public boolean isUnofficial()- Specified by:
isUnofficialin interfaceITechnology
-
getIntroductionDateAndEra
-
getIntroductionDate
public int getIntroductionDate()- Specified by:
getIntroductionDatein interfaceITechnology
-
getIntroductionDate
- Specified by:
getIntroductionDatein 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:
getPrototypeDatein interfaceITechnology
-
getPrototypeDate
- Specified by:
getPrototypeDatein interfaceITechnology
-
getProductionDate
public int getProductionDate()- Specified by:
getProductionDatein interfaceITechnology
-
getProductionDate
- Specified by:
getProductionDatein interfaceITechnology
-
getCommonDate
public int getCommonDate()- Specified by:
getCommonDatein interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate()- Specified by:
getExtinctionDatein interfaceITechnology
-
getExtinctionDate
- Specified by:
getExtinctionDatein interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate()- Specified by:
getReintroductionDatein interfaceITechnology
-
getReintroductionDate
- Specified by:
getReintroductionDatein interfaceITechnology
-
getTechRating
- Specified by:
getTechRatingin interfaceITechnology
-
getStaticTechLevel
Description copied from interface:ITechnologyFor non-era-based usage, provide a single tech level that does not vary with date.- Specified by:
getStaticTechLevelin interfaceITechnology- Returns:
- The base rules level of the equipment or unit.
-
getTechBaseDescription
-
getTechBaseDescriptions
-
getBaseAvailability
- Specified by:
getBaseAvailabilityin interfaceITechnology
-
getExtinctionRange
- Specified by:
getExtinctionRangein interfaceITechnology
-
getConstructionTechAdvancement
return - the base construction option tech advancement -
recalculateTechAdvancement
public void recalculateTechAdvancement()Resets techAdvancement to initial value and adjusts for all installed equipment. -
recordedTechLevel
Rebuilds this unit's composite tech level, recording each component as it is folded in so that a report can show where the unit's tech level comes from. The result is calculated exactly asrecalculateTechAdvancement()calculates the unit's real tech level, so it always agrees with it.- Parameters:
techFaction- The faction to evaluate faction-specific dates forevaluationYear- The year to evaluate each component's variable tech level in- Returns:
- A composite tech level that knows every component that went into it
-
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:
isClanin interfaceITechnology- Returns:
- true if this unit is a clan unit.
- See Also:
-
isClanArmor
public boolean isClanArmor(int loc) -
getTechBase
- Specified by:
getTechBasein interfaceITechnology
-
isMixedTech
public boolean isMixedTech()- Specified by:
isMixedTechin 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()- Returns:
- True if this unit counts as superheavy (Combat Vehicles and Meks) or as a Large Support Vehicle.
-
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 byEntitytype.- 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 thatownerproperty 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:InGameObjectSets the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
setOwnerIdin interfaceInGameObject- Parameters:
ownerId- The player id of the owner of this InGameObject.
-
getOwnerId
public int getOwnerId()Description copied from interface:InGameObjectReturns the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
getOwnerIdin 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:
isEnemyOfin interfaceTargetable
-
getCrew
-
setCrew
-
getNCrew
public int getNCrew()- Returns:
- The total number of crew available to supplement marines onboarding 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) -
getPassengerCapacityWithoutBayCrew
Deprecated, for removal: This API element is subject to removal in a future version.Gets the passenger capacity of this unit excluding bay crew personnel.This method calculates the available passenger capacity by subtracting the number of bay crew members from the total passenger capacity.
- Returns:
- the passenger capacity available for non-crew passengers
- Since:
- 0.50.10
-
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:
getTargetTypein interfaceTargetable
-
getHeight
public int getHeight()Description copied from interface:TargetableReturns the height of the target, that is, how many levels above its elevation it is for LOS purposes.- Specified by:
getHeightin 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:
trueif this entity is not shut down, is not destroyed, has an active crew, and was not unloaded from a transport this turn.falseotherwise.
-
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 thisEntitywas unloaded previously this turn.- Returns:
trueif 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) -
isClimbing
public boolean isClimbing()Returns true if this entity is currently climbing or dangling from a cliff face (TO:AR p.20). Both climbing and dangling entities have the same combat restrictions (rear weapons only, no physical attacks, -2 to-hit target modifier). -
setClimbing
public void setClimbing(boolean climbing) Sets the climbing state (TO:AR p.20).- Parameters:
climbing- true if the entity is climbing
-
isDangling
public boolean isDangling()Returns true if this entity is currently dangling from a cliff face as part of a Dangle-and-Drop maneuver (TO:AR p.20). -
setDangling
public void setDangling(boolean dangling) Sets the dangling state for the Dangle-and-Drop maneuver (TO:AR p.20).- Parameters:
dangling- true if the entity is dangling
-
getClimbingLevelsChosen
public int getClimbingLevelsChosen()Returns the number of levels the player chose to climb this turn. 0 means no choice has been made yet (use max affordable). Uses 0 as sentinel to survive XStream deserialization (which defaults unset ints to 0). -
setClimbingLevelsChosen
public void setClimbingLevelsChosen(int levels) Sets the number of levels to climb this turn.- Parameters:
levels- the number of levels to climb, or 0 for no choice
-
isImmobile
public boolean isImmobile()Returns true if the target is considered immobile (-4 to hit) as a target and also if it is considered immobile or temporarily or permanently immbolized for active movement. Overriding methods should check the status of the unit (shutdown, damage) and also the status of the crew (unconscious).- Specified by:
isImmobilein interfaceTargetable- Returns:
- True if the target is considered immobile as a target and unable to move actively.
-
isImmobileForJump
public boolean isImmobileForJump() -
isImmobile
public boolean isImmobile(boolean checkCrew) Returns true if the target is considered immobile (-4 to hit) as a target and also if it is considered immobile or temporarily or permanently immbolized for active movement. Overriding methods should check the status of the unit (shutdown, damage) and - only if checkCrew is true - also the status of the crew (unconscious).- Parameters:
checkCrew- If false, ignore the fitness of the crew when determining if the entity is immobile.- Returns:
- True if the target is considered immobile as a target and unable to move actively.
-
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
-
isNotCrewedEntityType
public boolean isNotCrewedEntityType()- Returns:
- true if the unit is always uncrewed, like a Handheld Weapon or unarmed, unpowered trailer. Should not return true for remote drone OS.
-
isUncrewed
public boolean isUncrewed()- Returns:
- true if the entity's crew is null or the entity is uncrewed, like a Handheld Weapon or unarmed, unpowered trailer.
-
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 the Mek's arms are flipped to the rear -
setArmsFlipped
public void setArmsFlipped(boolean armsFlipped, boolean fireEvent) Set whether 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:
getPositionin interfaceTargetable- Returns:
- the coordinates of the hex containing the target
-
getBoardLocation
Returns this entity'sBoardLocation, reusing a cached instance while the position and board id are unchanged. The cache is validated against the current values on every call, so it can never go stale; it only rebuilds when the entity actually moves. This avoids allocating a record on every call along hot paths such as line of sight, ECM and space-map checks.- Specified by:
getBoardLocationin interfaceTargetable- See Also:
-
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- anintrepresenting 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:TargetableReturns the elevation of this target, relative to the position Hex's surface- Specified by:
getElevationin 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:
relHeightin 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 this entity updated its duplicate marker.
-
getDisplayName
Returns the display name for this entity.- Specified by:
getDisplayNamein 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.Subclasses 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 unitSubclasses 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- Specified by:
canPickupGroundObjectin interfaceTransporter
-
maxGroundObjectTonnage
public double maxGroundObjectTonnage()The maximum tonnage of ground objects that can be picked up by this unit -
canBePickedUp
public boolean canBePickedUp(boolean isCarrierHullDown) Returns true if the carryable object is able to be picked up. Units must be hull down to pick up other units, unless the unit is tall. Airborne aeros cannot be grabbed either.- Specified by:
canBePickedUpin interfaceICarryable- Parameters:
isCarrierHullDown- is the unit that's picking this up hull down, or otherwise able to pick up ground-level objects- Returns:
- true if the object can be picked up, false if it cannot
-
canPickupCarryableObject
-
pickupCarryableObject
Put a ground object into the given location -
dropCarriedObject
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. -
dropCarriedObject
public void dropCarriedObject(int location) Remove a ground object (cargo) from the given location -
dropGroundObjects
Deprecated, for removal: This API element is subject to removal in a future version.Convenience method to drop all cargo. TODO HHW - Psi -
getCarriedObject
Get the object carried in the given location. May return null. -
getCarriedObjects
-
setCarriedObjects
@Deprecated(since="0.51.0", forRemoval=true) public void setCarriedObjects(Map<Integer, ICarryable> value) Deprecated, for removal: This API element is subject to removal in a future version.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 -
getPickupLocationMap
Get a map of location names / transporter names and their location / index that could be used to transport the provided cargo.- Parameters:
cargo-ICarryablecarryable object that needs to be picked up- Returns:
- Map where the key is the
Stringname of the location or transporter, and the value is anIntegerthat is either the location on an entity, or the index of the transporter from the list of the entity's transports fromgetTransports().
-
getDropCargoLocationMap
Get a map of location names / transporter names and their location / index that have cargo that can be dropped.- Returns:
- Map where the key is the
Stringname of the location or transporter, and the value is anIntegerthat is either the location on an entity, or the index of the transporter from the list of the entity's transports fromgetTransports().
-
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 totrueto include information about the current state of equipment like MASC.- Returns:
- A string like
9(15)ifgameStateisfalseor 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
Entitygets 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-CoordsCoordinatescurrElevation- 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 according to the type of unit and type of board or if the unit cannot survive on this board; e.g., JumpShips are prohibited from entering ground maps while BA are not allowed on an atmospheric map. This refers to the various doomed... methods.
- See Also:
-
isBoardProhibited
- Returns:
- True if the given board type is prohibited to this unit according to the type of unit or if the unit cannot survive on this board; e.g., JumpShips are prohibited from entering ground maps while BA are not allowed on an atmospheric map. This refers to the various doomed... methods.
- See Also:
-
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. -
getLocationAbbreviations
-
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 (e.g. 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 whose 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 whose 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- 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
Adds the given mounted equipment to the unit in the given location (front-facing). This method adds the mounted to the right equipment lists, updates the unit's tech level and adds one-shot ammo where necessary. Overriding methods may perform more tasks. This method, by default, does *NOT* create crit slots, update or add linkages nor handle secondary locations.- Parameters:
mounted- The new equipmentloc- The location; may be Entity.LOC_NONE- Throws:
LocationFullException- When the location is full- See Also:
-
addEquipment
public void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted) throws LocationFullException Adds the given mounted equipment to the unit in the given location, possibly rear-facing depending on the given parameter. This method adds the mounted to the right equipment lists, updates the unit's tech level and adds one-shot ammo where necessary. Overriding methods may perform more tasks. This method, by default, does *NOT* create crit slots, update or add linkages nor handle secondary locations. Overrides for unit types may however do that.- Parameters:
mounted- The new equipmentloc- The location; may be Entity.LOC_NONErearMounted- True to make the equipment rear-facing- Throws:
LocationFullException- When the location is full
-
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
intcount 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
-
getWeaponListWithHHW
Returns the values ofgetWeaponList()plus any weapons added by handheld weapons. -
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_XXXsecondaryFlag- A MiscType.S_XXX or null 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 and 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 or location (it may be unallocated). 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. Note that for BA, this checks the trooper locations (squad, trooper 1...) rather than the mount locations (arm, body). For BA,BattleArmor.hasMiscInMountLocation(java.lang.String, int)can be used instead.- Parameters:
internalName- The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTERlocation- The location, e.g. Mek.LOC_LEFT_TORSO- 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 useEquipmentTypeLookupfor the internal name.- Parameters:
internalName- The EquipmentType#internalName of the equipment- Returns:
- The equipment count on this unit
-
countWorkingMisc
return how many misc equipments with the specified flag the unit has -
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_XXXsecondaryFlag- A MiscType.S_XXX or null for don't carelocation- The location to check e.g. Mek.LOC_LEFT_ARM- Returns:
- true if at least one ready item.
-
hasFrontMountedSaw
public boolean hasFrontMountedSaw()Checks if this entity has a front-mounted chainsaw or dual saw.Per TM pp.241-243, a front-mounted saw on a vehicle can be used in a modified charge attack. By default, entities do not have front-mounted saws; only vehicles (Tank subclass) can have them.
- Returns:
- true if this entity has a working front-mounted chainsaw or dual saw
-
hasWorkingBulldozer
public boolean hasWorkingBulldozer()Checks if this entity has a working bulldozer in any location.Per TacOps, a vehicle equipped with a bulldozer may clear rubble hexes and takes half the usual damage (rounded down) when it charges. By default, entities cannot mount a bulldozer; only vehicles (Tank subclass) can.
- Returns:
trueif this entity has a working bulldozer
-
hasFrontMountedBulldozer
public boolean hasFrontMountedBulldozer()Checks if this entity has a working front-mounted bulldozer.Per TacOps, a front-mounted bulldozer doubles the damage dealt to a building hex when the vehicle charges it. By default, entities do not have a front-mounted bulldozer; only vehicles (Tank subclass) can mount one.
- Returns:
trueif this entity has a working front-mounted bulldozer
-
hasRearMountedBulldozer
public boolean hasRearMountedBulldozer()Checks if this entity has a working rear-mounted bulldozer.Per TacOps, a bulldozer may be mounted on the front or rear; a rear-mounted blade (as on the Reverse Buffel) engages rubble while the vehicle backs into it. By default, entities do not have a rear-mounted bulldozer; only vehicles (Tank subclass) can mount one.
- Returns:
trueif this entity has a working rear-mounted bulldozer
-
hasWorkingBackhoe
public boolean hasWorkingBackhoe()Checks if this entity has a working backhoe.A backhoe provides fieldworks (fortification) ability and, under the unofficial rule, can clear rubble more slowly than a bulldozer. By default, entities do not have a backhoe; vehicles and Meks can mount one.
- Returns:
trueif this entity has a working backhoe
-
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.
-
changeHeatBuildup
Adjusts this turn's runningheatBuildupby a signed amount and records the contribution under a source label so it can be shown as an itemized breakdown on the heat-phase report. Positive amounts come from heat sources; negative amounts represent cooling or reductions. Contributions sharing a label are summed.- Parameters:
heat- the signed amount to adjust the running heat buildup by (positive for heat sources, negative for cooling or reductions)reason- a short human-readable source label, e.g. "Movement (Running)" or "Medium Laser"
-
getHeatBreakdown
- Returns:
- this unit's itemized heat buildup/dissipation record for the current turn (never null). Used to build the Heat Phase report's "gains N heat" / "sinks N heat" breakdown tooltips.
-
clearHeatBreakdown
public void clearHeatBreakdown()Clears the itemized heat breakdown (both buildup and dissipation). Called when heat resolves andheatBuildupis reset, so the next turn starts fresh. -
getCritical
Returns a critical hit slot -
setCritical
Sets a critical hit slot -
addCritical
Adds a critical to the first available slot in the location. If the location is invalid or Entity.LOC_NONE, this method does nothing.- 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-CriticalSlotto 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
-
removeCriticalSlots
Removes all matching critical slots from the location -
getEmptyCriticalSlots
public int getEmptyCriticalSlots(int loc) Returns the number of empty critical slots in a location -
getHittableCriticalSlots
public int getHittableCriticalSlots(int loc) Returns the number of operational critical slots remaining in a location -
canTransferCriticalSlots
public boolean canTransferCriticalSlots(int loc) Returns true if this location should transfer criticalSlots 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
Entityis a Mek and has taken enough gyro hits to destroy it
-
getGoodCriticalSlots
public int getGoodCriticalSlots(int type, int index, int loc) Returns the number of operational critical slots of the specified type in the location -
getBadCriticalSlots
public int getBadCriticalSlots(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). -
getDamagedCriticalSlots
public int getDamagedCriticalSlots(int type, int index, int loc) Number of slots damaged (but not breached) in a location -
getHitCriticalSlots
public int getHitCriticalSlots(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.
-
getWeaponFiringPosition
WhatCoordsis this weapon physically firing from?- Parameters:
weapon-WeaponMounted- Returns:
Coords
-
getWeaponFiringHeight
What height is this weapon physically firing from?- Parameters:
weapon-WeaponMounted- Returns:
- int
-
getNoOfSlots
protected abstract int[] getNoOfSlots() -
getNumberOfCriticalSlots
public int getNumberOfCriticalSlots(int location) - Returns:
- The number of total critical slots in the given location.
-
getNumberOfCriticalSlots
public int getNumberOfCriticalSlots(int type, int index, int loc) Returns the number of critical slots present in the section, destroyed or not. -
getNumberOfCriticalSlots
Returns the number of critical slots present in the section, destroyed or not. -
getNumberOfCriticalSlots
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 subclasses. -
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:
trueifshieldCountis greater than 0 elsefalse
-
getNumberOfShields
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. -
hasRaisedShield
public boolean hasRaisedShield(int location, boolean rear) Does the Mek have an active shield This should only be called after hasShield has been called. -
hasRaisedShield
public boolean hasRaisedShield(int location) Does the Mek have an active shield This should only be called by hasActiveShield(location, rear) -
hasLoweredShield
public boolean hasLoweredShield(int location, boolean rear) Does the Mek have a passive shield This should only be called after hasShield has been called. -
hasLoweredShield
public boolean hasLoweredShield(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 a shield in no defense mode -
hasUMU
public boolean hasUMU()This method checks to see if a unit has Underwater Maneuvering Units- Returns:
booleanif 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
intof usable UMU's
-
getAllUMUCount
public int getAllUMUCount()This returns all UMU a Mek has.- Returns:
intTotal 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 -
hasECM
public boolean hasECM() -
hasGhostTargets
public boolean hasGhostTargets(boolean active) Does the Mek have a functioning ECM unit, tuned to ghost target generation? -
hasGhostTargetEquipment
public boolean hasGhostTargetEquipment()Checks if this entity has any equipment set to a Ghost Targets mode, without checking PSR success, spaceborne status, or shutdown state. Used for determining turn eligibility in the PRE_FIRING phase (Standard ghost target mode).- Returns:
- true if the entity has qualifying equipment in a Ghost Targets mode
-
isGhostTargetCapable
Returns true if the given equipment is currently set to a Ghost Targets mode and is operational. Used by both turn eligibility checks and equipment selection in the PRE_FIRING phase.- Parameters:
equipment- the misc equipment to check- Returns:
- true if this equipment is generating ghost targets
-
hasActiveECCM
public boolean hasActiveECCM()Checks to see if this entity has a functional ECM unit that is using ECCM.- Returns:
trueif the entity has AngeleCM, and it is in ECCM modefalseif 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
intrange of this unit's ECM. This value will beEntity.NONEif 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
intrange of this unit's BAP. This value will beEntity.NONEif no BAP is active.
-
hasDroneOs
public boolean hasDroneOs()Returns whether this entity has a Drone Operating System -
hasTargComp
public boolean hasTargComp()Returns whether this entity has a Targeting Computer. -
hasAimModeTargComp
public boolean hasAimModeTargComp()Returns whether this entity has a Targeting Computer or EI Interface that is in aimed shot mode. This also returns true for Triple-Core Processor + VDNI/BVDNI combinations, which grant aimed shot capability as if equipped with a Targeting Computer. -
hasTCPAimedShotCapability
public boolean hasTCPAimedShotCapability()Returns whether this entity has Triple-Core Processor aimed shot capability. Per IO pg 81, MechWarriors, vehicle commanders, and fighter pilots with TCP and VDNI/BVDNI may execute aimed shots as if equipped with a Targeting Computer.- Returns:
- true if TCP + VDNI/BVDNI is active and unit type qualifies
-
getTCPInitiativeBonus
Deprecated, for removal: This API element is subject to removal in a future version.Returns the TCP initiative bonus for this entity. Per IO pg 81, MekWarriors, vehicle commanders, and fighter pilots with TCP and VDNI/BVDNI provide a +2 initiative modifier to their force's side. This bonus can be modified by command equipment (+1), shutdown (-1), ECM (-1), or EMI (-1).This method is primarily used for Individual Initiative mode where each entity rolls separately.
- Returns:
- The TCP initiative bonus (0 if entity doesn't qualify)
-
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- theintlocation to check- Returns:
- a
booleanvalue 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 has an active Nova CEWS that can communicate. Returns
falseif the unit is shutdown, off board, or the Nova CEWS is inoperable or switched to "Off" by the player.
-
hasNovaCEWS
public boolean hasNovaCEWS()- Returns:
- True if this unit has a Nova CEWS that can network (not destroyed/breached, not shutdown, not offboard).
Does NOT check the "Off" mode - network membership (net id, partner UUIDs) survives deactivation so the
previous network is restored when the CEWS is switched back on; use
hasActiveNovaCEWS()for whether the system currently functions.
-
hasMinesweeper
public boolean hasMinesweeper()- Returns:
trueif this unit mounts an operable minesweeper (TO:AuE p.138, Corrected Sixth Printing), whether or not it is currently activated. Used to offer the End-Phase activation toggle.
-
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:
trueif 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()Applies pending Nova CEWS network ID change at the start of a new round. Clears the pending change after applying it. Always clears the Nova CEWS UUID array when network changes to prevent stale UUIDs from causing unintended network connections during wireC3(). Note: Nova CEWS shares UUID array infrastructure with Naval C3 (NC3). -
setNewRoundNovaNetworkString
Set the C3 network ID to be used on the next turn. Used for reconfiguring a C3 network with Nova CEWS. -
getNewRoundNovaNetworkString
- Returns:
- C3 network id that will be switched to on the next turn, or null if no change is pending.
-
hasVariableRangeTargeting
public boolean hasVariableRangeTargeting()Checks if this entity has the Variable Range Targeting quirk.- Returns:
- true if this entity has Variable Range Targeting capability
-
getVariableRangeTargetingMode
Returns the current Variable Range Targeting mode.- Returns:
- the current VariableRangeTargetingMode
-
setVariableRangeTargetingMode
Sets the current Variable Range Targeting mode. Only applies to units with the new unified Variable Range Targeting quirk.- Parameters:
mode- the new VariableRangeTargetingMode
-
getPendingVariableRangeTargetingMode
Returns the pending Variable Range Targeting mode to be applied next round.- Returns:
- the pending mode, or null if no change is pending
-
setPendingVariableRangeTargetingMode
Sets the pending Variable Range Targeting mode to be applied at the start of the next round.- Parameters:
mode- the mode to apply next round, or null to cancel pending change
-
newRoundVariableRangeSwitch
public void newRoundVariableRangeSwitch()Applies pending Variable Range Targeting mode change at the start of a new round. Called from newRound(). -
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
Entitydoes 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
intvalue.
-
calculateFreeC3Nodes
public int calculateFreeC3Nodes()Determine the remaining number of other C3 computers that can connect to thisEntity.Please note, if this
Entityhas two C3 Master computers, then this function only returns the remaining number of C3 Slave computers that can connect.- Returns:
- a non-negative
intvalue.
-
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
Entitythat 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-nullafter 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.NONEis returned is when this unit is permanently out of the C3 network, or when it was never in a C3 network.- Returns:
- the
intID of the unit that is the master of this unit's C3 network, orEntity.NONE.
-
C3MasterIs
Determines if the passedEntityis the C3 Master of this unit.Please note, that when an
Entityis it's own C3 Master, then it is a company commander.Also note that when
nullis the master for thisEntity, then it is an independent master.- Parameters:
e- - theEntitythat may be this unit's C3 Master.- Returns:
- a
booleanthat istruewhen the passedEntityis this unit's commander. If the passed unit isn't this unit's commander, this routine returnsfalse.
-
setC3Master
Set anotherEntityas 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- - theEntitythat should be set as our C3 Master.
-
setC3Master
public void setC3Master(int entityId, boolean reset) -
onSameC3NetworkAs
-
onSameC3NetworkAs
Checks if another entity is on the same c3 network as this entity- Parameters:
e- TheEntityto check against this entityignoreECM- abooleanindicating if ECM should be ignored, we need this for c3i- Returns:
- a
booleanthat istrueif the given entity is on the same network,falseif 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. -
hitAllCriticalSlots
public void hitAllCriticalSlots(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:
newRoundin interfaceRoundUpdated- Parameters:
roundNumber- theintnumber 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- TheNarcPodto be attached.
-
attachINarcPod
attach an iNarcPod- Parameters:
pod- TheINarcPodto 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- theinttype of iNarc pod.- Returns:
trueif 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 anEnumerationofINarcPods that are attached to this entity.- Returns:
- an
EnumerationofINarcPods.
-
removeINarcPod
Remove anINarcPodfrom this entity.- Parameters:
pod- theINarcPodto be removed.- Returns:
trueif the pod was removed,falseif 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:
equalsin interfaceTargetable- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceTargetable- Overrides:
hashCodein 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 an 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 -
hasBadLegs
public boolean hasBadLegs() -
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
- Returns:
PilotingRollDatachecking 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(IBuilding 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
Entitymust 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 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). -
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'sTransporters.
-
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'sTransporters.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. -
addIntrinsicTransporters
public void addIntrinsicTransporters()Some entities will always have certain transporters. This method is overloaded to support that. -
addRoofRack
public void addRoofRack() -
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- - theEntityto be loaded.checkElev- - Whether to compare elevations (e.g. for VTOL loading infantry)- Returns:
trueif the unit can be loaded,falseotherwise.
-
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- - theEntityto be loaded.checkElev- - Whether to compare elevations (e.g. for VTOL loading infantry)height- - the height at which to consider the loader- Returns:
trueif the unit can be loaded,falseotherwise.
-
canLoad
Description copied from interface:TransporterDetermines 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:
canLoadin interfaceTransporter- Parameters:
unit- - theEntityto be loaded.- Returns:
trueif the unit can be loaded,falseotherwise.
-
load
Load the given unit.- Parameters:
unit- - theEntityto 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:
loadin 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- - theEntityto 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
-
resetPickedUpMekWarriors
public void resetPickedUpMekWarriors()Clear the Vector of picked-up MekWarrior IDs so that MegaMek issue #3191 does not recur. Called when units are initially added to the game (as they should have no carried pilots then). -
getLoadedUnits
Get aListof the units currently loaded into this payload.- Specified by:
getLoadedUnitsin interfaceTransporter- Returns:
- A
Listof loadedEntityunits. This list will never benull, but it may be empty. The returnedListis independent of 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
- 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. This shouldn't return
entities transported by
ExternalCargo, they should be picked up / dropped, not loaded/unloaded. - 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:TransporterUnload the given unit.- Specified by:
unloadin interfaceTransporter- Parameters:
unit- - theEntityto be unloaded.- Returns:
trueif the unit was contained in this space,falseotherwise.
-
resetTransporter
public void resetTransporter()Description copied from interface:Transporterclear out all troops listed in the transporter. Used by MHQ to reset units after game- Specified by:
resetTransporterin interfaceTransporter
-
getUnusedString
Description copied from interface:TransporterReturn a string that identifies the unused capacity of this transporter.- Specified by:
getUnusedStringin interfaceTransporter- Returns:
- A
Stringmeant for a human.
-
getUnused
public double getUnused()- Specified by:
getUnusedin 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
Stringmeant for a human.
-
isWeaponBlockedAt
public boolean isWeaponBlockedAt(int loc, boolean isRear) Description copied from interface:TransporterDetermine if transported units prevent a weapon in the given location from firing.- Specified by:
isWeaponBlockedAtin 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:TransporterIf 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:
getExteriorUnitAtin interfaceTransporter- Parameters:
loc- - theintlocation hit by attack.isRear- - abooleanvalue stating if the given location is rear facing; iffalse, the location is front facing.- Returns:
- The
Entitybeing transported on the outside at that location. This value will benullif no unit is transported on the outside at that location.
-
getExternalUnits
- Specified by:
getExternalUnitsin interfaceTransporter- Returns:
- list of all units carried externally by this transporter
-
getCargoMpReduction
- Specified by:
getCargoMpReductionin interfaceTransporter- Returns:
- the MP reduction due to cargo carried by this transporter
-
getTrooperAtLocation
-
setTransportId
public void setTransportId(int transportId) Record the ID of theEntitythat has loaded this unit. A unit that is unloaded can neither move nor attack for the rest of the turn.- Parameters:
transportId- - theintID of our transport. The ID is not validated. This value should beEntity.NONEif 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 IDEntitythat has loaded this one.- Returns:
- the
intID of our transport. The ID may be invalid. This value should beEntity.NONEif this unit has not been loaded.
-
isStealthActive
public boolean isStealthActive()Determine if this unit has an active and working stealth system.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a stealth system that is currently active, and it's actually working,falseif 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.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a stealth system that is currently active, and it's actually working,falseif there is no stealth system or if it is inactive.
-
isNullSigActive
public boolean isNullSigActive()Determine if this unit has an active null-signature system.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a null signature system that is currently active,falseif there is no stealth system or if it is inactive.
-
isNullSigOn
public boolean isNullSigOn()Determine if this unit has an active null-signature system.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a null signature system that is currently active,falseif 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.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a void signature system that is currently active,falseif there is no stealth system or if it is inactive.
-
isVoidSigOn
public boolean isVoidSigOn()Determine if this unit has an active void signature system.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a void signature system that is currently active,falseif 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.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a void signature system that is currently active,falseif 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.Subclasses are encouraged to override this method.
- Returns:
trueif this unit has a void signature system that is currently active,falseif 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 forrangeis not one of theEntityclass range constants, anIllegalArgumentExceptionwill be thrown.Subclasses are encouraged to override this method.
- Parameters:
range- - anintvalue that must match one of theComputeclass range constants.ae- - the entity making the attack, who maybe immune to certain kinds of stealth- Returns:
- a
TargetRollvalue that contains the stealth modifier for the given range.
-
setSwarmTargetId
public void setSwarmTargetId(int id) Record the ID of theEntitythat 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- - theintID of the swarm attack's target. The ID is not validated. This value should beEntity.NONEif this unit has stopped swarming.
-
getSwarmTargetId
public int getSwarmTargetId()Get the ID of theEntitythat is the current target of a swarm attack by this unit.- Returns:
- the
intID of the swarm attack's target The ID may be invalid. This value should beEntity.NONEif this unit is not swarming.
-
setSwarmAttackerId
public void setSwarmAttackerId(int id) Record the ID of theEntitythat is attacking this unit with a swarm attack.- Parameters:
id- - theintID of the swarm attack's attacker. The ID is not validated. This value should beEntity.NONEif the swarm attack has ended.
-
getSwarmAttackerId
public int getSwarmAttackerId()Get the ID of theEntitythat is attacking this unit with a swarm attack.- Returns:
- the
intID of the swarm attack's attacker The ID may be invalid. This value should beEntity.NONEif this unit is not being swarmed.
-
getInfantryCombatTargetId
public int getInfantryCombatTargetId()Get the ID of the target entity this infantry is engaged in combat with.- Returns:
- the target entity ID, or Entity.NONE if not in infantry combat
-
setInfantryCombatTargetId
public void setInfantryCombatTargetId(int targetId) Set the ID of the target entity this infantry is engaged in combat with.- Parameters:
targetId- the target entity ID, or Entity.NONE to clear
-
isInfantryCombatAttacker
public boolean isInfantryCombatAttacker()Check if this entity is the attacker in infantry combat.- Returns:
- true if attacker, false if defender (only meaningful if in combat)
-
setInfantryCombatAttacker
public void setInfantryCombatAttacker(boolean isAttacker) Set whether this entity is the attacker in infantry combat.- Parameters:
isAttacker- true if attacker, false if defender
-
getInfantryCombatTurnCount
public int getInfantryCombatTurnCount()Get the number of turns this entity has been in infantry combat.- Returns:
- turn count (0 = just started)
-
setInfantryCombatTurnCount
public void setInfantryCombatTurnCount(int turnCount) Set the number of turns in infantry combat.- Parameters:
turnCount- the turn count
-
incrementInfantryCombatTurnCount
Deprecated, for removal: This API element is subject to removal in a future version.Increment the infantry combat turn counter. -
isInfantryCombatWantsWithdrawal
public boolean isInfantryCombatWantsWithdrawal()Check if this entity wants to withdraw from infantry combat.- Returns:
- true if withdrawal requested
-
setInfantryCombatWantsWithdrawal
public void setInfantryCombatWantsWithdrawal(boolean wantsWithdrawal) Set whether this entity wants to withdraw from infantry combat.- Parameters:
wantsWithdrawal- true to request withdrawal
-
clearInfantryCombatState
public void clearInfantryCombatState()Clear all infantry combat state (called when combat ends). -
hasInfernoAmmo
public boolean hasInfernoAmmo()Scans through the ammo on the unit for any inferno rounds.- Returns:
trueif the unit is still loaded with Inferno rounds.falseif 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-losses or if it has been utterly destroyed.- Parameters:
canSalvage- - abooleanthat istrueif 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-losses or if it has been utterly destroyed.- Returns:
- A
booleanthat istrueif the unit has salvageable components; if this value isfalsethe unit is utterly destroyed. - See Also:
-
isRepairable
public boolean isRepairable()Determine if the unit can be repaired, or only harvested for spares.- Returns:
- A
booleanthat istrueif 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) -
isClearingWoods
public boolean isClearingWoods()Returns true if this entity is currently clearing woods with a saw.When clearing woods, weapon attacks are penalized as though the unit were moving at running/flank speed (TM pp.241-243).
- Returns:
- true if the entity is clearing woods
-
setClearingWoods
public void setClearingWoods(boolean clearingWoods) Sets whether this entity is currently clearing woods with a saw.- Parameters:
clearingWoods- true if clearing woods
-
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:
getDeployRoundin 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:
isDeployedin 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 deployedA trailer that is part of a train does not deploy on its own. It is placed with the rest of the train when its tractor deploys, in the same way a carried unit is placed with its transport. An unattached trailer still deploys normally.
-
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 boolean canFlee()Returns true when this unit can flee from its current position in its current state. 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
-
canFlee
Returns true when this unit can flee from the given position in its current state. 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
-
canFleeInState
public final boolean canFleeInState()Returns true when this unit can flee in its current state. This requires the unit to have mobility and be in control- Returns:
- True when the unit can flee given its status
-
canFleeFrom
Returns true when this unit can flee from the given position. This requires the position be 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
-
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 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. -
canLayDemolitionCharges
public boolean canLayDemolitionCharges()Returns true when this unit is infantry carrying a working demolition charge while in a hex containing a structure that charges can be rigged on, i.e. when it can lay demolition charges this turn, TO:AUE p.152. Laying demolition charges is a physical-phase action.- Returns:
- True if this unit can lay demolition charges this turn
-
isInDemolishableStructureHex
public boolean isInDemolishableStructureHex()Returns true when this unit is in a hex containing a structure that demolition charges can be rigged on: a building, a bridge or a fuel tank, TO:AUE p.152. Per the rule, the platoon only needs to spend its turns "in the target hex", so standing on top of the structure also counts.- Returns:
- True if this unit's hex contains a demolishable structure
-
isBoardable
public boolean isBoardable()Determines if this entity can be boarded by infantry for interior combat. Used for TO:AR p. 167 Infantry vs Infantry combat eligibility as a target for initiation. This will eventually include dropships, large naval vessels, and other boardable entities.- Returns:
- true if infantry can board this entity to initiate interior combat
-
canInitiateInfantryVsInfantryCombat
public boolean canInitiateInfantryVsInfantryCombat()Determines if this entity can initiate infantry vs infantry combat (TO:AR p.169). Default implementation returns false. Infantry units override this.- Returns:
- true if this entity can initiate infantry vs infantry combat
-
canReinforceInfantryVsInfantry
public boolean canReinforceInfantryVsInfantry()Determines if this entity can reinforce ongoing infantry vs infantry combat. Default implementation returns false. Infantry units override this.- Returns:
- true if this entity can reinforce infantry vs infantry combat
-
canAnnounceAbandon
public boolean canAnnounceAbandon()Checks whether this unit can announce abandonment of its crew in the End Phase. Abandonment is declared in the PREEND_DECLARATIONS phase. The base implementation returnsfalse; unit types that support abandonment (Meks, vehicles, and escape pods) override this.- Returns:
trueif this unit can announce crew abandonment
-
isEligibleForPreEndDeclarations
public boolean isEligibleForPreEndDeclarations()Checks whether this entity has any declaration to make in the PREEND_DECLARATIONS phase, and so should be granted a turn. This covers initiating new infantry vs. infantry combat plus the end-phase declarations formerly made on the end report: Nova CEWS network changes, Variable Range Targeting mode changes, crew abandonment, minesweeper activation, and detonating a demolition charge this player has set. -
ownerHasDemolitionCharge
public boolean ownerHasDemolitionCharge()Returnstrueif this unit's owner has a demolition charge set on any building, so the owner can announce its detonation in the End Phase (TO:AUE p.152). A demolition charge belongs to the player rather than a unit, so this is a player-wide condition: it grants any of the owner's units a pre-end declarations turn, which the turn collapse then reduces to one per player. Returnsfalseoff-game (e.g. unit construction). -
hasEntityScopedPreEndDeclaration
public boolean hasEntityScopedPreEndDeclaration()Returnstrueif this unit's pre-end declaration is made per unit (it needs its own turn), as opposed to the player-wide declarations (Nova networks, Variable Range Targeting, crew abandonment, minesweeper) that a player makes once for all their units through a single dialog. Used to collapse the player-wide turns to one per player while keeping the per-unit turns. -
isEligibleForInfantryVsInfantry
public boolean isEligibleForInfantryVsInfantry()Check if the entity can participate in ONGOING infantry vs. infantry combat. This is for the INFANTRY_VS_INFANTRY_COMBAT phase. -
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:
isOffBoardin 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.NONEis chosen, the distance must not be zero (0).- Parameters:
distance- theintdistance in hexes that the unit will be deployed from the board; this value must not be negative.direction- theintdirection 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
intdistance 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.NORTHIOffBoardDirections.SOUTHIOffBoardDirections.EASTIOffBoardDirections.WEST
-
deployOffBoard
public void deployOffBoard(int round) Deploy this offboard entity at the previously specified distance and direction. This should only be invoked by theServerafter 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:
trueif it has.
-
setCaptured
public void setCaptured(boolean arg) Specify that this entity has been captured.- Parameters:
arg- thebooleanvalue 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. -
setSearchlightOverride
public void setSearchlightOverride(boolean arg) -
getSearchlightOverride
public boolean getSearchlightOverride() -
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- thebooleanvalue 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- thebooleanvalue to assign
-
destroy
-
addTargetedBySwarm
public void addTargetedBySwarm(int entityId, int weaponId) Add a targeting by a swarm volley from a specified entity- Parameters:
entityId- Theintid of the shooting entityweaponId- Theintid 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- Theintid of the shooting entity we are checkingweaponId- Theintid of the launcher to check- Returns:
- a fitting
booleanvalue
-
getShortRangeModifier
public int getShortRangeModifier() -
getMediumRangeModifier
public int getMediumRangeModifier() -
getLongRangeModifier
public int getLongRangeModifier() -
getVariableRangeTargetingModifier
public int getVariableRangeTargetingModifier(int rangeType) Returns the Variable Range Targeting modifier for the specified range type. Used by Compute.java to add a separate line item in the to-hit breakdown.- Parameters:
rangeType- the range type constant fromRangeType- Returns:
- the modifier value, or 0 if the entity doesn't have Variable Range Targeting or the range type doesn't apply
-
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 -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() -
hasArtillery
public boolean hasArtillery()- Returns:
trueif this unit mounts at least one artillery weapon (regardless of whether it is currently loaded or operational)
-
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()Returns whether this entity has an Enhanced Imaging (EI) Interface. This is determined by having the EI Interface equipment installed. ProtoMeks always have EI built-in.Note: This checks for equipment presence, not whether it's functional. Use
hasActiveEiCockpit()to check if EI is currently providing benefits (includes damage checks, shutdown state, etc.).- Returns:
- true if this entity has an EI Interface
-
getNeuralInterfaceMode
Returns the current neural interface mode from game options. Returns Off for null, blank, or unrecognized values to ensure safe defaults.- Returns:
- the neural interface mode string, or
OptionsConstants.NEURAL_INTERFACE_MODE_OFFif no game context or invalid value
-
isNeuralInterfaceEnabled
protected boolean isNeuralInterfaceEnabled()Returns whether neural interface rules are enabled (either Pilot Only or Full Tracking mode).- Returns:
- true if neural interface mode is not Off
-
isNeuralInterfaceFullTracking
protected boolean isNeuralInterfaceFullTracking()Returns whether neural interface rules are in Full Tracking mode (hardware + pilot required).- Returns:
- true if neural interface mode is Full Tracking
-
hasActiveEiCockpit
public boolean hasActiveEiCockpit()Returns whether this unit has an active Enhanced Imaging (EI) cockpit system. The EI implant is the primary requirement (same pattern as DNI viaisNeuralInterfaceActive(boolean, boolean)). When tracking hardware is disabled (default), the implant alone provides EI benefits. When tracking is enabled, the unit must also have EI cockpit equipment.A voluntarily shut down EI Interface suppresses the system in every neural interface mode. Per IO p.69 a shut down interface "will deactivate the system's benefits, but will also protect the pilot from the negative effects of EI use in combat", so this check cannot be folded into the hardware requirement - the
Pilot Abilities Onlymode never evaluates that argument.- Returns:
trueif the unit has an active EI cockpit system
-
isEiShutdown
public boolean isEiShutdown()Returns whether the EI Interface is currently shut down (in "Off" mode). -
setEiShutdown
public void setEiShutdown(boolean shutdown) Sets the EI shutdown state by changing the EI Interface equipment mode. ProtoMeks and units with MDI cannot shut down EI. Per IO p.69, EI can be voluntarily shut down during the End Phase.- Parameters:
shutdown- true to shut down EI (set to "Off" mode), false to activate it (set to "On" mode)
-
canShutdownEi
public boolean canShutdownEi()Returns whether this unit can shut down its EI Interface. ProtoMeks cannot shut down EI (it's integral to their design). Units with MDI (Machine/Direct Interface) cannot shut down EI. Per IO p.69. -
hasDNICockpitMod
public boolean hasDNICockpitMod()Returns whether this unit has the DNI Cockpit Modification equipment installed.- Returns:
- true if the unit has DNI cockpit modification equipment
-
hasDNIImplant
public boolean hasDNIImplant()Returns whether the pilot has any DNI-compatible implant (VDNI, BVDNI, or Proto DNI).- Returns:
- true if the pilot has a DNI-compatible implant
-
hasActiveDNI
public boolean hasActiveDNI()Returns whether this unit has an active DNI system providing bonuses. When the "Track Neural Interface Hardware" option is enabled, this requires both the DNI cockpit modification equipment and a pilot with a compatible implant. When tracking is disabled, only the implant is required.- Returns:
- true if the unit has an active DNI system
-
isLayingMines
public boolean isLayingMines() -
setLayingMines
public void setLayingMines(boolean laying) -
canLayMine
public boolean canLayMine() -
sideTable
- Specified by:
sideTablein interfaceTargetable- Returns:
- side hit from location
-
sideTable
- Specified by:
sideTablein 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 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). -
canHide
public boolean canHide()Returns whether this unit can be hidden at all (hidden units, TW pg 259): a unit in the air cannot, and unit types that can never hide override this. Whether it is currently hidden isisHidden(). -
canEjectCrew
public boolean canEjectCrew()Returns whether this unit's crew could leave it now: eject or abandon, the way the server's abandonEntity resolves it. False here; the unit types whose crews can leave override it, each with its own conditions on top of the sharedcrewCanLeave(). -
crewCanLeave
protected boolean crewCanLeave()Shared by thecanEjectCrew()overrides: a crew can only leave while it is aboard and alive. -
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:
-
isAbandoned
public boolean isAbandoned()Returns true if this unit has been abandoned (crew ejected but unit not destroyed). Base implementation returns false; subclasses like Mek override this.- Returns:
- true if abandoned, false otherwise
-
isFirefighter
public boolean isFirefighter()Returns whether this unit is a firefighting engineer - specialized infantry that can extinguish an adjacent burning hex in place of a weapon attack (TO:AuE p.153). The base implementation returnsfalse;ConvInfantryoverrides this for platoons carrying the FIRE_ENGINEERS specialization. Putting the check here lets callers askentity.isFirefighter()without first testinginstanceof ConvInfantry.- Returns:
trueif this unit is a firefighting-engineer platoon,falseotherwise
-
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:
isAirborneVTOLorWIGEin 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()- Returns:
- The ID of a unit that this unit is grappling or grappled by; Entity.NONE if not grappling anything and not being grappled.
-
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() -
getGhostTargetDefensiveBonus
public int getGhostTargetDefensiveBonus()- Returns:
- the accumulated to-hit bonus for attacks AGAINST this unit from friendly ghost targets (Standard mode only, per TO:AR)
-
getGhostTargetOffensiveBonus
public int getGhostTargetOffensiveBonus()- Returns:
- the accumulated to-hit bonus for attacks BY this unit from enemy ghost targets (Standard mode only, per TO:AR)
-
addGhostTargetDefensiveBonus
public void addGhostTargetDefensiveBonus(int amount) Increment the defensive ghost target bonus (attacks against this unit are harder). Capped at +3 per TO:AR rules.- Parameters:
amount- the amount to add (typically +1 per successful ghost target roll)
-
addGhostTargetOffensiveBonus
public void addGhostTargetOffensiveBonus(int amount) Increment the offensive ghost target bonus (attacks by this unit are harder). Capped at +3 per TO:AR rules.- Parameters:
amount- the amount to add (typically +1 per successful ghost target roll)
-
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 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 thisEntityis 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() -
setMagneticPulseHit
public void setMagneticPulseHit()Applies the Magnetic Pulse (MP) missile effect to this unit (IO p.62). While active the unit takes a +1 to-hit penalty on all of its own weapon attacks. Additional MP hits do not extend or stack the effect. -
getMagneticPulseRounds
public int getMagneticPulseRounds() -
applyMagneticPulse
public void applyMagneticPulse(int missiles, int heatDivisor) Applies a Magnetic Pulse (MP) missile salvo that hit this unit (TO:AUE p.182). MP missiles deal no damage; they impose a +1 to-hit penalty on the unit's own weapon attacks, and add outside heat to fusion-powered units at +1 perheatDivisorwarheads (5 for LRM, 3 for SRM, rounded down). MP missiles have no effect against conventional infantry.- Parameters:
missiles- number of MP warheads that hit this unitheatDivisor- warheads needed per +1 heat (5 for LRM, 3 for SRM)
-
setEMPInterference
public void setEMPInterference(int rounds, boolean heat) Sets EMP mine interference effect on this entity.- Parameters:
rounds- Number of rounds the interference lastsheat- true if the entity suffers +5 heat per turn (Meks/Aero)
-
getEMPInterferenceRounds
public int getEMPInterferenceRounds()- Returns:
- Number of rounds remaining for EMP interference effect
-
hasEMPInterferenceHeat
public boolean hasEMPInterferenceHeat()- Returns:
- true if this entity suffers +5 heat per turn from EMP interference
-
setEMPShutdownRounds
public void setEMPShutdownRounds(int rounds) Sets EMP shutdown duration from EMP mine effect.- Parameters:
rounds- Number of turns the unit is shutdown
-
getEMPShutdownRounds
public int getEMPShutdownRounds()- Returns:
- Number of rounds remaining for EMP shutdown effect
-
addIMPHits
public void addIMPHits(int missiles) Records Improved Magnetic Pulse (iATM IMP) missile hits on this unit (IO IMP rules). The hit count drives the to-hit, movement and hostile-ECM effects (seegetImpToHitModifier(),getImpMpReduction()). Only fusion-powered units also take outside heat, at +1 per 3 warheads that hit (rounded down, with the remainder carried across the turn's salvos).- Parameters:
missiles- number of IMP warheads that hit this unit
-
getImpToHitModifier
public int getImpToHitModifier()- Returns:
- the +to-hit penalty this unit currently suffers on its own weapon attacks from iATM IMP missiles: +1 per 3 warheads that hit, capped at +2 (or +3 for ProtoMeks). This applies to fusion and non-fusion units alike (IO IMP rules).
-
getImpMpReduction
public int getImpMpReduction()- Returns:
- the Walking/Cruise and Jumping/Thrust MP reduction this unit currently suffers from iATM IMP missiles: -1 per 3 warheads that hit, capped at -2 (or -3 for ProtoMeks). Non-fusion units ignore this reduction (IO IMP rules).
-
isImpEcmAffected
public boolean isImpEcmAffected()- Returns:
trueif this unit is currently treated as standing inside a hostile standard ECM field because of Improved Magnetic Pulse (iATM IMP) missile hits (IO IMP rules). Becomes true once at least 3 IMP warheads are affecting the unit (the same threshold as the +1 to-hit effect). Applies to fusion and non-fusion units alike.
-
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 load 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- theReportVectorcontaining 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
-
getSources
-
setSources
-
setPublished
Sets the sourcebook where this entity's record sheet was published.- Parameters:
published- The sourcebook name
-
getPublished
-
getPublishedSources
-
setPublishedSources
-
isNonCanonBySource
public boolean isNonCanonBySource()- Returns:
- true when the unit has no sourcebook entries or all listed sourcebooks are non-canon or cannot be loaded.
-
isNonCanonBySource
- Returns:
- true when no sourcebook entries are present or all listed sourcebooks are non-canon or cannot be loaded.
-
setTechFaction
Sets the tech faction for this entity.- Parameters:
faction- The faction to set, or Faction.NONE for no faction
-
getTechFaction
- Returns:
- The tech faction for this entity, or Faction.NONE if not set.
-
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
-
hasDNIInducedHardToPilot
public boolean hasDNIInducedHardToPilot()Returns whether this unit has DNI-induced Hard to Pilot quirk. Per IO p.83, units with DNI Cockpit Modification gain the Hard to Pilot quirk when piloted by someone without a compatible DNI implant (VDNI, BVDNI, or Proto DNI). This only applies in Full Tracking mode.- Returns:
- true if DNI cockpit induces Hard to Pilot quirk
-
getObsoleteQuirkValue
Gets the obsolete quirk value as a raw string. Format is comma-separated years: "obsoleteYear,reintroYear,obsoleteYear2,reintroYear2,..."- Returns:
- The raw obsolete quirk string, or empty string if not set
-
getObsoleteYears
Parses the obsolete quirk value into a list of years. Format: "obsoleteYear,reintroYear,obsoleteYear2,..." where pairs define obsolete periods.- Returns:
- List of years parsed from the obsolete quirk, empty list if not set or if set to "unknown"
-
hasObsoleteQuirk
public boolean hasObsoleteQuirk()Checks if this unit has the Obsolete quirk set, regardless of whether the year is known. Use this to check if the quirk is active. Use isObsoleteInYear() to check if the unit is obsolete at a specific year.- Returns:
- true if the Obsolete quirk is set (even if year is unknown)
-
getObsoleteYear
public int getObsoleteYear()Gets the first year when production of this obsolete unit ceased. Kept for backward compatibility - use isObsoleteInYear() for full cycle support.- Returns:
- The first year production ceased, or 0 if the unit doesn't have the Obsolete quirk
-
isObsoleteInYear
public boolean isObsoleteInYear(int checkYear) Checks if the unit is obsolete in a given year. Handles multiple obsolete/reintroduction cycles. Format: "2950,3146,3200" means obsolete 2950-3145, available 3146-3199, obsolete 3200+- Parameters:
checkYear- The year to check- Returns:
- true if the unit is obsolete in that year
-
getObsoleteYearForModifiers
public int getObsoleteYearForModifiers(int checkYear) Gets the most recent obsolete period start year that applies to the given year. Used for calculating repair modifiers based on how long the unit has been obsolete.- Parameters:
checkYear- The year to check- Returns:
- The start year of the current obsolete period, or 0 if not obsolete
-
getObsoleteRepairModifier
public int getObsoleteRepairModifier(int gameYear) Calculates the repair/parts target number modifier for an obsolete unit. Per the rules: +1 TN per 15 years after production ceased, maximum +5.- Parameters:
gameYear- The current game year- Returns:
- The TN modifier (0 to +5), or 0 if not obsolete
-
getObsoleteResaleModifier
public double getObsoleteResaleModifier(int gameYear) Calculates the resale price modifier for an obsolete unit. Per the rules: -10% per 20 years after production ceased, minimum 50%.- Parameters:
gameYear- The current game year- Returns:
- The resale multiplier (0.5 to 1.0), or 1.0 if not obsolete
-
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:
isAirbornein 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 un-deployed. 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:
getAltitudein 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:
getSecondaryPositionsin interfaceTargetable
-
hasActiveBlueShield
public boolean hasActiveBlueShield()Checks to see if this unit has a functional Blue Shield Particle Field Damper that is turned on- Returns:
trueif the entity has a working, switched on blue fieldfalseotherwise
-
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? -
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. Note that this is checked by comparing actual armor types (and tech level) across the locations - in other words, it is *not* a simple boolean flag; instead, the result will always correspond to the unit's armoring.
-
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
intnumber of turns MASC has been used.
-
isMASCUsed
public boolean isMASCUsed()Determine if MASC has been used this turn.- Returns:
trueif 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
intnumber of turns Supercharger has been used.
-
isSuperchargerUsed
public boolean isSuperchargerUsed()Determine if Supercharger has been used this turn.- Returns:
trueif 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- Thebooleanwhether 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- Thebooleanwhether 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 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) -
isPendingAbandon
public boolean isPendingAbandon()Returns true if this unit has announced abandonment and is waiting for the crew to exit during the next End Phase.- Returns:
- true if abandonment is pending
-
setPendingAbandon
public void setPendingAbandon(boolean pendingAbandon) Sets whether this unit has announced abandonment. Used during End Phase processing to track two-phase abandonment for Meks.- Parameters:
pendingAbandon- true if abandonment has been announced
-
getAbandonmentAnnouncedRound
public int getAbandonmentAnnouncedRound()Returns the round number when abandonment was announced.- Returns:
- the round number, or -1 if not announced
-
setAbandonmentAnnouncedRound
public void setAbandonmentAnnouncedRound(int round) Sets the round number when abandonment was announced.- Parameters:
round- the round number
-
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
Entityis 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
Entityis 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:
newPhasein interfacePhaseUpdated
-
isUnderwater
public boolean isUnderwater()- Returns:
- True if this entity is completely submerged.
-
getOccupiedHex
-
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() -
getTechLevelYears
- Returns:
- Years that can satisfy technology availability checks for this unit.
-
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() -
activateRadicalHS
Deprecated, for removal: This API element is subject to removal in a future version. -
hasWorkingRadicalHS
public boolean hasWorkingRadicalHS() -
getConsecutiveRHSUses
public int getConsecutiveRHSUses() -
setConsecutiveRHSUses
public void setConsecutiveRHSUses(int consecutiveRHSUses) -
hasDamagedRHS
public boolean hasDamagedRHS() -
setHasDamagedRHS
public void setHasDamagedRHS(boolean hasDamagedRHS) -
hasUsedRHSLastTurn
public boolean hasUsedRHSLastTurn() -
setUsedRHSLastTurn
public void setUsedRHSLastTurn(boolean usedRHSLastTurn) -
hasRHSWentUp
public boolean hasRHSWentUp() -
addAttackedByThisTurn
public void addAttackedByThisTurn(int entityId) -
addGroundAttackedByThisTurn
public void addGroundAttackedByThisTurn(int entityId) -
clearAttackedByThisTurn
public void clearAttackedByThisTurn() -
getAttackedByThisTurn
-
getGroundAttackedByThisTurn
-
getWeaponSortOrder
-
setWeaponSortOrder
-
getCustomWeaponOrder
-
setCustomWeaponOrder
-
getCustomWeaponOrder
-
setCustomWeaponOrder
-
isWeaponOrderChanged
public boolean isWeaponOrderChanged() -
setWeaponOrderChanged
public void setWeaponOrderChanged(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.
-
hasOriginalBuildYear
public boolean hasOriginalBuildYear() -
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
TankTrailerHitchcorresponding 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 theEntityto be towed.- Returns:
trueif the trailer can be towed,falseotherwise.
-
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 aListof the trailers currently loaded into this payload.- Returns:
- A
Listof loadedEntityunits. This list will never benull, but it may be empty. The returnedListis independent of 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- - theintlocation attempting to fire.secondaryFacing- - theintdirection the turret is facing if the weapon is mounted there.isRear- - abooleanvalue stating if the given location is rear facing; iffalse, the location is front facing.- Returns:
trueif a tractor/trailer unit is in the way,falseif 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:ForceAssignableReturns 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:
getForceStringin interfaceForceAssignable- Returns:
- The string representation of this ForceAssignable's force
-
setForceString
Description copied from interface:ForceAssignableSets the force string, seeForceAssignable.getForceString().- Specified by:
setForceStringin interfaceForceAssignable- Parameters:
f- The new force string
-
getForceId
public int getForceId()- Specified by:
getForceIdin interfaceForceAssignable- Returns:
- The unique id of the force this ForceAssignable belongs to.
-
setForceId
public void setForceId(int newId) Description copied from interface:ForceAssignableSets the unique id of the force this ForceAssignable belongs to.- Specified by:
setForceIdin 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:
isBracingin 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:InGameObjectReturns 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:
getStrengthin 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 gameOptions() 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:
getRolein interfaceCombatRole- Returns:
- The battlefield role (UnitRole) of this combat unit.
-
getForceGeneratorAvailability
Returns the Force Generator availability entries declared in this unit's file. Empty for units that do not declare any, which is every canon unit; those get their availability from data/forcegenerator instead.- Returns:
- the availability entries, never
null
-
setForceGeneratorAvailability
public void setForceGeneratorAvailability(List<ForceGeneratorAvailability> forceGeneratorAvailability) -
getMissionRoles
Returns the Force Generator mission roles declared in this unit's file as raw comma-separated text, e.g. "fire_support,urban". Blank when the file declares none, in which case the Force Generator derives roles from the unit itself.- Returns:
- the mission role text, never
null
-
setMissionRoles
-
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:BTObjectReturns 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, use
FluffImageHelper.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:
getFluffImagein interfaceBTObject- Returns:
- A fluff image for this object/unit if it contains one as part of the object/unit
-
generalName
Description copied from interface:BTObjectReturns 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:
generalNamein interfaceBTObject- Returns:
- The general name / chassis
-
specificName
Description copied from interface:BTObjectReturns 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:
specificNamein interfaceBTObject- Returns:
- The specific name / model
-
getIcon
Description copied from interface:BTObjectReturns 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:InGameObjectReturns 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:
countForStrengthSumin 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:
hasFleeZonein 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:
getFleeZonein 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:
getBoardIdin interfaceDeployable- Specified by:
getBoardIdin 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 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.ADVANCED_AERO_RULES_STRATOPS_ECM- Returns:
- True when the Entity is part of a game and the option is active in that game
-
damage
public boolean damage(double amount) Damages this carryable object by the given amount of damage. Returns true if the cargo is considered destroyed by applying the damage. Note: This method does *not* check if the object is invulnerable; it is up to the caller to do that. Calling this method on an invulnerable carryable object behaves exactly like calling it on a vulnerable one.- Specified by:
damagein interfaceICarryable- Parameters:
amount- The damage- Returns:
- True if the cargo is destroyed by the damage, false otherwise
- See Also:
-
getTonnage
public double getTonnage()- Specified by:
getTonnagein interfaceICarryable- Returns:
- The weight of the carryable object in units of tons.
-
isInvulnerable
public boolean isInvulnerable()Returns true if this carryable object should never take damage nor be destroyed, false otherwise. Note that the carryable object does *not* itself enforce this; it is up to the caller ofdamage(double)to test it.- Specified by:
isInvulnerablein interfaceICarryable- Returns:
- True if this carryable object cannot be damaged
-
isCarryableObject
public boolean isCarryableObject()Description copied from interface:BTObjectFor future reference. Returns true when this object is a battlefield object (such as a crate) that can be picked up and carried by some types of units.- Specified by:
isCarryableObjectin interfaceBTObject- Specified by:
isCarryableObjectin interfaceICarryable- Returns:
- True when this is a carryable battlefield object.
-
getAttackingEntity
What entity is using this weapon to attack?- Returns:
- entity carrying this weapon, or the entity itself
-
processPickupStep
public void processPickupStep(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget, EntityMovementType overallMoveType) - Specified by:
processPickupStepin interfaceICarryable
-
processPickupStepEntity
protected void processPickupStepEntity(MoveStep step, Integer cargoPickupLocation, TWGameManager gameManager, Entity entityPickingUpTarget) -
setC3ecmAffected
public void setC3ecmAffected(boolean ecmAffect) -
getC3ecmAffected
public boolean getC3ecmAffected() -
getRecoveryTime
public int getRecoveryTime()Returns the recovery time for this entity in minutes.This method provides the base recovery time required for this entity type. The recovery time represents the duration needed to recover, repair, or prepare the entity after deployment or damage.
Subclasses should override this method to provide entity-specific recovery times based on their type, weight class, or other relevant characteristics.
Manual Reference: CamOps pg 214
- Returns:
- The recovery time in minutes. The default implementation returns 60 minutes.
- Since:
- 0.50.10
-
canPerformGroundSalvageOperations
public boolean canPerformGroundSalvageOperations()Determines whether salvage operations can be performed on the ground.The default implementation returns
false, indicating that salvage operations are not permitted. Subclasses should override this method to provide specific logic for determining salvage eligibility based on scenario conditions, campaign settings, or other relevant factors.- Returns:
trueif salvage operations can be performed,falseotherwise. The default implementation always returnsfalse.- Since:
- 0.50.10
-
canPerformSpaceSalvageOperations
public boolean canPerformSpaceSalvageOperations()Determines whether salvage operations can be performed in space scenarios.The default implementation returns
false, indicating that salvage operations are not permitted. Subclasses should override this method to provide specific logic for determining salvage eligibility based on scenario conditions, campaign settings, or other relevant factors.- Returns:
trueif salvage operations can be performed,falseotherwise. The default implementation always returnsfalse.- Since:
- 0.50.10
-
isChassisFamiliarityEligible
public boolean isChassisFamiliarityEligible()Returns whether this unit is a chassis-familiarity-eligible type for MekHQ's Familiarity system- Returns:
trueif familiarity is tracked for this unit
-