32 if (
fleet.getBattle() !=
null)
return;
35 boolean isCurrentlyPirate =
fleet.getFaction().getId().equals(Factions.PIRATES);
37 if (
fleet.isTransponderOn() && !isCurrentlyPirate) {
41 if (isCurrentlyPirate) {
42 List<CampaignFleetAPI> visible = Misc.getVisibleFleets(
fleet,
false);
43 if (visible.isEmpty()) {
44 fleet.setFaction(Factions.INDEPENDENT,
true);
45 Misc.clearTarget(
fleet,
true);
50 List<CampaignFleetAPI> visible = Misc.getVisibleFleets(
fleet,
false);
51 if (visible.size() == 1) {
53 for (CampaignFleetAPI other : visible) {
54 if (
fleet.getAI() !=
null &&
55 Global.
getSector().getFaction(Factions.PIRATES).isHostileTo(other.getFaction())) {
56 EncounterOption option =
fleet.getAI().pickEncounterOption(
null, other,
true);
57 if (option == EncounterOption.ENGAGE || option == EncounterOption.HOLD) {
58 float dist = Misc.getDistance(
fleet.getLocation(), other.getLocation());
59 VisibilityLevel level = other.getVisibilityLevelTo(
fleet);
60 boolean seesComp = level == VisibilityLevel.COMPOSITION_AND_FACTION_DETAILS ||
61 level == VisibilityLevel.COMPOSITION_DETAILS;
62 if (dist < 800f && seesComp) {
69 if (weakerCount == 1) {
70 fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PIRATE,
true);
71 fleet.setNoFactionInName(
true);
72 fleet.setFaction(Factions.PIRATES,
true);