115 Industry best =
null;
118 for (Industry ind :
market.getIndustries()) {
119 if (!ind.getSpec().hasTag(Industries.TAG_USES_BLUEPRINTS))
continue;
122 for (MutableCommodityQuantity q : ind.getAllSupply()) {
123 scale = Math.max(scale, q.getQuantity().getModifiedInt());
125 for (MutableCommodityQuantity q : ind.getAllDemand()) {
126 scale = Math.max(scale, q.getQuantity().getModifiedInt());
128 int currScore = scale;
129 RaidDangerLevel danger = ind.adjustItemDangerLevel(Commodities.BLUEPRINTS,
null, base);
130 currScore += 1000 - danger.ordinal();
131 if (currScore > score) {
171 public int performRaid(CargoAPI loot, Random random,
float lootMult, TextPanelAPI text) {
176 String ship =
"MarketCMD_ship____";
177 String weapon =
"MarketCMD_weapon__";
178 String fighter =
"MarketCMD_fighter_";
184 WeightedRandomPicker<String> notDroppedBefore =
new WeightedRandomPicker<String>(random);
185 WeightedRandomPicker<String> other =
new WeightedRandomPicker<String>(random);
186 for (String
id :
market.getFaction().getKnownShips()) {
189 String id2 = ship +
id;
190 if (!playerFaction.knowsShip(
id) && !droppedBefore.contains(id2)) {
191 notDroppedBefore.add(id2, 1f);
196 for (String
id :
market.getFaction().getKnownWeapons()) {
199 String id2 = weapon +
id;
200 if (!playerFaction.knowsWeapon(
id) && !droppedBefore.contains(id2)) {
201 notDroppedBefore.add(weapon +
id, 1f);
203 other.add(weapon +
id, 1f);
206 for (String
id :
market.getFaction().getKnownFighters()) {
209 String id2 = fighter +
id;
210 if (!playerFaction.knowsFighter(
id) && !droppedBefore.contains(id2)) {
211 notDroppedBefore.add(fighter +
id, 1f);
213 other.add(fighter +
id, 1f);
220 int num = q.one + random.nextInt(q.two - q.one + 1);
221 for (
int i = 0; i < num && (!notDroppedBefore.isEmpty() || !other.isEmpty()); i++) {
224 id = notDroppedBefore.pickAndRemove();
228 id = other.pickAndRemove();
230 if (
id ==
null)
continue;
232 droppedBefore.add(
id);
234 if (
id.startsWith(ship)) {
235 String specId =
id.substring(ship.length());
237 looted.addSpecial(
new SpecialItemData(Items.SHIP_BP, specId), 1);
238 }
else if (
id.startsWith(weapon)) {
239 String specId =
id.substring(weapon.length());
241 looted.addSpecial(
new SpecialItemData(Items.WEAPON_BP, specId), 1);
242 }
else if (
id.startsWith(fighter)) {
243 String specId =
id.substring(fighter.length());
245 looted.addSpecial(
new SpecialItemData(Items.FIGHTER_BP, specId), 1);
250 for (CargoStackAPI stack :
looted.getStacksCopy()) {
251 totalValue += stack.getBaseValuePerUnit() * stack.getSize();