Class AerospaceFireControl

java.lang.Object
megamek.client.bot.princess.FireControl
megamek.client.bot.princess.AerospaceFireControl

public class AerospaceFireControl extends FireControl
Gunnery for aerospace units flying in an atmosphere.

Two corrections to the stock guess, both of which make the bot's expectations match what the server will actually allow:

  • The dead zone. The stock guess never checks it, so the bot plans shots the server answers with IMPOSSIBLE, books the damage it expected to do, and moves somewhere on the strength of an attack it was never going to make. Over a ground mapsheet, where one level of altitude blocks fire within seventeen hexes, that describes most of the board.
  • Range. The stock guess converts ground hexes to aerospace range with integer division while the engine rounds up, and never adds the altitude difference the rules charge for (TW p.241). Both make the bot believe it is closer than it is.
  • Constructor Details

    • AerospaceFireControl

      public AerospaceFireControl(Princess owningPrincess)
  • Method Details

    • getDiveBombPlan

      protected FiringPlan getDiveBombPlan(Entity shooter, MovePath flightPath, Targetable target, Game game, boolean passedOverTarget, boolean guess)
      Drops on the best blast-footprint hex of the flown line, not on the target's own hex.

      The movement half steers the fighter over the seam of a formation; this half makes the drop actually land there. Worked from the pilot's seat: against a box lance with two hexes of spacing, cluster bombs (5 damage across all seven hexes, no falloff) on a corner mek's hex reach one target - its neighbors are empty - while the seam hex between two meks delivers full damage to both. Every hex the fighter physically flew through is a legal aim point (passedOver), so the drop target is a search over the flown line with the same ring tables the ranker's footprint credit uses. Either way the payload is rationed - to the single victim's hit points on a direct drop, to the summed hit points of everything under the blast rings on a seam drop.

      Overrides:
      getDiveBombPlan in class FireControl
      Parameters:
      shooter - The unit doing the shooting.
      target - The unit being fired on.
      game - The current Game
      passedOverTarget - Set TRUE to automatically assume the target will be under the flight path rather than going through the full calculation.
      guess - Whether we're just thinking about this firing plan or about to
      Returns:
      The FiringPlan containing all bombs on target, if the shooter is capable of dropping bombs.
    • guessDistance

      protected int guessDistance(Entity shooter, EntityState shooterState, Targetable target, EntityState targetState, Game game)
      Description copied from class: FireControl
      The range this guessed shot is resolved at, from a hypothetical shooter pose.

      Its own method so that CASPAR's aerospace gunnery can replace it without reproducing the rest of the to-hit guess. The stock behaviour is unchanged.

      Overrides:
      guessDistance in class FireControl
      Parameters:
      shooter - the unit doing the shooting
      shooterState - the pose the shooter would be firing from
      target - the unit being fired on
      targetState - the pose the target would be in
      game - the current game
      Returns:
      the range to look up on the weapon's range brackets