Class MissionTargetFinder

java.lang.Object
mekhq.campaign.mission.newContract.targetFinder.MissionTargetFinder

public class MissionTargetFinder extends Object
Finds potential mission-target planets for a given attacker/defender pair, generally on their shared border, with dedicated tiers for factions whose territory doesn't work like a normal nation's (pirates, ComStar, rebels) and optional contract-type-driven preferences (MissionLocationProfile) for contracts that don't happen at the front. Used by RandomFactionGenerator.getMissionTargetList(Faction, Faction, ILocation).
  • Constructor Details

  • Method Details

    • find

      public List<PlanetarySystem> find(Faction attacker, Faction defender, ILocation location, LocalDate currentDate)
      Builds a list of potential mission-target planets near location, generally on the shared border between attacker and defender (see resolveTerritorialHost(mekhq.campaign.universe.Faction, java.time.LocalDate, boolean), isSpecialAttacker(mekhq.campaign.universe.Faction), and the closest-system fallback for the special cases). Pirates favor border worlds over the interior on either side of a conflict (see PirateMissionTargetFinder). A ComStar defender is targeted by HPG network presence instead of borders (see ComStarMissionTargetFinder).

      Outside of those special cases, every returned system is one the defender actually owns: a mission is a raid on (or defense of) a specific enemy world, never a neighbor's or the attacker's own territory.

      Computed fresh around location on every call rather than from the tracker's single cached region, so campaigns with multiple simultaneous locations get a target scoped to whichever force needs it.

      Parameters:
      attacker - the attacking faction
      defender - the defending faction
      location - the location to center the search on
      currentDate - the date to check faction control and diplomatic relations against
      Returns:
      a list of potential mission targets
    • find

      public List<PlanetarySystem> find(Faction attacker, Faction defender, ILocation location, LocalDate currentDate, MissionLocationProfile profile)
      As find(Faction, Faction, ILocation, LocalDate), but with a contract-type-driven MissionLocationProfile layered on top of the default search: the profile's preferred tier is tried after the faction-specific routing (pirates, ComStar, landless attackers, rebels) but before the default shared-border chain, which remains the fallback whenever the preferred tier finds nothing.
      Parameters:
      attacker - the attacking faction
      defender - the defending faction
      location - the location to center the search on
      currentDate - the date to check faction control and diplomatic relations against
      profile - the location profile for the contract's type
      Returns:
      a list of potential mission targets
    • findSharedBorderTargets

      public List<PlanetarySystem> findSharedBorderTargets(Faction attacker, Faction defender, ILocation location, double radius, LocalDate currentDate)
      Finds the defender's systems on a genuine shared border with the attacker: the direct border between the two first and, when none exists, the border of whichever regional faction hosts the attacker as a "contained" opponent of the defender, as a proxy for the attacker's otherwise poorly-defined local presence. Either way the result is always defender-owned, since getBorderSystems(self, other) returns OTHER's systems near SELF.
    • findRearAreaTargets

      public List<PlanetarySystem> findRearAreaTargets(Faction attacker, Faction defender, ILocation location, double radius, LocalDate date)
      Finds the defender's systems in range that are not on the shared border with the attacker: training cadres and standing retainers are stationed in the safe rear, not on a contested front-line world. Empty when everything the defender holds in range is border (fall back to the default chain, i.e. accept the front).
    • findAllDefenderTargets

      public List<PlanetarySystem> findAllDefenderTargets(Faction defender, ILocation location, double radius, LocalDate date)
      Finds every system the defender holds in range, border or not: riots and internal-security work can flare up anywhere in the defender's space, with no particular relationship to the enemy's border.
    • findDeepRaidTargets

      public List<PlanetarySystem> findDeepRaidTargets(Faction attacker, Faction defender, ILocation location, double radius)
      Finds the defender's systems in range within a widened border reaching roughly twice as deep as a conventional front line (see deepRaidBorderSize(mekhq.campaign.universe.Faction, mekhq.campaign.universe.Faction)): a hit-and-run strike can punch past the immediate border into the defender's near interior.
    • findOccupiedTerritoryTargets

      public List<PlanetarySystem> findOccupiedTerritoryTargets(Faction attacker, Faction defender, ILocation location, double radius, LocalDate date)
      Finds targets for a guerrilla campaign behind enemy lines. Preferred tier: defender-held systems in range that the attacker held 10 years ago — recently conquered worlds whose population plausibly still sympathizes with the attacker. Second tier: any defender system in range away from the shared border, since a guerrilla campaign on the contested front is just the regular war. Empty only when the defender holds nothing in range beyond the border itself.