160 CampaignFleetAPI fleet =
getFleet();
161 if (fleet ==
null)
return;
163 VisibilityLevel vis = fleet.getVisibilityLevelToPlayerFleet();
164 if (vis == VisibilityLevel.NONE || vis == VisibilityLevel.SENSOR_CONTACT)
return;
167 boolean fire =
false;
183 CampaignPingSpec custom =
new CampaignPingSpec();
184 custom.setUseFactionColor(
true);
186 custom.setMinRange(range - 100f);
187 custom.setRange(200);
188 custom.setDuration(2f);
189 custom.setAlphaMult(0.25f);
190 custom.setInFraction(0.2f);
200 CampaignFleetAPI fleet =
getFleet();
201 if (fleet ==
null)
return;
207 if (
level > 0 && level < 1 && amount > 0) {
217 fleet.goSlowOneFrame();
223 boolean playedHit = !(
entity.isInCurrentLocation() &&
entity.isVisibleToPlayerFleet());
226 if (
entity.isInCurrentLocation()) {
227 Global.
getSector().getMemoryWithoutUpdate().set(MemFlags.GLOBAL_INTERDICTION_PULSE_JUST_USED_IN_CURRENT_LOCATION,
true, 0.1f);
229 fleet.getMemoryWithoutUpdate().set(MemFlags.JUST_DID_INTERDICTION_PULSE,
true, 0.1f);
231 CampaignPingSpec custom =
new CampaignPingSpec();
232 custom.setUseFactionColor(
true);
234 custom.setRange(range * 1.3f);
235 custom.setDuration(0.5f);
236 custom.setAlphaMult(1f);
237 custom.setInFraction(0.1f);
242 for (CampaignFleetAPI other : fleet.getContainingLocation().getFleets()) {
243 if (other == fleet)
continue;
244 if (other.getFaction() == fleet.getFaction())
continue;
245 if (other.isInHyperspaceTransition())
continue;
247 float dist = Misc.getDistance(fleet.getLocation(), other.getLocation());
248 if (dist > range)
continue;
252 if (interdictSeconds > 0 && interdictSeconds < 1f) interdictSeconds = 1f;
254 VisibilityLevel vis = other.getVisibilityLevelToPlayerFleet();
255 if (vis == VisibilityLevel.COMPOSITION_AND_FACTION_DETAILS ||
256 vis == VisibilityLevel.COMPOSITION_DETAILS ||
257 (vis == VisibilityLevel.SENSOR_CONTACT && fleet.isPlayerFleet())) {
258 if (interdictSeconds <= 0) {
259 other.addFloatingText(
"Interdict avoided!" , fleet.getFaction().getBaseUIColor(), 1f,
true);
262 other.addFloatingText(
"Interdict! (" + (
int) Math.round(interdictSeconds) +
"s)" , fleet.getFaction().getBaseUIColor(), 1f,
true);
266 float interdictDays = interdictSeconds /
Global.
getSector().getClock().getSecondsPerDay();
268 for (AbilityPlugin ability : other.getAbilities().values()) {
269 if (!ability.getSpec().hasTag(Abilities.TAG_BURN +
"+") &&
270 !ability.getSpec().hasTag(Abilities.TAG_DISABLED_BY_INTERDICT) &&
271 !ability.getId().equals(Abilities.INTERDICTION_PULSE))
continue;
273 float origCooldown = ability.getCooldownLeft();
275 if (ability.isActiveOrInProgress()) {
276 extra += ability.getSpec().getDeactivationCooldown() * ability.getProgressFraction();
277 ability.deactivate();
281 if (!ability.getSpec().hasTag(Abilities.TAG_BURN +
"+"))
continue;
283 float cooldown = interdictDays;
285 cooldown += origCooldown;
287 float max = Math.max(ability.getSpec().getDeactivationCooldown(), 2f);
288 if (cooldown > max) cooldown = max;
289 ability.setCooldownLeft(cooldown);
292 if (fleet.isPlayerFleet() && other.knowsWhoPlayerIs() && fleet.getFaction() != other.getFaction()) {
294 new RepActionEnvelope(RepActions.INTERDICTED,
null,
null,
false),
295 other.getFaction().getId());