Starsector API
Loading...
Searching...
No Matches
DefensiveSystems.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.skills;
2
3import com.fs.starfarer.api.characters.ShipSkillEffect;
4import com.fs.starfarer.api.combat.MutableShipStatsAPI;
5import com.fs.starfarer.api.combat.ShipAPI.HullSize;
6import com.fs.starfarer.api.impl.campaign.ids.Stats;
7import com.fs.starfarer.api.impl.campaign.ids.Strings;
8
9public class DefensiveSystems {
10
11 public static final float FLUX_UPKEEP_REDUCTION = 25f;
12
13 public static final float SHIELD_DAMAGE_REDUCTION = 20f;
14 public static final float PHASE_COOLDOWN_REDUCTION = 25f;
15
16 public static final float FLUX_SHUNT_DISSIPATION = 10f;
17
18
19 public static class Level1 implements ShipSkillEffect {
20
21 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
22 stats.getShieldUpkeepMult().modifyMult(id, 1f - FLUX_UPKEEP_REDUCTION / 100f);
23 stats.getPhaseCloakUpkeepCostBonus().modifyMult(id, 1f - FLUX_UPKEEP_REDUCTION / 100f);
24 }
25
26 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
27 stats.getShieldUpkeepMult().unmodify(id);
28 stats.getPhaseCloakUpkeepCostBonus().unmodify(id);
29 }
30
31 public String getEffectDescription(float level) {
32 return "-" + (int)(FLUX_UPKEEP_REDUCTION) + "% flux generated by active shields and phase cloak";
33 }
34
35 public String getEffectPerLevelDescription() {
36 return null;
37 }
38
39 public ScopeDescription getScopeDescription() {
40 return ScopeDescription.PILOTED_SHIP;
41 }
42 }
43
44 public static class Level2A implements ShipSkillEffect {
45 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
46 stats.getShieldDamageTakenMult().modifyMult(id, 1f - SHIELD_DAMAGE_REDUCTION / 100f);
47 }
48
49 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
50 stats.getShieldDamageTakenMult().unmodify(id);
51 }
52
53 public String getEffectDescription(float level) {
54 return "-" + (int)(SHIELD_DAMAGE_REDUCTION) + "% damage taken by shields";
55 }
56
57 public String getEffectPerLevelDescription() {
58 return null;
59 }
60
61 public ScopeDescription getScopeDescription() {
62 return ScopeDescription.PILOTED_SHIP;
63 }
64 }
65
66 public static class Level2B implements ShipSkillEffect {
67 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
68 stats.getPhaseCloakCooldownBonus().modifyMult(id, 1f - PHASE_COOLDOWN_REDUCTION / 100f);
69 }
70
71 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
72 stats.getPhaseCloakCooldownBonus().unmodify(id);
73 }
74
75 public String getEffectDescription(float level) {
76 return "-" + (int)(PHASE_COOLDOWN_REDUCTION) + "% phase cloak cooldown";
77 }
78
79 public String getEffectPerLevelDescription() {
80 return null;
81 }
82
83 public ScopeDescription getScopeDescription() {
84 return ScopeDescription.PILOTED_SHIP;
85 }
86 }
87
88 public static class Level3A implements ShipSkillEffect {
89
90 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
91 stats.getHardFluxDissipationFraction().modifyFlat(id, FLUX_SHUNT_DISSIPATION / 100f);
92 }
93
94 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
95 stats.getHardFluxDissipationFraction().unmodify(id);
96 }
97
98 public String getEffectDescription(float level) {
99 return "" + (int)(FLUX_SHUNT_DISSIPATION) + "% hard flux dissipation while shields are active";
100 }
101
102 public String getEffectPerLevelDescription() {
103 return null;
104 }
105
106 public ScopeDescription getScopeDescription() {
107 return ScopeDescription.PILOTED_SHIP;
108 }
109 }
110
111 public static class Level3B implements ShipSkillEffect {
112
113 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
114 // 1f + 2 * (this stat), * 1.5 means 3x -> 4c
115 stats.getDynamic().getStat(Stats.PHASE_TIME_BONUS_MULT).modifyFlat(id, 0.5f);
116 }
117
118 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
119 stats.getDynamic().getStat(Stats.PHASE_TIME_BONUS_MULT).unmodify(id);
120 }
121
122 public String getEffectDescription(float level) {
123 return "Phase cloak time acceleration increased from 3" + Strings.X + " to 4" + Strings.X;
124 }
125
126 public String getEffectPerLevelDescription() {
127 return null;
128 }
129
130 public ScopeDescription getScopeDescription() {
131 return ScopeDescription.PILOTED_SHIP;
132 }
133 }
134
135}