Class AimedShotHandler

java.lang.Object
megamek.client.ui.panels.phaseDisplay.AimedShotHandler
All Implemented Interfaces:
ActionListener, ItemListener, EventListener

public class AimedShotHandler extends Object implements ActionListener, ItemListener
  • Constructor Details

    • AimedShotHandler

      public AimedShotHandler(FiringDisplay firingDisplay)
  • Method Details

    • showDialog

      public void showDialog()
    • closeDialog

      public void closeDialog()
    • setEnableAll

      public void setEnableAll(boolean enableAll)
      Enables the radiobuttons in the dialog.
    • setPartialCover

      public void setPartialCover(int partialCover)
    • getAimingAt

      public int getAimingAt()
    • getAimingMode

      public AimingMode getAimingMode()
    • getAimingLocation

      public String getAimingLocation()
      Returns the name of aimed location.
    • setAimingMode

      public void setAimingMode()
      Sets the aiming mode, depending on the target and the attacker. Against immobile meks, targeting computer aiming mode will be used if turned on. This is a hack, but it's the resolution suggested by the bug submitter, and I don't think it's half bad.
    • isAimingAtLocation

      public boolean isAimingAtLocation()
      Returns:
      if a hit location currently selected.
    • isAimingAtLocationFor

      public boolean isAimingAtLocationFor(WeaponMounted weapon)
      Parameters:
      weapon - the weapon about to fire
      Returns:
      true if a location is selected and the weapon can reach it (a leg attack only reaches legs)
    • setEnableFor

      public void setEnableFor(WeaponMounted weapon)
      Enables the dialog's locations that the weapon can aim at, or none if no location is selected or the weapon cannot make an aimed shot.
      Parameters:
      weapon - the selected weapon
    • allowAimedShotWith

      public boolean allowAimedShotWith(WeaponMounted weapon)
      should aimed shots be allowed with the passed weapon
    • actionPerformed

      public void actionPerformed(ActionEvent ev)
      ActionListener, listens to the button in the dialog.
      Specified by:
      actionPerformed in interface ActionListener
    • itemStateChanged

      public void itemStateChanged(ItemEvent ev)
      ItemListener, listens to the radiobuttons in the dialog.
      Specified by:
      itemStateChanged in interface ItemListener