Starsector API
Loading...
Searching...
No Matches
PlasmaJetsStats.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.combat;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.combat.MutableShipStatsAPI;
6import com.fs.starfarer.api.combat.ShipAPI;
7import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
8
10
11 public static float SPEED_BONUS = 125f;
12 public static float TURN_BONUS = 20f;
13
14 private Color color = new Color(100,255,100,255);
15
16// private Color [] colors = new Color[] {
17// new Color(140, 100, 235),
18// new Color(180, 110, 210),
19// new Color(150, 140, 190),
20// new Color(140, 190, 210),
21// new Color(90, 200, 170),
22// new Color(65, 230, 160),
23// new Color(20, 220, 70)
24// };
25
26 public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
27 if (state == ShipSystemStatsScript.State.OUT) {
28 stats.getMaxSpeed().unmodify(id); // to slow down ship to its regular top speed while powering drive down
29 stats.getMaxTurnRate().unmodify(id);
30 } else {
31 stats.getMaxSpeed().modifyFlat(id, SPEED_BONUS);
32 stats.getAcceleration().modifyPercent(id, SPEED_BONUS * 3f * effectLevel);
33 stats.getDeceleration().modifyPercent(id, SPEED_BONUS * 3f * effectLevel);
34 stats.getTurnAcceleration().modifyFlat(id, TURN_BONUS * effectLevel);
35 stats.getTurnAcceleration().modifyPercent(id, TURN_BONUS * 5f * effectLevel);
36 stats.getMaxTurnRate().modifyFlat(id, 15f);
37 stats.getMaxTurnRate().modifyPercent(id, 100f);
38 }
39
40 if (stats.getEntity() instanceof ShipAPI) {
41 ShipAPI ship = (ShipAPI) stats.getEntity();
42
43 ship.getEngineController().fadeToOtherColor(this, color, new Color(0,0,0,0), effectLevel, 0.67f);
44 //ship.getEngineController().fadeToOtherColor(this, Color.white, new Color(0,0,0,0), effectLevel, 0.67f);
45 ship.getEngineController().extendFlame(this, 2f * effectLevel, 0f * effectLevel, 0f * effectLevel);
46
47// String key = ship.getId() + "_" + id;
48// Object test = Global.getCombatEngine().getCustomData().get(key);
49// if (state == State.IN) {
50// if (test == null && effectLevel > 0.2f) {
51// Global.getCombatEngine().getCustomData().put(key, new Object());
52// ship.getEngineController().getExtendLengthFraction().advance(1f);
53// for (ShipEngineAPI engine : ship.getEngineController().getShipEngines()) {
54// if (engine.isSystemActivated()) {
55// ship.getEngineController().setFlameLevel(engine.getEngineSlot(), 1f);
56// }
57// }
58// }
59// } else {
60// Global.getCombatEngine().getCustomData().remove(key);
61// }
62 }
63 }
64 public void unapply(MutableShipStatsAPI stats, String id) {
65 stats.getMaxSpeed().unmodify(id);
66 stats.getMaxTurnRate().unmodify(id);
67 stats.getTurnAcceleration().unmodify(id);
68 stats.getAcceleration().unmodify(id);
69 stats.getDeceleration().unmodify(id);
70 }
71
72 public StatusData getStatusData(int index, State state, float effectLevel) {
73 if (index == 0) {
74 return new StatusData("improved maneuverability", false);
75 } else if (index == 1) {
76 return new StatusData("+" + (int)SPEED_BONUS + " top speed", false);
77 }
78 return null;
79 }
80}
void unapply(MutableShipStatsAPI stats, String id)
StatusData getStatusData(int index, State state, float effectLevel)
void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel)