1package com.fs.starfarer.api.impl.campaign.ghosts;
3import java.util.ArrayList;
4import java.util.Iterator;
6import java.util.Random;
8import com.fs.starfarer.api.EveryFrameScript;
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.CampaignFleetAPI;
11import com.fs.starfarer.api.campaign.SectorEntityToken;
12import com.fs.starfarer.api.impl.campaign.ghosts.types.AbyssalDrifterGhostCreator;
13import com.fs.starfarer.api.impl.campaign.ghosts.types.ChargerGhostCreator;
14import com.fs.starfarer.api.impl.campaign.ghosts.types.EchoGhostCreator;
15import com.fs.starfarer.api.impl.campaign.ghosts.types.EncounterTricksterGhostCreator;
16import com.fs.starfarer.api.impl.campaign.ghosts.types.GuideGhostCreator;
17import com.fs.starfarer.api.impl.campaign.ghosts.types.LeviathanCalfGhostCreator;
18import com.fs.starfarer.api.impl.campaign.ghosts.types.LeviathanGhostCreator;
19import com.fs.starfarer.api.impl.campaign.ghosts.types.MinnowGhostCreator;
20import com.fs.starfarer.api.impl.campaign.ghosts.types.NoGhostCreator;
21import com.fs.starfarer.api.impl.campaign.ghosts.types.RacerGhostCreator;
22import com.fs.starfarer.api.impl.campaign.ghosts.types.RemnantGhostCreator;
23import com.fs.starfarer.api.impl.campaign.ghosts.types.RemoraGhostCreator;
24import com.fs.starfarer.api.impl.campaign.ghosts.types.ShipGhostCreator;
25import com.fs.starfarer.api.impl.campaign.ghosts.types.StormTricksterGhostCreator;
26import com.fs.starfarer.api.impl.campaign.ghosts.types.StormcallerGhostCreator;
27import com.fs.starfarer.api.impl.campaign.ghosts.types.ZigguratGhostCreator;
28import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
29import com.fs.starfarer.api.util.Misc;
30import com.fs.starfarer.api.util.TimeoutTracker;
31import com.fs.starfarer.api.util.WeightedRandomPicker;
35 public static List<SensorGhostCreator>
CREATORS =
new ArrayList<SensorGhostCreator>();
80 protected List<SensorGhost>
ghosts =
new ArrayList<SensorGhost>();
84 String ghostManagerKey =
"$ghostManager";
86 if (manager ==
null) {
100 if (manager ==
null)
return null;
111 if (amount == 0)
return;
113 if (pf ==
null)
return;
136 Iterator<SensorGhost> iter =
ghosts.iterator();
137 while (iter.hasNext()) {
163 if (dist > range)
continue;
183 if (nearStream && !creator.canSpawnWhilePlayerInOrNearSlipstream())
continue;
184 if (inAbyss && !creator.canSpawnWhilePlayerInAbyss())
continue;
185 if (!inAbyss && !creator.canSpawnWhilePlayerOutsideAbyss())
continue;
187 float freq = creator.getFrequency(
this);
188 picker.
add(creator, freq);
192 if (creator ==
null)
return;
196 boolean canSpawn =
true;
206 List<SensorGhost>
ghosts =
null;
210 boolean anyFailed =
false;
213 anyFailed |= curr.isCreationFailed();
226 this.ghosts.addAll(
ghosts);
241 if (clazz.isInstance(ghost))
return true;
static SectorAPI getSector()
static SensorGhostManager getGhostManager()
List< SensorGhost > ghosts
static float GHOST_SPAWN_RATE_MULT
static float MIN_SHORT_GHOST_TIMEOUT_DAYS
static float SB_FAILED_TO_ATTRACT_TIMEOUT_MULT
boolean hasGhostOfClass(Class<?> clazz)
static float MAX_FULL_GHOST_TIMEOUT_DAYS
static float MIN_SB_TIMEOUT
static float MAX_SB_TIMEOUT
static List< SensorGhostCreator > CREATORS
static float MAX_SHORT_GHOST_TIMEOUT_DAYS
static float MAX_FAILED_CREATOR_TIMEOUT_DAYS
static float FULL_TIMEOUT_TRIGGER_PROBABILITY
List< SensorGhost > getGhosts()
static SensorGhost getGhostFor(SectorEntityToken entity)
void advance(float amount)
static float MIN_FULL_GHOST_TIMEOUT_DAYS
TimeoutTracker< String > perCreatorTimeouts
static float MIN_FAILED_CREATOR_TIMEOUT_DAYS
boolean spawnTriggeredBySensorBurst
static float SB_ATTRACT_GHOSTS_PROBABILITY
static float GHOST_SPAWN_RATE_MULT_IN_ABYSS
boolean isSpawnTriggeredBySensorBurst()
static final String GLOBAL_SENSOR_BURST_JUST_USED_IN_CURRENT_LOCATION
static final String JUST_DID_SENSOR_BURST
static boolean isInAbyss(Vector2f loc)
static boolean isInsideSlipstream(Vector2f loc, float radius)
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static long genRandomSeed()
static float getAbyssalDepth(Vector2f loc)
void advance(float amount)
float convertToDays(float realSeconds)
LocationAPI getContainingLocation()
List< CampaignFleetAPI > getFleets()
CampaignFleetAPI getPlayerFleet()
CampaignClockAPI getClock()
LocationAPI getCurrentLocation()
List< EveryFrameScript > getScripts()
MemoryAPI getMemoryWithoutUpdate()
void set(String key, Object value)
boolean getBoolean(String key)
List< SensorGhost > createGhost(SensorGhostManager manager)
boolean canSpawnWhilePlayerInAbyss()
float getTimeoutDaysOnSuccessfulCreate(SensorGhostManager manager)
CustomCampaignEntityAPI getEntity()