1package com.fs.starfarer.api.impl.campaign.intel.events;
3import java.util.Random;
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.campaign.CampaignFleetAPI;
7import com.fs.starfarer.api.campaign.StarSystemAPI;
8import com.fs.starfarer.api.campaign.econ.MarketAPI;
9import com.fs.starfarer.api.impl.campaign.fleets.DisposableFleetManager;
10import com.fs.starfarer.api.impl.campaign.ids.Factions;
11import com.fs.starfarer.api.util.Misc;
12import com.fs.starfarer.api.util.WeightedRandomPicker;
21 protected Random
random =
new Random();
35 return "hostile_activity";
46 if (intel ==
null)
return 0;
53 if (timestamp !=
null) {
55 if (daysSince < delay)
return 0;
59 boolean longEnough =
false;
61 if (market.getDaysInExistence() >= delay) {
82 if (mag <= 0f)
return 0;
84 if (mag > 1f) mag = 1f;
86 float desiredNumFleets = 1f;
92 desiredNumFleets += (int)Math.round(mag * (max - 1f) * mult);
94 return (
int) Math.round(desiredNumFleets);
104 if (player ==
null)
return null;
107 float minDist = Float.MAX_VALUE;
126 if (distToPlayerLY < minDist) {
129 minDist = distToPlayerLY;
146 if (system ==
null)
return null;
149 if (player ==
null)
return null;
152 if (intel ==
null)
return null;
154 String idKey =
"$dhafm_ID";
166 for (ManagedFleetData data :
active) {
167 if (data.fleet !=
null &&
168 curr.
getId().equals(data.fleet.getMemoryWithoutUpdate().getString(idKey))) {
178 if (pick ==
null)
return null;
182 if (fleet ==
null || fleet.
isEmpty())
return null;
static SettingsAPI getSettings()
static SectorAPI getSector()
List< ManagedFleetData > active
static final float DESPAWN_RANGE_LY
void setLocationAndOrders(CampaignFleetAPI fleet, float probStartInHyper, float probStayInHyper)
StarSystemAPI currSpawnLoc
static final float MAX_RANGE_FROM_PLAYER_LY
static final String PLAYER
Long getPlayerVisibleTimestamp()
List< EventFactor > getFactors()
CampaignFleetAPI spawnFleetImpl()
StarSystemAPI pickNearestPopulatedSystem()
HostileActivityEventIntel getIntel()
StarSystemAPI pickCurrentSpawnLocation()
int getDesiredNumFleetsForSpawnLocation()
DisposableHostileActivityFleetManager()
float getNumFleetsMultiplier(StarSystemAPI system)
static HostileActivityEventIntel get()
float getMarketPresenceFactor(StarSystemAPI system)
float getTotalActivityMagnitude(StarSystemAPI system)
static List< StarSystemAPI > getSystemsWithPlayerColonies(boolean includeNonPlayerFaction)
static float getDistanceLY(SectorEntityToken from, SectorEntityToken to)
static List< MarketAPI > getMarketsInLocation(LocationAPI location, String factionId)
static float interpolate(float from, float to, float progress)
float getFloat(String key)
float getElapsedDaysSince(long timestamp)
CampaignFleetAPI getPlayerFleet()
CampaignClockAPI getClock()
boolean isInNewGameAdvance()
Vector2f getLocationInHyperspace()
MemoryAPI getMemoryWithoutUpdate()
void set(String key, Object value)
float getSpawnInHyperProbability(StarSystemAPI system)
float getStayInHyperProbability(StarSystemAPI system)
float getSpawnFrequency(StarSystemAPI system)
CampaignFleetAPI createFleet(StarSystemAPI system, Random random)
int getMaxNumFleets(StarSystemAPI system)