Starsector API
Loading...
Searching...
No Matches
EncounterTricksterGhost.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.ghosts.types;
2
3import java.util.Random;
4
5import org.lwjgl.util.vector.Vector2f;
6
7import com.fs.starfarer.api.Global;
8import com.fs.starfarer.api.campaign.CampaignFleetAPI;
9import com.fs.starfarer.api.campaign.FleetAssignment;
10import com.fs.starfarer.api.campaign.SectorEntityToken;
11import com.fs.starfarer.api.impl.campaign.ghosts.BaseSensorGhost;
12import com.fs.starfarer.api.impl.campaign.ghosts.GBCircle;
13import com.fs.starfarer.api.impl.campaign.ghosts.GBITowardsEntity;
14import com.fs.starfarer.api.impl.campaign.ghosts.GBIntercept;
15import com.fs.starfarer.api.impl.campaign.ghosts.GBLeadPlayerTo;
16import com.fs.starfarer.api.impl.campaign.ghosts.SensorGhostManager;
17
19
20 public EncounterTricksterGhost(SensorGhostManager manager, CampaignFleetAPI other, boolean guideToTarget) {
21 super(manager, guideToTarget ? 40 : 20);
22
23 Random random = manager.getRandom();
24 CampaignFleetAPI pf = Global.getSector().getPlayerFleet();
25 float circleRadius = genFloat(300f, 400f);
26
28 placeNearEntity(other, 0f, 0f);
29
30 setDespawnRange(-1000f);
31
32 if (guideToTarget) {
33 SectorEntityToken e = pf.getContainingLocation().createToken(new Vector2f(other.getLocation()));
34 other.addAssignment(FleetAssignment.ORBIT_AGGRESSIVE,
35 e, 10f + 20f * random.nextFloat(), "investigating anomalous readings");
36
37 addBehavior(new GBIntercept(pf, 10f, 40, circleRadius + 500f, true));
38 addBehavior(new GBCircle(pf, genDelay(2f), 40, circleRadius, 1f));
39 addInterrupt(new GBITowardsEntity(genDelay(1.5f), pf, other));
40 addBehavior(new GBLeadPlayerTo(20f, other, genFloat(500f, 600f), 25));
41 } else {
42 other.addAssignment(FleetAssignment.ORBIT_AGGRESSIVE,
43 entity, 10f + 20f * random.nextFloat(), "investigating sensor ghost");
44
45 addBehavior(new GBIntercept(pf, 10f, (int)Math.round(other.getFleetData().getBurnLevel()) + 1, 100f, true));
46 }
47
48 }
49
50}
51
52
53
54
55
56
static SectorAPI getSector()
Definition Global.java:59
void placeNearEntity(SectorEntityToken entity, float minDist, float maxDist)
void addInterrupt(GhostBehaviorInterrupt interrupt)
EncounterTricksterGhost(SensorGhostManager manager, CampaignFleetAPI other, boolean guideToTarget)