Class BattleArmorUtil

java.lang.Object
megameklab.util.BattleArmorUtil

public final class BattleArmorUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    canLegAttack(megamek.common.battleArmor.BattleArmor ba)
     
    static boolean
    canSwarm(megamek.common.battleArmor.BattleArmor ba)
     
    static void
    emptyDwpApm(megamek.common.equipment.Mounted<?> mount)
    Empties the given APM (including armored glove) or DWP, removing any weapon or other equipment attached to it.
    static boolean
    isBAEquipment(megamek.common.equipment.EquipmentType eq, megamek.common.battleArmor.BattleArmor ba)
     
    static boolean
    isBAMultiMount(megamek.common.equipment.EquipmentType equip)
     
    static boolean
    isBattleArmorAPWeapon(megamek.common.equipment.EquipmentType etype)
     
    static boolean
    isBattleArmorWeapon(megamek.common.equipment.EquipmentType eq, megamek.common.units.Entity unit)
     
    static boolean
    isFilledWeaponMount(megamek.common.equipment.Mounted<?> mounted)
     
    static void
    mountOnDwp(megamek.common.equipment.Mounted<?> weapon, megamek.common.equipment.Mounted<?> dwp)
    Mounts the given weapon on the given Detachable Weapon Pack.
    static void
    removeAllCriticalSlotsFrom(megamek.common.battleArmor.BattleArmor battleArmor)
    Removes all critical slots for the given BA, unallocating all equipment (i.e., placing it into BattleArmor.MOUNT_LOC_NONE and BattleArmor.LOC_SQUAD).
    static void
    removeAllCriticalSlotsFrom(megamek.common.battleArmor.BattleArmor battleArmor, List<Integer> locations)
    Removes all critical slots from the given locations for the given BA, unallocating all equipment in those locations (i.e., placing it into BattleArmor.MOUNT_LOC_NONE and BattleArmor.LOC_SQUAD).
    static void
    removeManipulatorEquipment(megamek.common.battleArmor.BattleArmor battleArmor)
    Removes all manipulator equipment, including Modular Equipment Adaptors, from the unit.
    static void
    removeMountFromDwp(megamek.common.equipment.Mounted<?> dwp)
    Empties the given Detachable Weapon Pack, removing any weapon mounted on it.
    static void
    unallocateMounted(megamek.common.battleArmor.BattleArmor battleArmor, megamek.common.equipment.Mounted<?> mounted)
    Unallocates (removes from arm/body etc to the unallocated equipment list) the given mounted.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isBAEquipment

      public static boolean isBAEquipment(megamek.common.equipment.EquipmentType eq, megamek.common.battleArmor.BattleArmor ba)
      Parameters:
      eq - A WeaponType or MiscType
      ba - The BattleArmor instance
      Returns:
      Whether the BA can use the equipment
    • isBattleArmorAPWeapon

      public static boolean isBattleArmorAPWeapon(@Nullable megamek.common.equipment.EquipmentType etype)
    • isBattleArmorWeapon

      public static boolean isBattleArmorWeapon(megamek.common.equipment.EquipmentType eq, megamek.common.units.Entity unit)
    • canSwarm

      public static boolean canSwarm(megamek.common.battleArmor.BattleArmor ba)
    • canLegAttack

      public static boolean canLegAttack(megamek.common.battleArmor.BattleArmor ba)
    • isBAMultiMount

      public static boolean isBAMultiMount(megamek.common.equipment.EquipmentType equip)
    • mountOnDwp

      public static void mountOnDwp(megamek.common.equipment.Mounted<?> weapon, megamek.common.equipment.Mounted<?> dwp)
      Mounts the given weapon on the given Detachable Weapon Pack. Any previously mounted weapon is removed from it, becoming unallocated. Does nothing and logs a warning when the given dwp Mounted is not a DWP or the given weapon may not be mounted on a DWP.
      Parameters:
      weapon - The weapon to mount on the DWP
      dwp - The DWP to receive the weapon
    • removeMountFromDwp

      public static void removeMountFromDwp(megamek.common.equipment.Mounted<?> dwp)
      Empties the given Detachable Weapon Pack, removing any weapon mounted on it. Can be safely called (does nothing) when there is no weapon on the DWP or the given Mounted is not a DWP (in this case, logs a warning).
      Parameters:
      dwp - The DWP to empty
    • emptyDwpApm

      public static void emptyDwpApm(megamek.common.equipment.Mounted<?> mount)
      Empties the given APM (including armored glove) or DWP, removing any weapon or other equipment attached to it. Can be safely called (does nothing) when there is no equipment on the given mount or the given mount is neither an APM nor DWP (in this case, logs a warning).
      Parameters:
      mount - The APM/DWP to empty
    • unallocateMounted

      public static void unallocateMounted(megamek.common.battleArmor.BattleArmor battleArmor, megamek.common.equipment.Mounted<?> mounted)
      Unallocates (removes from arm/body etc to the unallocated equipment list) the given mounted. For special mounts for other equipment (DWP etc), that other equipment is removed from this mount first, emptying the given mounted. This method will unallocate regardless of the type of equipment, i.e., it does not check if this equipment should ever go unallocated (e.g. fixed location equipment). It is therefore up to the caller to select equipment to unallocate.
      Parameters:
      mounted - The equipment to unallocate
    • removeAllCriticalSlotsFrom

      public static void removeAllCriticalSlotsFrom(megamek.common.battleArmor.BattleArmor battleArmor)
      Removes all critical slots for the given BA, unallocating all equipment (i.e., placing it into BattleArmor.MOUNT_LOC_NONE and BattleArmor.LOC_SQUAD).
    • removeAllCriticalSlotsFrom

      public static void removeAllCriticalSlotsFrom(megamek.common.battleArmor.BattleArmor battleArmor, List<Integer> locations)
      Removes all critical slots from the given locations for the given BA, unallocating all equipment in those locations (i.e., placing it into BattleArmor.MOUNT_LOC_NONE and BattleArmor.LOC_SQUAD). Fixed location equipment is not affected (it is left in place).
    • isFilledWeaponMount

      public static boolean isFilledWeaponMount(megamek.common.equipment.Mounted<?> mounted)
    • removeManipulatorEquipment

      public static void removeManipulatorEquipment(megamek.common.battleArmor.BattleArmor battleArmor)
      Removes all manipulator equipment, including Modular Equipment Adaptors, from the unit.
      Parameters:
      battleArmor - The BA