36 if (target ==
null ||
true)
return null;
38 WeightedRandomPicker<MercType> picker =
new WeightedRandomPicker<MercType>();
39 picker.add(MercType.SCOUT, 10f);
40 picker.add(MercType.BOUNTY_HUNTER, 10f);
41 picker.add(MercType.PRIVATEER, 10f);
42 picker.add(MercType.PATROL, 10f);
43 picker.add(MercType.ARMADA, 3f);
45 MercType type = picker.pick();
51 String fleetType = type.fleetType;
54 combat = Math.round(1f + (
float) Math.random() * 2f);
58 combat = Math.round(3f + (
float) Math.random() * 2f);
61 combat = Math.round(9f + (
float) Math.random() * 3f);
64 combat = Math.round(12f + (
float) Math.random() * 8f);
87 if (fleet ==
null || fleet.isEmpty())
return null;
90 fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PIRATE,
true);
92 MarketAPI source = Misc.getSourceMarket(fleet);
93 if (source ==
null)
return null;
96 boolean spawnAtSource =
true;
98 float sourceToPlayer = Misc.getDistance(player.getLocation(), source.getLocationInHyperspace());
99 float targetToPlayer = Misc.getDistance(player.getLocation(), target.getLocation());
100 spawnAtSource = sourceToPlayer < targetToPlayer;
104 source.getPrimaryEntity().getContainingLocation().addEntity(fleet);
105 fleet.setLocation(source.getPrimaryEntity().getLocation().x, source.getPrimaryEntity().getLocation().y);
107 fleet.addAssignment(FleetAssignment.ORBIT_AGGRESSIVE, source.getPrimaryEntity(), 2f + (
float) Math.random() * 2f,
108 "orbiting " + source.getName());
112 fleet.setLocation(loc.x, loc.y);
116 Vector2f dest = Misc.getPointAtRadius(target.getLocation(), 1500);
118 SectorEntityToken token = hyper.createToken(dest.x, dest.y);
120 fleet.addAssignment(FleetAssignment.GO_TO_LOCATION, token, 1000,
121 "traveling to the " + target.getBaseName() +
" star system");
123 if ((
float) Math.random() > 0.75f) {
124 fleet.addAssignment(FleetAssignment.RAID_SYSTEM, target.getHyperspaceAnchor(), 20,
125 "raiding around the " + target.getBaseName() +
" star system");
127 fleet.addAssignment(FleetAssignment.RAID_SYSTEM, target.getCenter(), 20,
128 "raiding the " + target.getBaseName() +
" star system");
130 fleet.addAssignment(FleetAssignment.GO_TO_LOCATION, source.getPrimaryEntity(), 1000,
131 "returning to " + source.getName());
132 fleet.addAssignment(FleetAssignment.ORBIT_PASSIVE, source.getPrimaryEntity(), 2f + 2f * (
float) Math.random(),
133 "offloading ill-gotten goods");
134 fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, source.getPrimaryEntity(), 1000);
141 WeightedRandomPicker<StarSystemAPI> picker =
new WeightedRandomPicker<StarSystemAPI>();
143 float mult = Misc.getSpawnChanceMult(system.getLocation());
145 if (system.hasTag(Tags.SYSTEM_CUT_OFF_FROM_HYPER)) {
152 for (MarketAPI market : Misc.getMarketsInLocation(system)) {
153 if (market.getFactionId().equals(Factions.PIRATES))
continue;
155 float w = 11f - market.getStabilityValue() + market.getSize();
156 if (w > weight) weight = w;
162 weight *= (bounties + 1);
165 picker.add(system, weight);
167 return picker.pick();
171 public static CampaignFleetAPI
createPirateFleet(
int combatPoints, RouteData route, Vector2f locInHyper) {
172 float combat = combatPoints;
174 float freighter = 0f;
176 MercType type = MercType.SCOUT;
177 if (combat >= 18f) type = MercType.ARMADA;
178 if (combat >= 12f) type = MercType.PATROL;
180 if ((
float) Math.random() < 0.5f) {
181 type = MercType.PRIVATEER;
183 type = MercType.BOUNTY_HUNTER;
189 String fleetType = type.fleetType;
192 route !=
null ? route.getMarket() :
null,
195 route !=
null ? route.getQualityOverride() :
null,
206 params.timestamp = route.getTimestamp();
211 if (fleet ==
null || fleet.isEmpty())
return null;
213 fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PIRATE,
true);
214 fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_ALLOW_LONG_PURSUIT,
true);
216 MarketAPI source = Misc.getSourceMarket(fleet);
217 if (source ==
null)
return null;