1package com.fs.starfarer.api.impl.campaign.intel.bases;
3import java.util.ArrayList;
4import java.util.Collections;
5import java.util.Comparator;
6import java.util.LinkedHashMap;
7import java.util.LinkedHashSet;
9import java.util.Random;
11import com.fs.starfarer.api.EveryFrameScript;
12import com.fs.starfarer.api.Global;
13import com.fs.starfarer.api.campaign.StarSystemAPI;
14import com.fs.starfarer.api.campaign.econ.Industry;
15import com.fs.starfarer.api.campaign.econ.MarketAPI;
16import com.fs.starfarer.api.impl.campaign.DebugFlags;
17import com.fs.starfarer.api.impl.campaign.Tuning;
18import com.fs.starfarer.api.impl.campaign.ids.Factions;
19import com.fs.starfarer.api.impl.campaign.ids.Tags;
20import com.fs.starfarer.api.impl.campaign.intel.BaseEventManager;
21import com.fs.starfarer.api.impl.campaign.intel.events.LuddicPathHostileActivityFactor;
22import com.fs.starfarer.api.util.IntervalUtil;
23import com.fs.starfarer.api.util.Misc;
24import com.fs.starfarer.api.util.Pair;
25import com.fs.starfarer.api.util.WeightedRandomPicker;
34 public static final String
KEY =
"$core_luddicPathBaseManager";
77 cells =
new LinkedHashMap<MarketAPI, LuddicPathCellsIntel>();
89 super.advance(amount);
105 protected LinkedHashMap<MarketAPI, LuddicPathCellsIntel>
cells =
new LinkedHashMap<MarketAPI, LuddicPathCellsIntel>();
112 List<Pair<MarketAPI, Float>> marketAndScore =
new ArrayList<Pair<MarketAPI,Float>>();
115 if (market.getEconGroup() !=
null)
continue;
116 if (market.getSize() < 4)
continue;
119 if (score >= minInterest) {
124 int numActive = Math.round(total * fraction);
125 int numSleeper = numActive;
130 LinkedHashSet<MarketAPI>
active =
new LinkedHashSet<MarketAPI>();
131 LinkedHashSet<MarketAPI> sleeper =
new LinkedHashSet<MarketAPI>();
136 return (
int) Math.signum(o2.
two - o1.
two);
142 if (count < numActive) {
144 }
else if (count < numActive + numSleeper) {
153 for (
MarketAPI market :
new ArrayList<MarketAPI>(
cells.keySet())) {
156 if (!
active.contains(market) && !sleeper.contains(market)) {
168 cells.remove(market);
171 List<MarketAPI> sleeperList =
new ArrayList<MarketAPI>(sleeper);
172 for (
int i = sleeperList.size() - 1; i >= 0; i--) {
175 if (otherIntel !=
null)
continue;
177 sleeper.remove(other);
182 List<MarketAPI> activeList =
new ArrayList<MarketAPI>(
active);
183 for (
int i = activeList.size() - 1; i >= 0; i--) {
186 if (otherIntel !=
null)
continue;
204 cells.put(market, intel);
217 cells.put(market, intel);
228 if (aiCoreId !=
null) {
233 total += ind.getPatherInterest();
237 total +=
new Random(market.
getName().hashCode()).nextFloat() * 0.1f;
264 if (system ==
null)
return null;
269 if (intel.
isDone()) intel =
null;
284 if (days < 45f)
continue;
300 if (weight <= 0f)
continue;
302 float usefulStuff = system.getCustomEntitiesWithTag(
Tags.
OBJECTIVE).size() +
304 if (usefulStuff <= 0)
continue;
309 float dist = system.getLocation().length();
319 far.
add(system, weight * usefulStuff * distMult);
321 picker.
add(system, weight * usefulStuff * distMult);
329 return picker.
pick();
static SettingsAPI getSettings()
static SectorAPI getSector()
static boolean PATHER_BASE_DEBUG
static int PATHER_BASE_MIN_TIMEOUT_MONTHS
static int PATHER_BASE_MAX_TIMEOUT_MONTHS
static final String LUDDIC_PATH
static final String LUDDIC_CHURCH
List< EveryFrameScript > active
void sendUpdateIfPlayerHasIntel(Object listInfoParam, TextPanelAPI textPanel)
void advance(float amount)
LinkedHashMap< MarketAPI, LuddicPathCellsIntel > cells
static final float INERTIA_DAYS_MIN
static final float INERTIA_DAYS_MAX
static LuddicPathBaseManager getInstance()
StarSystemAPI pickSystemForLPBase()
static float getLuddicPathMarketInterest(MarketAPI market)
static final float CHECK_PROB
static float AI_CORE_ADMIN_INTEREST
EveryFrameScript createEvent()
static float LUDDIC_CHURCH_INTEREST_MULT
static final float CHECK_DAYS
static float PLAYER_DEFEATED_PATHER_CRISIS_INTEREST_MULT
static Object UPDATE_DISSOLVED
void setInertiaTime(float inertiaTime)
static LuddicPathBaseIntel getClosestBase(MarketAPI market)
void makeActiveIfPossible()
static String RECENTLY_USED_FOR_BASE
static boolean isPlayerDefeatedPatherExpedition()
void advance(float amount)
static List< MarketAPI > getMarketsInLocation(LocationAPI location, String factionId)
static boolean hasPulsar(StarSystemAPI system)
static float getDays(float amount)
void addAll(Collection< T > items)
float getFloat(String key)
float getElapsedDaysSince(long timestamp)
List< StarSystemAPI > getStarSystems()
CampaignClockAPI getClock()
MemoryAPI getMemoryWithoutUpdate()
List< MarketAPI > getMarketsCopy()
List< Industry > getIndustries()
void set(String key, Object value)