Starsector API
Loading...
Searching...
No Matches
DamperFieldOmegaStats.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
11
12 public static Object KEY_SHIP = new Object();
13 public static float INCOMING_DAMAGE_MULT = 0.5f;
14 public static float FLUX_USE_MULT = 0.5f;
15 public static float REPAIR_RATE_MULT = 10f;
16
17 public static class TargetData {
18 public ShipAPI target;
19 public TargetData(ShipAPI target) {
20 this.target = target;
21 }
22 }
23
24
25 public void apply(MutableShipStatsAPI stats, final String id, State state, float effectLevel) {
26 ShipAPI ship = null;
27 if (stats.getEntity() instanceof ShipAPI) {
28 ship = (ShipAPI) stats.getEntity();
29 } else {
30 return;
31 }
32
33 ship.fadeToColor(KEY_SHIP, new Color(75,75,75,255), 0.1f, 0.1f, effectLevel);
34 //ship.fadeToColor(KEY_SHIP, new Color(100,100,100,255), 0.1f, 0.1f, effectLevel);
35 ship.setWeaponGlow(effectLevel, new Color(100,165,255,255), EnumSet.of(WeaponType.BALLISTIC, WeaponType.ENERGY, WeaponType.MISSILE));
36 ship.getEngineController().fadeToOtherColor(KEY_SHIP, new Color(0,0,0,0), new Color(0,0,0,0), effectLevel, 0.75f * effectLevel);
37 //ship.setJitter(KEY_SHIP, new Color(100,165,255,55), effectLevel, 1, 0f, 5f);
38 ship.setJitterUnder(KEY_SHIP, new Color(100,165,255,255), effectLevel, 15, 0f, 15f);
39 //ship.setShowModuleJitterUnder(true);
40
41 effectLevel = 1f;
42 stats.getBallisticWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel);
43 stats.getEnergyWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel);
44 stats.getMissileWeaponFluxCostMod().modifyMult(id, 1f - (1f - FLUX_USE_MULT) * effectLevel);
45
46 stats.getHullDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel);
47 stats.getArmorDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel);
48 stats.getEmpDamageTakenMult().modifyMult(id, 1f - (1f - INCOMING_DAMAGE_MULT) * effectLevel);
49
50 stats.getCombatEngineRepairTimeMult().modifyMult(id, 1f / (1f + (REPAIR_RATE_MULT - 1f) * effectLevel));
51 stats.getCombatWeaponRepairTimeMult().modifyMult(id, 1f / (1f + (REPAIR_RATE_MULT - 1f) * effectLevel));
52 }
53
54
55 public void unapply(MutableShipStatsAPI stats, String id) {
56 stats.getBallisticWeaponFluxCostMod().unmodify(id);
57 stats.getEnergyWeaponFluxCostMod().unmodify(id);
58 stats.getMissileWeaponFluxCostMod().unmodify(id);
59
60 stats.getHullDamageTakenMult().unmodify(id);
61 stats.getArmorDamageTakenMult().unmodify(id);
62 stats.getEmpDamageTakenMult().unmodify(id);
63
64 stats.getCombatEngineRepairTimeMult().unmodifyMult(id);
65 stats.getCombatWeaponRepairTimeMult().unmodifyMult(id);
66 }
67
68
69 public StatusData getStatusData(int index, State state, float effectLevel) {
70 effectLevel = 1f;
71 float percent = (1f - FLUX_USE_MULT) * effectLevel * 100;
72 if (index == 0) {
73 return new StatusData((int) percent + "% less flux generated", false);
74 }
75 percent = (1f - INCOMING_DAMAGE_MULT) * effectLevel * 100;
76 if (index == 1) {
77 return new StatusData((int) percent + "% less damage taken", false);
78 }
79
80 percent = REPAIR_RATE_MULT * effectLevel * 100f;
81 if (index == 2) {
82 return new StatusData((int) percent + "% faster repairs", false);
83 }
84 return null;
85 }
86
87}
88
89
90
void unapply(MutableShipStatsAPI stats, String id)
StatusData getStatusData(int index, State state, float effectLevel)
void apply(MutableShipStatsAPI stats, final String id, State state, float effectLevel)