Class WeaponMounted

java.lang.Object
megamek.common.equipment.Mounted<WeaponType>
megamek.common.equipment.WeaponMounted
All Implemented Interfaces:
Serializable, PhaseUpdated, RoundUpdated
Direct Known Subclasses:
InfantryWeaponMounted

public class WeaponMounted extends Mounted<WeaponType>
See Also:
  • Constructor Details

  • Method Details

    • isDisposableWeapon

      public boolean isDisposableWeapon()
      Returns:
      true if this mount is a unit's one-shot Disposable Weapon (TO:AuE p.116, Corrected Sixth Printing)
    • setDisposableWeapon

      public void setDisposableWeapon(boolean disposableWeapon)
      Marks this mount as a one-shot Disposable Weapon (TO:AuE p.116, Corrected Sixth Printing).
      Parameters:
      disposableWeapon - whether this mount is a Disposable Weapon
    • getExplosionDamage

      public int getExplosionDamage()
      Overrides:
      getExplosionDamage in class Mounted<WeaponType>
    • getCurrentHeat

      public int getCurrentHeat()
      Description copied from class: Mounted
      returns the heat for this weapon taking account of rapid-fire weapon status
      Overrides:
      getCurrentHeat in class Mounted<WeaponType>
    • getLinkedAmmo

      public AmmoMounted getLinkedAmmo()
      Returns:
      The ammo currently linked by this weapon, or null if there is no linked ammo.
    • getCurrentShots

      public int getCurrentShots()
      Returns how many shots the weapon is using
    • isOneShot

      public boolean isOneShot()
      Description copied from class: Mounted
      Checks whether this mount is either one a one-shot weapon or ammo for a one-shot weapon.
      Overrides:
      isOneShot in class Mounted<WeaponType>
      Returns:
      Whether the equipment is one-shot
    • addWeaponToBay

      public void addWeaponToBay(int equipmentNum)
      Adds the weapon with the given equipment number to the bay.
      Parameters:
      equipmentNum - The equipment number of the weapon to add
      See Also:
    • addWeaponToBay

      public void addWeaponToBay(WeaponMounted weapon)
    • removeWeaponFromBay

      public void removeWeaponFromBay(int equipmentNum)
      Removes the weapon with the given equipment number from the bay.
      Parameters:
      equipmentNum - The equipment number of the weapon to remove.
      See Also:
    • removeWeaponFromBay

      @Deprecated(since="0.51.0", forRemoval=true) public void removeWeaponFromBay(WeaponMounted weapon)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes a weapon from the bay.
      Parameters:
      weapon - The weapon to remove.
    • clearBayWeapons

      public void clearBayWeapons()
      Removes all weapons from the bay.
    • getBayWeapons

      public List<WeaponMounted> getBayWeapons()
      Returns:
      All the weapon mounts in the bay.
    • getBayWeapon

      public WeaponMounted getBayWeapon(int index)
      Fetches the bay weapon at a given index in the bay weapons list.
      Parameters:
      index - The index
      Returns:
      The weapon mount at that
    • addAmmoToBay

      public void addAmmoToBay(int equipmentNum)
      Adds the ammo with the given equipment number to the bay.
      Parameters:
      equipmentNum - The equipment number of the ammo
      See Also:
    • addAmmoToBay

      public void addAmmoToBay(AmmoMounted ammo)
    • removeAmmoFromBay

      @Deprecated(since="0.51.0", forRemoval=true) public void removeAmmoFromBay(int equipmentNum)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes the ammo with the given equipment number from the bay.
      Parameters:
      equipmentNum - The equipment number of the ammo.
      See Also:
    • clearBayAmmo

      public void clearBayAmmo()
      Clears all ammo from the bay.
    • getBayAmmo

      public List<AmmoMounted> getBayAmmo()
    • ammoInBay

      public boolean ammoInBay(int mAmmoId)
      Parameters:
      mAmmoId - equipment number of ammo
      Returns:
      whether the ammo is in this weapon's bay
    • removeFromBay

      public void removeFromBay(int equipmentNum)
      Removes the weapon or ammo with the given equipment number from the bay.
      Parameters:
      equipmentNum - The weapon or ammo equipment number
      See Also:
    • removeFromBay

      public void removeFromBay(Mounted<?> mounted)
      Removes the weapon or ammo from the bay.
      Parameters:
      mounted - The weapon or ammo to remove.
    • bayContains

      public boolean bayContains(int equipmentNum)
      Checks whether the bay contains the given weapon or ammo.
      Parameters:
      equipmentNum - The equipment number of the weapon or ammo.
      Returns:
      Whether the bay contains the equipment.
      See Also:
    • bayContains

      @Deprecated(since="0.51.0", forRemoval=true) public boolean bayContains(Mounted<?> mounted)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Checks whether the bay contains the given weapon or ammo.
      Parameters:
      mounted - The weapon or ammo.
      Returns:
      Whether the bay contains the equipment.
    • bayComponentsToString

      protected List<String> bayComponentsToString()
      Overrides:
      bayComponentsToString in class Mounted<WeaponType>
    • assignAPDS

      public WeaponAttackAction assignAPDS(List<WeaponHandler> vAttacks)
      Assign APDS systems to the most dangerous incoming missile attacks. This should only be called once per turn, or AMS will get extra attacks
    • isAPDS

      public boolean isAPDS()
      Returns:
      Whether this mount is an advanced point defense system.
    • getHeatByBay

      public int getHeatByBay()
      Returns:
      The heat generated by the bay, or the heat of the individual weapon if it's not a bay
    • isGroundBomb

      public boolean isGroundBomb()
      Overrides:
      isGroundBomb in class Mounted<WeaponType>
      Returns:
      True if this Mounted is a bomb capable of striking ground targets.