23 for (MarketAPI market :
Global.
getSector().getEconomy().getMarketsCopy()) {
24 String fid = market.getFactionId();
25 if (fid.equals(Factions.LUDDIC_CHURCH) ||
26 fid.equals(Factions.LUDDIC_PATH) ||
27 fid.equals(Factions.KOL)) {
28 count += market.getSize();
37 if (
true)
return null;
38 if (target ==
null)
return null;
40 String fleetType = FleetTypes.PATROL_SMALL;
43 for (
int i = 0; i < 3; i++) {
44 if ((
float) Math.random() > 0.5f) {
87 if (fleet ==
null || fleet.isEmpty())
return null;
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_PASSIVE, 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 "orbiting " + source.getName());
140 WeightedRandomPicker<StarSystemAPI> picker =
new WeightedRandomPicker<StarSystemAPI>();
142 if (system.hasTag(Tags.SYSTEM_CUT_OFF_FROM_HYPER)) {
146 float mult = Misc.getSpawnChanceMult(system.getLocation());
151 for (MarketAPI market : Misc.getMarketsInLocation(system)) {
152 if (market.getFactionId().equals(Factions.LUDDIC_CHURCH))
continue;
153 if (market.getFactionId().equals(Factions.LUDDIC_PATH))
continue;
154 if (market.getFactionId().equals(Factions.KOL))
continue;
156 float w = 11f - market.getStabilityValue() + market.getSize();
157 if (w > weight) weight = w;
161 picker.add(system, weight);
164 return picker.pick();