49 boolean pickSpecificEntity = (float) Math.random() > 0.2f && !segment.from.getContainingLocation().isHyperspace();
50 if (pickSpecificEntity) {
54 Vector2f loc = Misc.getPointAtRadius(
new Vector2f(target.getLocation()), 500);
55 fleet.setLocation(loc.x, loc.y);
58 float speed = Misc.getSpeedForBurnLevel(8);
59 float dist = Misc.getDistance(
fleet.getLocation(), target.getLocation());
60 float seconds = dist / speed;
61 float days = seconds /
Global.
getSector().getClock().getSecondsPerDay();
62 days += 5f + 5f * (float) Math.random();
63 fleet.addAssignment(FleetAssignment.PATROL_SYSTEM, target, days,
"investigating");
67 Vector2f loc = Misc.getPointAtRadius(
new Vector2f(), 8000);
68 fleet.setLocation(loc.x, loc.y);
71 float days = 5f + 5f * (float) Math.random();
72 fleet.addAssignment(FleetAssignment.PATROL_SYSTEM,
null, days,
"exploring");
75 super.addLocalAssignment(segment, justSpawned);
94 if (
fleet.getBattle() !=
null)
return;
97 boolean isCurrentlyPirate =
fleet.getFaction().getId().equals(Factions.PIRATES);
99 if (
fleet.isTransponderOn() && !isCurrentlyPirate) {
103 if (isCurrentlyPirate) {
104 List<CampaignFleetAPI> visible = Misc.getVisibleFleets(
fleet,
false);
105 if (visible.isEmpty()) {
106 fleet.setFaction(Factions.INDEPENDENT,
true);
107 Misc.clearTarget(
fleet,
true);
112 List<CampaignFleetAPI> visible = Misc.getVisibleFleets(
fleet,
false);
113 if (visible.size() == 1) {
115 for (CampaignFleetAPI other : visible) {
116 if (
fleet.getAI() !=
null &&
117 Global.
getSector().getFaction(Factions.PIRATES).isHostileTo(other.getFaction())) {
118 EncounterOption option =
fleet.getAI().pickEncounterOption(
null, other,
true);
119 if (option == EncounterOption.ENGAGE || option == EncounterOption.HOLD) {
120 float dist = Misc.getDistance(
fleet.getLocation(), other.getLocation());
121 VisibilityLevel level = other.getVisibilityLevelTo(
fleet);
122 boolean seesComp = level == VisibilityLevel.COMPOSITION_AND_FACTION_DETAILS ||
123 level == VisibilityLevel.COMPOSITION_DETAILS;
124 if (dist < 800f && seesComp) {
131 if (weakerCount == 1) {
132 fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PIRATE,
true);
133 fleet.setNoFactionInName(
true);
134 fleet.setFaction(Factions.PIRATES,
true);