1package com.fs.starfarer.api.impl.campaign.ghosts;
3import org.lwjgl.util.vector.Vector2f;
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.campaign.CampaignFleetAPI;
7import com.fs.starfarer.api.campaign.CustomCampaignEntityAPI;
8import com.fs.starfarer.api.campaign.SectorEntityToken;
9import com.fs.starfarer.api.characters.AbilityPlugin;
10import com.fs.starfarer.api.impl.campaign.ghosts.GBIGenerateSlipstream.GhostBehaviorWithSlipstream;
11import com.fs.starfarer.api.impl.campaign.ids.Abilities;
12import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
13import com.fs.starfarer.api.impl.campaign.velfield.SlipstreamTerrainPlugin2;
14import com.fs.starfarer.api.util.Misc;
27 protected SectorEntityToken
from;
28 protected float phase = (float) Math.random();
30 protected SlipstreamTerrainPlugin2
plugin;
49 if (
from.getContainingLocation() != ghost.
getEntity().getContainingLocation() ||
50 ghost.
getEntity().getContainingLocation() ==
null || !
from.isAlive()) {
54 super.advance(amount, ghost);
57 dir = Misc.getAngleInDegrees(
from.getLocation(), ghost.
getEntity().getLocation());
63 float pi = (float) Math.PI;
64 float sin = (float) Math.sin(
phase * pi * 2f);
68 float angle =
dir + sin * maxAngleOffset;
99 Vector2f loc = Misc.getUnitVectorAtDegreeAngle(angle);
101 Vector2f.add(loc, ghost.
getEntity().getLocation(), loc);
107 if (!
Global.
getSector().getMemoryWithoutUpdate().getBoolean(MemFlags.GLOBAL_INTERDICTION_PULSE_JUST_USED_IN_CURRENT_LOCATION)) {
110 CustomCampaignEntityAPI entity = ghost.
getEntity();
111 if (entity ==
null || entity.getContainingLocation() ==
null ||
plugin ==
null)
return;
112 for (CampaignFleetAPI fleet : entity.getContainingLocation().getFleets()) {
117 if (!
plugin.containsEntity(fleet))
continue;
119 if (fleet.getMemoryWithoutUpdate().getBoolean(MemFlags.JUST_DID_INTERDICTION_PULSE)) {
121 if (fleet.isPlayerFleet()) {
122 String key =
"$leviathanCalvesPulsed";
131 CustomCampaignEntityAPI entity = ghost.
getEntity();
132 if (entity ==
null || entity.getContainingLocation() ==
null ||
plugin ==
null)
return;
133 for (CampaignFleetAPI fleet : entity.getContainingLocation().getFleets()) {
135 if (!
plugin.containsEntity(fleet))
continue;
137 AbilityPlugin asb = fleet.getAbility(Abilities.SENSOR_BURST);
138 if (asb.isInProgress()) {
139 float [] coords =
plugin.getLengthAndWidthFractionWithinStream(fleet.getLocation());
140 if (coords !=
null) {
static SectorAPI getSector()
void checkInterdictionPulses(SensorGhost ghost)
void checkSensorBursts(SensorGhost ghost, float amount)
void advance(float amount, SensorGhost ghost)
GBLeviathanCalfRun(float duration, SectorEntityToken from, float wobbleRate, float maxWobble, int maxBurn, boolean affectedByPulse)
static float PULSE_BURN_BONUS
static float SENSOR_BURST_TURN_RATE
static float PULSE_BURN_BONUS_DECAY
SlipstreamTerrainPlugin2 plugin
void setSlipstream(SlipstreamTerrainPlugin2 plugin)
CustomCampaignEntityAPI getEntity()
void moveTo(Vector2f dest, float maxBurn)