Starsector API
Loading...
Searching...
No Matches
CryofluxTransducerStats.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.combat;
2
3import java.awt.Color;
4import java.util.EnumSet;
5
6import com.fs.starfarer.api.combat.MutableShipStatsAPI;
7import com.fs.starfarer.api.combat.ShipAPI;
8import com.fs.starfarer.api.combat.WeaponAPI.WeaponType;
9
14 public static final Object KEY_SHIP = new Object();
15 public static final Color DEFAULT_JITTER_COLOR = new Color(100,165,255,75);
16 public static final float INCOMING_DAMAGE_MULT = 0.5f;
17 public static final float FLUX_USE_MULT = 0.5f;
18
19 public static class TargetData {
20 public ShipAPI target;
21 public TargetData(ShipAPI target) {
22 this.target = target;
23 }
24 }
25
26
27 public void apply(MutableShipStatsAPI stats, final String id, State state, float effectLevel) {
28 ShipAPI ship = null;
29 if (stats.getEntity() instanceof ShipAPI) {
30 ship = (ShipAPI) stats.getEntity();
31 } else {
32 return;
33 }
34
35 ship.fadeToColor(KEY_SHIP, new Color(75,75,75,255), 0.1f, 0.1f, effectLevel);
36 //ship.fadeToColor(KEY_SHIP, new Color(100,100,100,255), 0.1f, 0.1f, effectLevel);
37 ship.setWeaponGlow(effectLevel, new Color(100,165,255,255), EnumSet.of(WeaponType.BALLISTIC, WeaponType.ENERGY, WeaponType.MISSILE));
38 ship.getEngineController().fadeToOtherColor(KEY_SHIP, new Color(0,0,0,0), new Color(0,0,0,0), effectLevel, 0.75f * effectLevel);
39 //ship.setJitter(KEY_SHIP, new Color(100,165,255,55), effectLevel, 1, 0f, 5f);
40 ship.setJitterUnder(KEY_SHIP, new Color(100,165,255,255), effectLevel, 15, 0f, 15f);
41 //ship.setShowModuleJitterUnder(true);
42
43 effectLevel = 1f;
44 stats.getBallisticWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel);
45 stats.getEnergyWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel);
46 stats.getMissileWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel);
47
48 stats.getHullDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel);
49 stats.getArmorDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel);
50 stats.getEmpDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel);
51 }
52
53
54 public void unapply(MutableShipStatsAPI stats, String id) {
58
62 }
63
64 public StatusData getStatusData(int index, State state, float effectLevel) {
65 effectLevel = 1f;
66 float percent = (1f - FLUX_USE_MULT) * effectLevel * 100;
67 if (index == 0) {
68 return new StatusData((int) percent + "% less flux generated", false);
69 }
70 percent = (1f - INCOMING_DAMAGE_MULT) * effectLevel * 100;
71 if (index == 1) {
72 return new StatusData((int) percent + "% less damage taken", false);
73 }
74 return null;
75 }
76
77}
78
79
80
81
82
83
84
85
void modifyMult(String source, float value)
void modifyMult(String source, float value)
void apply(MutableShipStatsAPI stats, final String id, State state, float effectLevel)
StatusData getStatusData(int index, State state, float effectLevel)
void fadeToColor(Object source, Color color, float durIn, float durOut, float maxShift)
void setJitterUnder(Object source, Color color, float intensity, int copies, float range)
void setWeaponGlow(float glow, Color color, EnumSet< WeaponType > types)
ShipEngineControllerAPI getEngineController()
void fadeToOtherColor(Object key, Color other, Color contrailColor, float effectLevel, float maxBlend)