Class HandheldWeapon

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

public class HandheldWeapon extends Entity
See TO:AUE p.126, 127; TRO: Irregulars, TRO: Prototypes
See Also:
  • Field Details

  • Constructor Details

    • HandheldWeapon

      public HandheldWeapon()
  • Method Details

    • defaultCrewType

      public CrewType defaultCrewType()
      Overrides:
      defaultCrewType in class Entity
    • getUnitType

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

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

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

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

      public String[] getLocationAbbreviations()
      Specified by:
      getLocationAbbreviations 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.
    • 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
    • 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
    • rollHitLocation

      public HitData rollHitLocation(int table, int side)
      Description copied from class: Entity
      Rolls up a hit location
      Specified by:
      rollHitLocation 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
    • 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
    • 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
    • getFacing

      public int getFacing()
      Returns the primary facing, or -1 if n/a
      Overrides:
      getFacing in class Entity
    • 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
    • getNoOfSlots

      protected int[] getNoOfSlots()
      Specified by:
      getNoOfSlots 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
    • 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
    • addEntityBonuses

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

      public int getMaxElevationChange()
      Description copied from class: Entity
      The maximum elevation change the entity can cross
      Overrides:
      getMaxElevationChange in class Entity
    • 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.
    • isNuclearHardened

      public boolean isNuclearHardened()
      Description copied from class: Entity
      Checks if the unit is hardened against nuclear strikes.
      Overrides:
      isNuclearHardened in class Entity
      Returns:
      true if this is a hardened unit.
    • getEngineHits

      public int getEngineHits()
      Specified by:
      getEngineHits in class Entity
    • 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
    • getEntityType

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

      public boolean isHandheldWeapon()
      Returns:
      True when this object is a Handheld Weapon.
    • 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.
    • isCarryableObject

      public boolean isCarryableObject()
      Description copied from interface: BTObject
      For 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:
      isCarryableObject in interface BTObject
      Specified by:
      isCarryableObject in interface ICarryable
      Overrides:
      isCarryableObject in class Entity
      Returns:
      True when this is a carryable battlefield object.
    • getWeaponFiringPosition

      public Coords getWeaponFiringPosition(WeaponMounted weapon)
      What Coords is this weapon physically firing from?
      Overrides:
      getWeaponFiringPosition in class Entity
      Parameters:
      weapon - WeaponMounted
      Returns:
      Coords
    • getWeaponFiringHeight

      public int getWeaponFiringHeight(WeaponMounted weapon)
      What height is this weapon physically firing from?
      Overrides:
      getWeaponFiringHeight in class Entity
      Parameters:
      weapon - WeaponMounted
      Returns:
      int
    • 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:
      canBePickedUp in interface ICarryable
      Overrides:
      canBePickedUp in class Entity
      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
    • getAttackingEntity

      public Entity getAttackingEntity()
      What entity is using this weapon to attack?
      Overrides:
      getAttackingEntity in class Entity
      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:
      processPickupStep in interface ICarryable
      Overrides:
      processPickupStep in class Entity
    • getCarriedObjectDamageAllocation

      public ICarryable.CarriedObjectDamageAllocation getCarriedObjectDamageAllocation()
    • targetForArmHitToHitCarriedObject

      public int targetForArmHitToHitCarriedObject()
    • 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.
      Overrides:
      isEligibleForFiring in class Entity
    • 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
      Overrides:
      isEligibleForMovement in class Entity
      Returns:
      whether the entity is allowed to move
    • isEligibleForOffboard

      public boolean isEligibleForOffboard()
      Overrides:
      isEligibleForOffboard in class Entity
    • isEligibleForPhysical

      public boolean isEligibleForPhysical()
      Check if the entity has any valid targets for physical attacks.
      Overrides:
      isEligibleForPhysical in class Entity
    • isEligibleForTargetingPhase

      public boolean isEligibleForTargetingPhase()
      Overrides:
      isEligibleForTargetingPhase in class Entity
    • isEligibleForArtyAutoHitHexes

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