Skip to content

Commit e3931e2

Browse files
committed
If a bounty has no spawn locations, try again without Tags.THEME_HIDDEN.
1 parent 0e36d91 commit e3931e2

4 files changed

Lines changed: 26 additions & 12 deletions

File tree

CHANGELOGS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Version 1.5.2
22
**MagicBounty**
33
- Added `fleet_attitude` to MagicBounty, allowing you to make a fleet neutral or hostile.
4+
- If a bounty has no spawn locations, try again without Tags.THEME_HIDDEN.
5+
- For bounties that *only* spawn in hidden systems.
46
**MagicPaintjobs**
57
- Added template files for MagicPaintjobs 2.0.
68
- Fixed ships not showing up in new paintjob selector if they have a D-mod.

jars/MagicLib.jar

572 Bytes
Binary file not shown.

magiclib.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
{
99
"major": "1",
1010
"minor": "5",
11-
"patch": "2"
11+
"patch": "2-dev01"
1212
}
1313
}

src/org/magiclib/util/MagicCampaign.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.Collections;
4242
import java.util.List;
4343
import java.util.Map;
44+
import java.util.stream.Collectors;
4445

4546
import static com.fs.starfarer.api.util.Misc.MAX_OFFICER_LEVEL;
4647

@@ -720,10 +721,8 @@ public static MarketAPI addSimpleMarket(
720721
* @param factionId person's faction
721722
* @param rankId rank from campaign.ids.Ranks
722723
* @param postId post from campaign.ids.Ranks
723-
* @param isMarketAdmin
724+
* @param isMarketAdmin if the person is the market admin
724725
* @param industrialPlanning_level skill level for market admin
725-
* @param spaceOperation_level skill level for market admin
726-
* @param groundOperations_level skill level for market admin
727726
* @param commScreenPosition position order in the comm screen, 0 is the admin position
728727
* @return
729728
*/
@@ -1433,7 +1432,7 @@ public static SectorEntityToken findSuitableTarget(
14331432
desiredEntities = entities;
14341433
}
14351434

1436-
//lets check the system lists in order by prefered distances
1435+
// lets check the system lists in order by prefered distances
14371436
for (int i = 0; i < 3; i++) {
14381437
//check if the system list has anything, and shuffle it to ensure proper randomization
14391438
if (distance_priority.get(i).isEmpty()) {
@@ -1442,8 +1441,8 @@ public static SectorEntityToken findSuitableTarget(
14421441
Collections.shuffle(distance_priority.get(i));
14431442
}
14441443

1445-
//now check if any valid system got the required entity in this range band
1446-
//starting with unexplored systems if required
1444+
// now check if any valid system got the required entity in this range band
1445+
// starting with unexplored systems if required
14471446
if (prioritizeUnexplored) {
14481447
for (StarSystemAPI s : distance_priority.get(i)) {
14491448
//skip visited systems
@@ -1562,11 +1561,24 @@ public static SectorEntityToken findSuitableTarget(
15621561
if (verbose) {
15631562
log.warn("No valid system found");
15641563
}
1565-
return null;
1566-
}
15671564

1568-
////////////////////////////////////////////////////////////////////////////
1569-
//DUMPSTER
1570-
////////////////////////////////////////////////////////////////////////////
1565+
// If no valid systems were found, retry without the hardcoded Tags.THEME_HIDDEN restriction
1566+
// so that bounties that are intended to be in hidden systems will spawn.
1567+
if (avoid_themes != null && avoid_themes.contains(Tags.THEME_HIDDEN)) {
1568+
log.info("findSuitableTarget did not find a valid system, retrying without " + Tags.THEME_HIDDEN);
1569+
return findSuitableTarget(
1570+
entityIDs,
1571+
marketFactions,
1572+
distance,
1573+
seek_themes,
1574+
avoid_themes.stream().filter(t -> !t.equals(Tags.THEME_HIDDEN)).collect(Collectors.toList()),
1575+
entities,
1576+
defaultToAnyEntity,
1577+
prioritizeUnexplored,
1578+
verbose
1579+
);
1580+
}
15711581

1582+
return null;
1583+
}
15721584
}

0 commit comments

Comments
 (0)