39 if (!
interval.intervalElapsed())
return;
44 if (
ability.isActiveOrInProgress()) {
45 MemoryAPI mem =
fleet.getMemoryWithoutUpdate();
46 mem.set(FleetAIFlags.HAS_SPEED_BONUS,
true, 0.2f);
47 mem.set(FleetAIFlags.HAS_VISION_PENALTY,
true, 0.2f);
56 if (
fleet.getStats().getFleetwideMaxBurnMod().getBonusMult() <= 0.15f) {
60 if (
fleet.getAI() !=
null &&
fleet.getAI().getCurrentAssignmentType() == FleetAssignment.STANDING_DOWN) {
64 MemoryAPI mem =
fleet.getMemoryWithoutUpdate();
72 if (
fleet.isInHyperspace() && Misc.isInsideSlipstream(
fleet)) {
77 if (
fleet.getMemoryWithoutUpdate().getBoolean(HyperspaceTerrainPlugin.STORM_STRIKE_TIMEOUT_KEY) &&
78 !Misc.isSlowMoving(
fleet)) {
83 if (Misc.isInsideBlackHole(
fleet,
false)) {
90 CampaignFleetAPI pursueTarget = mem.getFleet(FleetAIFlags.PURSUIT_TARGET);
91 CampaignFleetAPI fleeingFrom = mem.getFleet(FleetAIFlags.NEAREST_FLEEING_FROM);
97 if (fleeingFrom !=
null) {
98 if (fleeingFrom.isStationMode())
return;
101 VisibilityLevel level =
fleet.getVisibilityLevelTo(fleeingFrom);
102 if (level == VisibilityLevel.NONE)
return;
104 if (!
ability.isUsable())
return;
106 if (fleeingFrom.isPlayerFleet()) {
107 boolean avoidingPlayer = Misc.isAvoidingPlayerHalfheartedly(
fleet);
108 if (avoidingPlayer)
return;
111 UseCost cost = getUseCost();
113 float dist = Misc.getDistance(
fleet.getLocation(), fleeingFrom.getLocation()) -
fleet.getRadius() + fleeingFrom.getRadius();
114 float detRange = fleeingFrom.getMaxSensorRangeToDetect(
fleet);
115 float ourSpeed =
fleet.getFleetData().getBurnLevel();
116 float theirSpeed = fleeingFrom.getFleetData().getBurnLevel();
117 float closingSpeed = Misc.getClosingSpeed(
fleet.getLocation(), fleeingFrom.getLocation(),
118 fleet.getVelocity(), fleeingFrom.getVelocity());
119 if ((theirSpeed > ourSpeed && closingSpeed > 1) || (closingSpeed > 1 && dist < 100)) {
120 if (hopelessFight && dist < 200) {
122 }
else if ((cost == UseCost.LOW || cost == UseCost.MEDIUM) && dist < 500) {
124 }
else if ((cost == UseCost.LOW || cost == UseCost.MEDIUM) && dist < 100) {
126 }
else if ((cost == UseCost.LOW || cost == UseCost.MEDIUM) && dist > detRange - 100f) {
134 if (pursueTarget !=
null) {
135 if (pursueTarget.isStationMode())
return;
137 if (
fleet.getAI() instanceof ModularFleetAIAPI) {
138 ModularFleetAIAPI ai = (ModularFleetAIAPI)
fleet.getAI();
139 if (ai.getTacticalModule().isMaintainingContact()) {
144 VisibilityLevel level = pursueTarget.getVisibilityLevelTo(
fleet);
145 if (level == VisibilityLevel.NONE)
return;
147 if (pursueTarget.isPlayerFleet()) {
148 level =
fleet.getVisibilityLevelTo(pursueTarget);
149 if (level == VisibilityLevel.NONE) {
150 float closingSpeed = Misc.getClosingSpeed(pursueTarget.getLocation(),
fleet.getLocation(),
151 pursueTarget.getVelocity(),
fleet.getVelocity());
152 if (closingSpeed > 0) {
159 if (!
ability.isUsable())
return;
166 UseCost cost = getUseCost();
167 float dist = Misc.getDistance(
fleet.getLocation(), pursueTarget.getLocation()) -
fleet.getRadius() - pursueTarget.getRadius();
168 if (dist < 0)
return;
170 float detRange = pursueTarget.getMaxSensorRangeToDetect(
fleet);
171 float ourSpeed =
fleet.getFleetData().getBurnLevel();
172 float theirSpeed = pursueTarget.getFleetData().getBurnLevel();
174 float closingSpeed = Misc.getClosingSpeed(
fleet.getLocation(), pursueTarget.getLocation(),
175 fleet.getVelocity(), pursueTarget.getVelocity());
177 if (cost == UseCost.LOW && closingSpeed <= -1 && dist > detRange - 100f) {
179 }
else if (cost == UseCost.LOW && dist < 200 && closingSpeed < 50 && !targetInsignificant) {
181 }
else if (cost == UseCost.LOW && theirSpeed > ourSpeed && dist > 300 && !targetInsignificant) {
188 boolean useEB = mem.getBoolean(FleetAIFlags.USE_EB_FOR_TRAVEL);
190 if (!
ability.isUsable())
return;