Starsector API
Loading...
Searching...
No Matches
LeviathanGhostCreator.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.ghosts.types;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import com.fs.starfarer.api.Global;
7import com.fs.starfarer.api.impl.campaign.ghosts.BaseSensorGhostCreator;
8import com.fs.starfarer.api.impl.campaign.ghosts.GhostFrequencies;
9import com.fs.starfarer.api.impl.campaign.ghosts.SensorGhost;
10import com.fs.starfarer.api.impl.campaign.ghosts.SensorGhostManager;
11
13
14 @Override
15 public List<SensorGhost> createGhost(SensorGhostManager manager) {
16 if (!Global.getSector().getCurrentLocation().isHyperspace()) return null;
17
18 float r = manager.getRandom().nextFloat();
19
20 boolean withCalf = false;
21 int numRemora = 0;
22 if (r < 0.1f) {
23 withCalf = true;
24 } else if (r < 0.3f) {
25 numRemora = 1 + manager.getRandom().nextInt(3);
26 }
27
28// calf = false;
29// numRemora = 3;
30
31 List<SensorGhost> result = new ArrayList<SensorGhost>();
32 LeviathanGhost g = new LeviathanGhost(manager, 0);
33 if (g.isCreationFailed()) return null;
34
35 result.add(g);
36
37 if (withCalf) {
39 result.add(c);
40 }
41 if (numRemora > 0) {
42 for (int i = 0; i < numRemora; i++) {
43 RemoraGhost remora = new RemoraGhost(manager, g.getEntity(), 1000f); // however long the Leviathan lasts
44 if (!remora.isCreationFailed()) {
45 result.add(remora);
46 }
47 }
48 }
49
50 return result;
51 }
52
53
54 @Override
55 public float getFrequency(SensorGhostManager manager) {
56 //return 100000f;
58 }
59
61 return true;
62 }
63}
static SectorAPI getSector()
Definition Global.java:59
static float getLeviathanFrequency(SensorGhostManager manager)