Class ArtilleryTargetingControl

java.lang.Object
megamek.client.bot.princess.ArtilleryTargetingControl

public class ArtilleryTargetingControl extends Object
This class handles the creation of firing plans for indirect-fire artillery and other weapons that get used during the targeting phase.
  • Constructor Details

    • ArtilleryTargetingControl

      public ArtilleryTargetingControl()
  • Method Details

    • calculateDamageValue

      public double calculateDamageValue(int damage, HexTarget hexTarget, Entity shooter, Game game, Princess owner)
      Wrapper for calculateDamageValue that accounts for leading with artillery shots by accounting for both the original target hexTarget and the computed target hexTarget in damage calculations.
      Parameters:
      damage - Base damage of artillery shot
      hexTarget - Target HexTarget
      shooter - Attacking Entity
      game - Game instance
      owner - Princess instance that owns shooter
      Returns:
      Total possible damage this shot can deal based on AE size and base damage
    • calculateDamageValue

      public double calculateDamageValue(int damage, Coords coords, Entity shooter, Game game, Princess owner)
      Worker function that calculates the total damage that would be done if a shot with the given damage value would hit the target coordinates. Caches computation results to avoid repeat
      Parameters:
      damage - Base damage to artillery shot
      coords - Coords of the target Hex, used if Hex is off the board
      shooter - Attacking Entity
      game - The current Game
      owner - the Princess bot to calculate for
    • initializeForTargetingPhase

      public void initializeForTargetingPhase()
      Clears out all cached elements in preparation for a new targeting phase.
    • calculateIndirectArtilleryPlan

      public FiringPlan calculateIndirectArtilleryPlan(Entity shooter, Game game, Princess owner)
      Calculate an indirect artillery "fire plan", taking into account the possibility of rotating the torso or turret: if no attack is possible with the current facing (e.g. an ordered fire mission hex is out of arc), the valid secondary facing changes are tried and the first one that produces attacks is used. The resulting plan includes the necessary torso twist action.
      Parameters:
      shooter - Entity doing the shooting
      game - The current Game
      owner - Princess pointer
      Returns:
      Firing plan
    • evaluateIncomingArtilleryDamage

      public static double evaluateIncomingArtilleryDamage(Coords coords, Princess operator)
      Function that calculates the potential damage if an artillery attack were to land on target.
      Parameters:
      coords - Coords of the target Hex, used if Hex is off the board
      operator - Princess instance who is checking for incoming artillery damage
      Returns:
      Damage value calculated from incoming shots that may hit these coordinates