Class ProtoMek

All Implemented Interfaces:
Serializable, ICarryable, Transporter, InGameObject, CombatRole, ForceAssignable, ITechnology, ITurnOrdered, PhaseUpdated, RoundUpdated, BTObject, Deployable, Targetable

public class ProtoMek extends Entity
ProtoMeks. Level 2 Clan equipment.
See Also:
  • Field Details

  • Constructor Details

    • ProtoMek

      public ProtoMek()
      Construct a new, blank, pMek.
  • Method Details

    • getUnitType

      public int getUnitType()
      Specified by:
      getUnitType in class Entity
      See Also:
    • getNoOfSlots

      protected int[] getNoOfSlots()
      Specified by:
      getNoOfSlots in class Entity
    • getPilotDamageTaken

      public int getPilotDamageTaken(int loc)
      Returns # of pilot damage points taken due to crits to the location so far.
    • getTorsoWeapon

      public Mounted<?> getTorsoWeapon(int torsoNum)
      Get the weapon in the given torso location (if any).
      Parameters:
      torsoNum - - a int that corresponds to SYSTEM_TORSO_WEAPON_A thorough SYSTEM_TORSO_WEAPON_F
      Returns:
      the Mounted weapon at the needed location. This value will be null if no weapon is in the indicated location.
    • setPilotDamageTaken

      public void setPilotDamageTaken(int loc, int damage)
      Tells the ProtoMek to note pilot damage taken from crit damage to the location
    • getBasePilotingRoll

      public PilotingRollData getBasePilotingRoll()
      ProtoMeks don't take piloting skill rolls.
      Overrides:
      getBasePilotingRoll in class Entity
    • shaded

      public boolean shaded(int loc, int numHit)
      A "shaded" critical is a box shaded on the record sheet, implies pilot damage when hit. Returns whether shaded.
    • getWalkMP

      public int getWalkMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getWalkMP in class Entity
    • getRunMPasString

      public String getRunMPasString(boolean gameState)
      Description copied from class: Entity
      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.
      Overrides:
      getRunMPasString in class Entity
      Parameters:
      gameState - Set this to true to include information about the current state of equipment like MASC.
      Returns:
      A string like 9(15) if gameState is false or there is no current Game, or a string like 9(15) MASC:0(3+) otherwise.
    • getCritsHit

      public int getCritsHit(int loc)
      Counts the # of crits taken by proto in the location. Needed in several places, due to proto set criticalSlots.
    • addEntityBonuses

      public PilotingRollData addEntityBonuses(PilotingRollData roll)
      Description copied from class: Entity
      Add in any piloting skill mods
      Specified by:
      addEntityBonuses in class Entity
    • getNumberOfCriticalSlots

      public int getNumberOfCriticalSlots(int loc)
      Overrides:
      getNumberOfCriticalSlots in class Entity
      Returns:
      The number of total critical slots in the given location.
    • getConstructionTechAdvancement

      public TechAdvancement getConstructionTechAdvancement()
      Description copied from class: Entity
      return - the base construction option tech advancement
      Specified by:
      getConstructionTechAdvancement in class Entity
    • addSystemTechAdvancement

      protected void addSystemTechAdvancement(CompositeTechLevel techLevel)
      Description copied from class: Entity
      Incorporate dates for components that are not in the equipment list, such as engines and structure.
      Overrides:
      addSystemTechAdvancement in class Entity
    • newRound

      public void newRound(int roundNumber)
      Description copied from class: Entity
      Start a new round
      Specified by:
      newRound in interface RoundUpdated
      Overrides:
      newRound in class Entity
      Parameters:
      roundNumber - the int number of the new round
    • getJumpMP

      public int getJumpMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getJumpMP in class Entity
    • getLocationNames

      public String[] getLocationNames()
      Specified by:
      getLocationNames in class Entity
    • getMovementString

      public String getMovementString(EntityMovementType movementType)
      Description copied from class: Entity
      Returns the name of the type of movement used.
      Specified by:
      getMovementString in class Entity
    • getMovementAbbr

      public String getMovementAbbr(EntityMovementType movementType)
      Description copied from class: Entity
      Returns the abbreviation of the name of the type of movement used.
      Specified by:
      getMovementAbbr in class Entity
    • canChangeSecondaryFacing

      public boolean canChangeSecondaryFacing()
      Description copied from class: Entity
      Can this entity change secondary facing at all?
      Specified by:
      canChangeSecondaryFacing in class Entity
    • isValidSecondaryFacing

      public boolean isValidSecondaryFacing(int dir)
      Description copied from class: Entity
      Can this entity torso/turret twist the given direction?
      Specified by:
      isValidSecondaryFacing in class Entity
    • clipSecondaryFacing

      public int clipSecondaryFacing(int dir)
      Description copied from class: Entity
      Returns the closest valid secondary facing to the given direction.
      Specified by:
      clipSecondaryFacing in class Entity
      Returns:
      the closest valid secondary facing.
    • getArmorWeight

      public double getArmorWeight()
      Description copied from class: Entity
      The total weight of the armor on this unit. This is guaranteed to be rounded properly for both single-type and patchwork armor.
      Overrides:
      getArmorWeight in class Entity
      Returns:
      The armor weight in tons.
    • canPickupGroundObject

      public boolean canPickupGroundObject()
      Description copied from class: Entity
      Returns true if the entity can pick up ground objects
      Specified by:
      canPickupGroundObject in interface Transporter
      Overrides:
      canPickupGroundObject in class Entity
    • maxGroundObjectTonnage

      public double maxGroundObjectTonnage()
      Description copied from class: Entity
      The maximum tonnage of ground objects that can be picked up by this unit
      Overrides:
      maxGroundObjectTonnage in class Entity
    • getDefaultPickupLocations

      public List<Integer> getDefaultPickupLocations()
      Description copied from class: Entity
      A list of the "default" cargo pick up locations for when none is specified
      Overrides:
      getDefaultPickupLocations in class Entity
    • getValidHalfWeightPickupLocations

      public List<Integer> getValidHalfWeightPickupLocations(ICarryable cargo)
      Description copied from class: Entity
      A list of all the locations that the entity can use to pick up cargo following the TacOps "one-handed" pickup rules
      Overrides:
      getValidHalfWeightPickupLocations in class Entity
    • getRunMP

      public int getRunMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getRunMP in class Entity
    • hasMyomerBooster

      public boolean hasMyomerBooster()
      Returns:
      True if this ProtoMek mounts an operable Myomer Booster.
      See Also:
    • getWeaponArc

      public int getWeaponArc(int weaponNumber)
      Description copied from class: Entity
      Returns the Rules.ARC that the weapon, specified by number, fires into.
      Specified by:
      getWeaponArc in class Entity
      Parameters:
      weaponNumber - integer equipment number, index from equipment list
      Returns:
      arc the specified weapon is in
    • isSecondaryArcWeapon

      public boolean isSecondaryArcWeapon(int weaponId)
      Description copied from class: Entity
      Returns true if this weapon fires into the secondary facing arc. If false, assume it fires into the primary.
      Specified by:
      isSecondaryArcWeapon in class Entity
    • rollHitLocation

      public HitData rollHitLocation(int table, int side)
      Description copied from class: Entity
      Rolls up a hit location
      Specified by:
      rollHitLocation in class Entity
    • rollHitLocation

      public HitData rollHitLocation(int table, int side, int aimedLocation, AimingMode aimingMode, int cover)
      Description copied from class: Entity
      Rolls the to-hit number
      Specified by:
      rollHitLocation in class Entity
    • canTransferCriticalSlots

      public boolean canTransferCriticalSlots(int loc)
      Description copied from class: Entity
      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.
      Overrides:
      canTransferCriticalSlots in class Entity
    • getTransferLocation

      public HitData getTransferLocation(HitData hit)
      Description copied from class: Entity
      Gets the location that excess damage transfers to. That is, one location inwards.
      Specified by:
      getTransferLocation in class Entity
    • firstArmorIndex

      public int firstArmorIndex()
      Overrides:
      firstArmorIndex in class Entity
      Returns:
      The index of the first armored location (skipping vehicle body, et al.)
    • setInternal

      public void setInternal(int head, int torso, int arm, int legs, int mainGun)
      Sets the internal structure for the pMek.
      Parameters:
      head - head
      torso - center torso
      arm - right/left arm
      legs - right/left leg
      mainGun - main gun
    • autoSetInternal

      public void autoSetInternal()
      Description copied from class: Entity
      Sets the internal structure for every location to appropriate undamaged values for the unit and location.
      Specified by:
      autoSetInternal in class Entity
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc) throws LocationFullException
      Description copied from class: Entity
      Creates a new mount for this equipment and adds it in.
      Overrides:
      addEquipment in class Entity
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted) throws LocationFullException
      Description copied from class: Entity
      Creates a new mount for this equipment and adds it in.
      Overrides:
      addEquipment in class Entity
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType etype, int loc, boolean rearMounted, int shots) throws LocationFullException
      Description copied from class: Entity
      mounting weapons needs to take account of ammo
      Overrides:
      addEquipment in class Entity
      Parameters:
      etype - EquipmentType
      Throws:
      LocationFullException
    • addEquipment

      protected void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted, int shots) throws LocationFullException
      Overrides:
      addEquipment in class Entity
      Throws:
      LocationFullException
    • maxWeapons

      public int maxWeapons(int location)
    • victoryReport

      public Vector<Report> victoryReport()
      Description copied from class: Entity
      Generates a vector containing reports on all useful information about this entity.
      Specified by:
      victoryReport in class Entity
    • getMaxElevationDown

      public int getMaxElevationDown(int currElevation)
      Description copied from class: Entity
      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).
      Overrides:
      getMaxElevationDown in class Entity
    • getArmor

      public int getArmor(int loc, boolean rear)
      Description copied from class: Entity
      Returns the amount of armor in the location specified, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.
      Overrides:
      getArmor in class Entity
    • getInternal

      public int getInternal(int loc)
      Description copied from class: Entity
      Returns the amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.
      Overrides:
      getInternal in class Entity
    • getLocationAbbreviations

      public String[] getLocationAbbreviations()
      Specified by:
      getLocationAbbreviations in class Entity
    • getLocationAbbr

      public String getLocationAbbr(int loc)
      Description copied from class: Entity
      Returns the abbreviated name of the location specified.
      Overrides:
      getLocationAbbr in class Entity
    • hasMainGun

      public boolean hasMainGun()
      Not every ProtoMek has a main gun.
    • setHasMainGun

      public void setHasMainGun(boolean b)
      Not every ProtoMek has a main gun.
    • locations

      public int locations()
      Description copied from class: Entity
      Returns the number of locations in the entity
      Specified by:
      locations in class Entity
    • getBodyLocation

      public int getBodyLocation()
      Description copied from class: Entity
      Determines where to place equipment that does not require a specific location. What this means varies by Entity type.
      Overrides:
      getBodyLocation in class Entity
      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.
    • setCrew

      public void setCrew(Crew p)
      Overrides:
      setCrew in class Entity
    • canCharge

      public boolean canCharge()
      Overrides:
      canCharge in class Entity
      Returns:
      Whether this type of unit can perform charges
    • canDFA

      public boolean canDFA()
      Overrides:
      canDFA in class Entity
      Returns:
      Whether this type of unit can perform DFA attacks
    • getCost

      public double getCost(CalculationReport calcReport, boolean ignoreAmmo)
      Description copied from class: Entity
      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.
      Specified by:
      getCost in class Entity
      Parameters:
      calcReport - A CalculationReport to write the report for the cost calculation to
      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.
    • getPriceMultiplier

      public double getPriceMultiplier()
      Description copied from class: Entity
      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

      Overrides:
      getPriceMultiplier in class Entity
    • setGameOptions

      public void setGameOptions()
      Overrides:
      setGameOptions in class Entity
    • recalculateTechAdvancement

      public void recalculateTechAdvancement()
      ProtoMeks have EI built-in per IO:AE p.69, but BLK files do not include EI Interface equipment. In Full Tracking mode the EI tech advancement (Experimental) must be added to the composite so that all tech level queries (year-based, static, etc.) reflect Experimental.
      Overrides:
      recalculateTechAdvancement in class Entity
    • getStaticTechLevel

      public SimpleTechLevel getStaticTechLevel()
      ProtoMeks in Full Tracking mode are Experimental tech per IO:AE p.69 due to built-in EI. Off and Pilot Only modes keep ProtoMeks at their base tech level (Standard).
      Specified by:
      getStaticTechLevel in interface ITechnology
      Overrides:
      getStaticTechLevel in class Entity
      Returns:
      The base rules level of the equipment or unit.
    • hasEiCockpit

      public boolean hasEiCockpit()
      ProtoMeks have EI built-in per IO:AE p.69, but it is only active when neural interface rules are enabled (Pilot Abilities Only or Full Tracking mode). When Off, ProtoMeks behave as standard TW units.
      Overrides:
      hasEiCockpit in class Entity
      Returns:
      true if neural interface rules are enabled, false otherwise
    • hasActiveEiCockpit

      public boolean hasActiveEiCockpit()
      ProtoMeks have EI built-in and always active unless the head is damaged. Unlike other units, ProtoMek pilots don't need the EI Implant option - they are neurally connected by default per IO:AE p.69. Returns false if neural interface rules are disabled (Off mode).
      Overrides:
      hasActiveEiCockpit in class Entity
      Returns:
      true if neural interface is enabled and head is undamaged, false otherwise
    • canAssaultDrop

      public boolean canAssaultDrop()
      Overrides:
      canAssaultDrop in class Entity
    • isLocationProhibited

      public boolean isLocationProhibited(Coords c, int testBoardId, int currElevation)
      Description copied from class: Entity
      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.
      Overrides:
      isLocationProhibited in class Entity
      Parameters:
      c - The position to test
      testBoardId - The board to test
      currElevation - The elevation or altitude to test
      Returns:
      True when the location is illegal to be in for this unit, regardless of elevation
      See Also:
    • setGrappled

      public void setGrappled(int id, boolean attacker)
      Overrides:
      setGrappled in class Entity
    • isGrappleAttacker

      public boolean isGrappleAttacker()
      Overrides:
      isGrappleAttacker in class Entity
    • getGrappled

      public int getGrappled()
      Overrides:
      getGrappled in class Entity
      Returns:
      The ID of a unit that this unit is grappling or grappled by; Entity.NONE if not grappling anything and not being grappled.
    • isGrappledThisRound

      public boolean isGrappledThisRound()
      Overrides:
      isGrappledThisRound in class Entity
    • setGrappledThisRound

      public void setGrappledThisRound(boolean grappled)
      Overrides:
      setGrappledThisRound in class Entity
    • isEligibleForMovement

      public boolean isEligibleForMovement()
      Description copied from class: Entity
      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
      Overrides:
      isEligibleForMovement in class Entity
      Returns:
      whether the entity is allowed to move
    • 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)
      Description copied from class: Entity
      Checks if the entity might skid. If so, returns the target roll for the piloting skill check.
      Overrides:
      checkSkid in class Entity
    • checkGliderLanding

      public PilotingRollData checkGliderLanding()
    • getEngineHits

      public int getEngineHits()
      Specified by:
      getEngineHits in class Entity
    • getWingHits

      public int getWingHits()
    • setWingHits

      public void setWingHits(int hits)
    • isEDPCharged

      public boolean isEDPCharged()
    • setEDPCharged

      public void setEDPCharged(boolean charged)
    • isEDPCharging

      public boolean isEDPCharging()
    • isQuad

      public boolean isQuad()
    • setIsQuad

      public void setIsQuad(boolean isQuad)
    • isGlider

      public boolean isGlider()
    • setIsGlider

      public void setIsGlider(boolean isGlider)
    • hasInterfaceCockpit

      public boolean hasInterfaceCockpit()
      WoB protoMek interface allows it to be piloted by a quadruple amputee with a VDNI implant. No effect on game play.
      Returns:
      Whether the protoMek is equipped with an Inner Sphere ProtoMek Interface.
    • setInterfaceCockpit

      public void setInterfaceCockpit(boolean interfaceCockpit)
      Sets whether the protoMek has an Inner Sphere ProtoMek Interface. This will also determine whether it is a mixed tech unit.
      Parameters:
      interfaceCockpit - Whether the protoMek has an IS interface
    • isCrippled

      public boolean isCrippled()
      Description copied from class: Entity
      Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.
      Specified by:
      isCrippled in class Entity
      Returns:
      boolean
    • isCrippled

      public boolean isCrippled(boolean checkCrew)
      Description copied from class: Entity
      Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258. Excepting dead or non-existing crew issues
      Specified by:
      isCrippled in class Entity
      Returns:
      boolean
    • isDmgHeavy

      public boolean isDmgHeavy()
      Description copied from class: Entity
      Returns TRUE if the entity has been heavily damaged.
      Specified by:
      isDmgHeavy in class Entity
      Returns:
      boolean
    • isDmgModerate

      public boolean isDmgModerate()
      Description copied from class: Entity
      Returns TRUE if the entity has been moderately damaged.
      Specified by:
      isDmgModerate in class Entity
      Returns:
      boolean
    • isDmgLight

      public boolean isDmgLight()
      Description copied from class: Entity
      Returns TRUE if the entity has been lightly damaged.
      Specified by:
      isDmgLight in class Entity
      Returns:
      boolean
    • getLocationDamage

      public String getLocationDamage(int loc)
      Overrides:
      getLocationDamage in class Entity
    • isEngineHit

      public boolean isEngineHit()
    • setEngineHit

      public void setEngineHit(boolean b)
    • getEntityType

      public long getEntityType()
      Specified by:
      getEntityType in class Entity
    • checkLandingInHeavyWoods

      public PilotingRollData checkLandingInHeavyWoods(EntityMovementType overallMoveType, Hex curHex)
      Description copied from class: Entity
      Checks if an entity is landing (from a jump) in heavy woods.
      Overrides:
      checkLandingInHeavyWoods in class Entity
    • getValidBraceLocations

      public List<Integer> getValidBraceLocations()
      Overrides:
      getValidBraceLocations in class Entity
    • canBrace

      public boolean canBrace()
      Overrides:
      canBrace in class Entity
    • getBraceMPCost

      public int getBraceMPCost()
      Overrides:
      getBraceMPCost in class Entity
    • isProtoMek

      public boolean isProtoMek()
      Description copied from interface: BTObject
      Returns true when this object is a ProtoMek or of type PM for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a ProtoMek
    • getJumpType

      public int getJumpType()
      Overrides:
      getJumpType in class Entity
    • getGenericBattleValue

      public int getGenericBattleValue()
      Description copied from class: Entity
      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.

      Specified by:
      getGenericBattleValue in class Entity
      Returns:
      The generic Battle value for this unit based on its tonnage and type
    • slotNumber

      public int slotNumber(Mounted<?> mounted)
      Description copied from class: Entity
      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.
      Overrides:
      slotNumber in class Entity
      Parameters:
      mounted - the equipment to look for
      Returns:
      the (first) slot number that holds the mounted or -1 if none can be found
    • getEquipmentForWeaponQuirk

      protected Mounted<?> getEquipmentForWeaponQuirk(QuirkEntry quirkEntry)
      Description copied from class: Entity
      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.
      Overrides:
      getEquipmentForWeaponQuirk in class Entity
      Parameters:
      quirkEntry - The weapon quirk entry
      Returns:
      The Mounted at the specified location
    • getBlockedFiringLocations

      protected Map<Integer,List<Integer>> getBlockedFiringLocations()
      Description copied from class: Entity
      Method that returns the mapping between locations which, if cargo is carried, block other locations from firing.
      Overrides:
      getBlockedFiringLocations in class Entity
    • hasPatchworkArmor

      public boolean hasPatchworkArmor()
      Overrides:
      hasPatchworkArmor in class Entity
      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.
    • getRecoveryTime

      public int getRecoveryTime()
      Description copied from class: Entity
      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

      Overrides:
      getRecoveryTime in class Entity
      Returns:
      The recovery time in minutes. The default implementation returns 60 minutes.
    • isChassisFamiliarityEligible

      public boolean isChassisFamiliarityEligible()
      Description copied from class: Entity
      Returns whether this unit is a chassis-familiarity-eligible type for MekHQ's Familiarity system
      Overrides:
      isChassisFamiliarityEligible in class Entity
      Returns:
      true if familiarity is tracked for this unit