Starsector API
Loading...
Searching...
No Matches
RemoraGhost.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.ghosts.types;
2
3import org.lwjgl.util.vector.Vector2f;
4
5import com.fs.starfarer.api.campaign.CampaignFleetAPI;
6import com.fs.starfarer.api.campaign.SectorEntityToken;
7import com.fs.starfarer.api.impl.campaign.ghosts.BaseSensorGhost;
8import com.fs.starfarer.api.impl.campaign.ghosts.GBCircle;
9import com.fs.starfarer.api.impl.campaign.ghosts.GBFollowClosely;
10import com.fs.starfarer.api.impl.campaign.ghosts.GBGoAwayFrom;
11import com.fs.starfarer.api.impl.campaign.ghosts.GBIRemoraDrain;
12import com.fs.starfarer.api.impl.campaign.ghosts.GBIntercept;
13import com.fs.starfarer.api.impl.campaign.ghosts.SensorGhostManager;
14import com.fs.starfarer.api.impl.campaign.ids.Tags;
15
16public class RemoraGhost extends BaseSensorGhost {
17
18 public RemoraGhost(SensorGhostManager manager, SectorEntityToken target, float duration) {
19 this(manager, target, duration, null);
20 }
21 public RemoraGhost(SensorGhostManager manager, SectorEntityToken target, float duration, Vector2f loc) {
22 super(manager, 50);
23
24 float circleRadius = genFloat(0f, 50f);
25 if (target instanceof CampaignFleetAPI) {
26 circleRadius = genFloat(300f, 500f);
27 }
28
31 entity.addTag(Tags.IMMUNE_TO_REMORA_PULSE);
32
33 if (loc != null) {
34 setLoc(loc);
35 } else if (target.isPlayerFleet()) {
36 if (!placeNearPlayer()) {
38 return;
39 }
40 } else {
41 placeNearEntity(target, 200f, 300f);
42 }
43
44 addBehavior(new GBIntercept(target, 10f, 25, circleRadius + 500f, true));
45 if (target instanceof CampaignFleetAPI) {
46 setAccelMult(5f);
47 addBehavior(new GBCircle(target, duration, 25 + manager.getRandom().nextInt(6), circleRadius, 1f));
48 } else {
49 setAccelMult(0.1f); // GBFollowClosely doesn't work well otherwise
50 addBehavior(new GBFollowClosely(target, duration, 50, 200f, 300f));
51 }
52 addInterrupt(new GBIRemoraDrain(target, 750f));
53 addBehavior(new GBGoAwayFrom(5f, target, 20));
54 }
55}
56
57
58
59
60
61
62
63
64
65
66
void placeNearEntity(SectorEntityToken entity, float minDist, float maxDist)
void addInterrupt(GhostBehaviorInterrupt interrupt)
RemoraGhost(SensorGhostManager manager, SectorEntityToken target, float duration, Vector2f loc)
RemoraGhost(SensorGhostManager manager, SectorEntityToken target, float duration)