Class ArtilleryTracker

java.lang.Object
megamek.common.ArtilleryTracker
All Implemented Interfaces:
Serializable

public class ArtilleryTracker extends Object implements Serializable
ArtilleryTracker - one held by every entity, it holds a list of the artillery weapons an entity controls, and the mods they get to hit certain hexes.
See Also:
  • Constructor Details

    • ArtilleryTracker

      public ArtilleryTracker()
      Creates new instance of the tracker
  • Method Details

    • addWeapon

      public void addWeapon(Mounted<?> mounted)
      Adds new weapon
      Parameters:
      mounted - new weapon
    • removeWeapon

      @Deprecated(since="0.51.0", forRemoval=true) public void removeWeapon(Mounted<?> mounted)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes a weapon - needed when capital missile bays change modes
      Parameters:
      mounted - existing weapon
    • getSize

      public int getSize()
      Returns:
      the size of the weapons hashtable
    • clearHitHexMods

      public void clearHitHexMods()
      Remove all auto hit mods from hexes that were hit previously; used when artillery unit moves. This _should_ be thread-safe. Only auto hit mods are lost when an artillery unit spends MPs (TO:AR pg. 150)
    • clearAllModifiers

      public void clearAllModifiers()
      Removes all fire adjustment and auto hit mods and the spotter flags, keeping the tracked weapons. Used when an entity is carried over into a new game (e.g. by MekHQ), as otherwise the previous game's target hexes remain valid and visible. The weapons must be kept, as setModifier(int, Coords) only adds mods for them.
    • weaponInList

      @Deprecated(since="0.51.0", forRemoval=true) public boolean weaponInList(Mounted<?> mounted)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • ammoTypeInList

      @Deprecated(since="0.51.0", forRemoval=true) public boolean ammoTypeInList(AmmoType.AmmoTypeEnum ammoType)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setModifier

      public void setModifier(int modifier, Coords coords)
      Sets the modifier for artillery weapons on this unit. All weapons use the same modifier due to artillery fire adjustment being handled on a per-unit basis.
    • getModifier

      public int getModifier(Mounted<?> weapon, Coords coords)
      Parameters:
      weapon - weapon to get modifier for
      Returns:
      the modifier for the given weapon
    • getWeaponModifiers

      public Vector<ArtilleryModifier> getWeaponModifiers(Mounted<?> mounted)
      Parameters:
      mounted - weapon to get modifiers for
      Returns:
      the Vector of the modifiers for the given weapon
    • getModifierByCoords

      protected ArtilleryModifier getModifierByCoords(Vector<ArtilleryModifier> modifiers, Coords coords)
      Search the given vector of modifiers for the modifier which coords equals to the given coords
      Parameters:
      modifiers - Vector of the modifiers to process
      coords - coordinates of the modifier looked for
      Returns:
      modifier with coords equals to the given on null if not found
    • getSpotterHasForwardObs

      public boolean getSpotterHasForwardObs()
    • setSpotterHasForwardObs

      public void setSpotterHasForwardObs(boolean forwardObserver)
    • getSpotterHasCommImplant

      public boolean getSpotterHasCommImplant()
    • setSpotterHasCommImplant

      public void setSpotterHasCommImplant(boolean hasCommImplant)