42 float stability =
market.getStabilityValue();
46 boolean military = Misc.isMilitary(
market);
56 WeightedRandomPicker<String> factionPicker =
new WeightedRandomPicker<String>();
57 factionPicker.add(
market.getFactionId(), 15f - stability);
58 factionPicker.add(Factions.INDEPENDENT, 4f);
59 factionPicker.add(
submarket.getFaction().getId(), 6f);
61 int weapons = 6 + Math.max(0,
market.getSize() - 1) + (military ? 5 : 0);
62 int fighters = 2 + Math.max(0, (
market.getSize() - 3) / 2) + (military ? 2 : 0);
63 weapons = 6 + Math.max(0,
market.getSize() - 1);
64 fighters = 2 + Math.max(0, (
market.getSize() - 3) / 2);
66 addWeapons(weapons, weapons + 2, 3, factionPicker);
67 addFighters(fighters, fighters + 2, 3, factionPicker);
70 weapons =
market.getSize();
71 fighters = Math.max(1,
market.getSize() / 3);
76 float sMult = 0.5f + Math.max(0, (1f - stability / 10f)) * 0.5f;
77 getCargo().getMothballedShips().clear();
80 FactionDoctrineAPI doctrine =
market.getFaction().getDoctrine().clone();
97 FactionDoctrineAPI doctrineOverride =
submarket.getFaction().getDoctrine().clone();
98 doctrineOverride.setWarships(3);
99 doctrineOverride.setPhaseShips(2);
100 doctrineOverride.setCarriers(2);
101 doctrineOverride.setCombatFreighterProbability(1f);
102 doctrineOverride.setShipSize(5);
111 Math.min(1f, Misc.getShipQuality(
market,
market.getFactionId()) + 0.5f),
125 Math.min(1f, Misc.getShipQuality(
market,
market.getFactionId()) + 0.5f),
201 for (CargoStackAPI stack : transaction.getSold().getStacksCopy()) {
202 SpecialItemPlugin plugin = stack.getPlugin();
203 if (plugin instanceof BlueprintProviderItem) {
204 BlueprintProviderItem bpi = (BlueprintProviderItem) plugin;
206 boolean learnedSomething =
false;
207 if (bpi.getProvidedFighters() !=
null) {
208 for (String
id : bpi.getProvidedFighters()) {
209 if (faction.knowsFighter(
id))
continue;
211 learnedSomething =
true;
214 if (bpi.getProvidedWeapons() !=
null) {
215 for (String
id : bpi.getProvidedWeapons()) {
216 if (faction.knowsWeapon(
id))
continue;
218 learnedSomething =
true;
221 if (bpi.getProvidedShips() !=
null) {
222 for (String
id : bpi.getProvidedShips()) {
223 if (faction.knowsShip(
id))
continue;
225 learnedSomething =
true;
228 if (bpi.getProvidedIndustries() !=
null) {
229 for (String
id : bpi.getProvidedIndustries()) {
230 if (faction.knowsIndustry(
id))
continue;
232 learnedSomething =
true;
236 if (learnedSomething) {
237 cargo.removeItems(stack.getType(), stack.getData(), 1);