53 if (fleet ==
null)
return;
55 if (fleet.isInHyperspaceTransition())
return;
59 if (
well ==
null ||
well.getTarget() ==
null)
return;
65 fleet.getContainingLocation() instanceof StarSystemAPI) {
85 if (fleet ==
null)
return;
87 if (
level > 0 && level < 1 && amount > 0) {
89 float speed = fleet.getVelocity().length();
90 float acc = Math.max(speed, 200f)/activateSeconds + fleet.getAcceleration();
91 float ds = acc * amount;
92 if (ds > speed) ds = speed;
93 Vector2f dv = Misc.getUnitVectorAtDegreeAngle(Misc.getAngleInDegrees(fleet.getVelocity()));
95 fleet.setVelocity(fleet.getVelocity().x - dv.x, fleet.getVelocity().y - dv.y);
100 float dist = Float.MAX_VALUE;
102 dist = Misc.getDistance(fleet,
well) -
well.getRadius() - fleet.getRadius();
105 SectorEntityToken planet =
well.getTarget();
106 Vector2f loc = Misc.getPointAtRadius(planet.getLocation(), planet.getRadius() + 200f + fleet.getRadius());
107 SectorEntityToken token = planet.getContainingLocation().createToken(loc.x, loc.y);
109 JumpDestination dest =
new JumpDestination(token,
null);
112 fleet.getContainingLocation() instanceof StarSystemAPI) {
114 if (crCostFleetMult > 0) {
117 Misc.applyDamage(member,
null, FleetMemberDamageLevel.LOW,
false,
null,
null,
118 true,
null, member.getShipName() +
" suffers damage from Transverse Jump activation");
121 for (FleetMemberAPI member : fleet.getFleetData().getMembersListCopy()) {
122 float crLoss = member.getDeployCost() *
CR_COST_MULT * crCostFleetMult;
123 member.getRepairTracker().applyCREvent(-crLoss,
"Transverse jump");
125 String key =
"$makeTranverseJumpCostMoreCROnce";
126 fleet.getMemoryWithoutUpdate().unset(key);
130 fleet.getCargo().removeFuel(cost);
133 StarSystemAPI system = (StarSystemAPI) fleet.getContainingLocation();
135 Vector2f offset = Vector2f.sub(fleet.getLocation(), system.getCenter().getLocation(),
new Vector2f());
136 float maxInSystem = 20000f;
137 float maxInHyper = 2000f;
138 float f = offset.length() / maxInSystem;
140 if (f > 0.5f) f = 0.5f;
142 float angle = Misc.getAngleInDegreesStrict(offset);
144 Vector2f destOffset = Misc.getUnitVectorAtDegreeAngle(angle);
145 destOffset.scale(f * maxInHyper);
147 Vector2f.add(system.getLocation(), destOffset, destOffset);
148 SectorEntityToken token =
Global.
getSector().getHyperspace().createToken(destOffset.x, destOffset.y);
150 JumpDestination dest =
new JumpDestination(token,
null);
203 CampaignFleetAPI fleet =
getFleet();
204 if (fleet ==
null)
return null;
205 if (!fleet.isInHyperspace())
return null;
207 float minDist = Float.MAX_VALUE;
208 NascentGravityWellAPI closest =
null;
209 List<Object> wells = fleet.getContainingLocation().getEntities(NascentGravityWellAPI.class);
210 for (Object o : wells) {
211 NascentGravityWellAPI
well = (NascentGravityWellAPI) o;
212 float dist = Misc.getDistance(
well.getLocation(), fleet.getLocation());
213 dist -=
well.getRadius() + fleet.getRadius();
214 if (dist > maxDist)
continue;
215 if (dist < minDist) {
226 CampaignFleetAPI fleet =
getFleet();
227 if (fleet ==
null)
return;
229 Color gray = Misc.getGrayColor();
230 Color highlight = Misc.getHighlightColor();
232 Color bad = Misc.getNegativeHighlightColor();
234 LabelAPI title = tooltip.addTitle(
"Transverse Jump");
240 tooltip.addPara(
"Jump into hyperspace without the use of a jump-point, or " +
241 "jump into a star system across the hyperspace boundary near a nascent gravity well, " +
242 "emerging near the entity corresponding to the gravity well.", pad);
247 if (supplyCost > 0) {
248 tooltip.addPara(
"Jumping into hyperspace consumes %s fuel and slightly reduces the combat readiness" +
249 " of all ships, costing up to %s supplies to recover. Jumping into a star system is free.", pad,
251 Misc.getRoundedValueMaxOneAfterDecimal(fuelCost),
252 Misc.getRoundedValueMaxOneAfterDecimal(supplyCost));
254 tooltip.addPara(
"Jumping into hyperspace consumes %s fuel. Jumping into a star system is free.", pad,
256 Misc.getRoundedValueMaxOneAfterDecimal(fuelCost));
260 if (TutorialMissionIntel.isTutorialInProgress()) {
261 tooltip.addPara(
"Can not be used right now.", bad, pad);
264 if (!fleet.isInHyperspace()) {
265 if (fuelCost > fleet.getCargo().getFuel()) {
266 tooltip.addPara(
"Not enough fuel.", bad, pad);
270 if (!nonReady.isEmpty()) {
272 tooltip.addPara(
"Some ships don't have enough combat readiness to safely initiate a transverse jump " +
273 "and may suffer damage if the ability is activated:", pad,
274 Misc.getNegativeHighlightColor(),
"may suffer damage");
278 for (FleetMemberAPI member : nonReady) {
280 if (nonReady.size() > max + 1) {
281 tooltip.addPara(BaseIntelPlugin.INDENT +
"... and several other ships", initPad);
286 if (!member.isFighterWing()) {
287 str += member.getShipName() +
", ";
288 str += member.getHullSpec().getHullNameWithDashClass();
290 str += member.getVariant().getFullDesignationWithHullName();
293 tooltip.addPara(BaseIntelPlugin.INDENT + str, initPad);
328 if (fleet.isInHyperspace()) {
330 tooltip.addPara(
"Must be near a nascent gravity well.", bad, pad);
355 List<FleetMemberAPI> result =
new ArrayList<FleetMemberAPI>();
356 CampaignFleetAPI fleet =
getFleet();
357 if (fleet ==
null)
return result;
362 for (FleetMemberAPI member : fleet.getFleetData().getMembersListCopy()) {
364 float crLoss = member.getDeployCost() *
CR_COST_MULT * crCostFleetMult;
365 if (Math.round(member.getRepairTracker().getCR() * 100) < Math.round(crLoss * 100)) {