Starsector API
Loading...
Searching...
No Matches
SystemsExpertise.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;
6
7public class SystemsExpertise {
8
9
10 //public static final float CHARGES_PERCENT = 100f;
11 public static float BONUS_CHARGES = 1f;
12 public static float REGEN_PERCENT = 50f;
13 public static float SYSTEM_COOLDOWN_REDUCTION_PERCENT = 33f;
14 public static float RANGE_PERCENT = 50f;
15
16 public static float PEAK_TIME_BONUS = 30f;
17 public static float OVERLOAD_REDUCTION = 25f;
18 public static float MALFUNCTION_CHANCE_MULT = 0.5f;
19
20 public static float ELITE_DAMAGE_REDUCTION = 10f;
21
22
23 public static class Level1 implements ShipSkillEffect {
24 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
25 //stats.getSystemUsesBonus().modifyPercent(id, CHARGES_PERCENT);
26 stats.getSystemUsesBonus().modifyFlat(id, BONUS_CHARGES);
27 }
28
29 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
30 stats.getSystemUsesBonus().unmodifyPercent(id);
31 }
32
33 public String getEffectDescription(float level) {
34 //return "If the ship's system has charges: +" + (int)(CHARGES_PERCENT) + "% charges";
35 return "If the ship's system has charges: +1 charge";
36 }
37
38 public String getEffectPerLevelDescription() {
39 return null;
40 }
41
42 public ScopeDescription getScopeDescription() {
43 return ScopeDescription.PILOTED_SHIP;
44 }
45 }
46
47 public static class Level2 implements ShipSkillEffect {
48 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
49 stats.getSystemRegenBonus().modifyPercent(id, REGEN_PERCENT);
50 }
51
52 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
53 stats.getSystemRegenBonus().unmodifyPercent(id);
54 }
55
56 public String getEffectDescription(float level) {
57 return "If the ship's system regenerates charges: +" + (int)(REGEN_PERCENT) + "% regeneration rate";
58 }
59
60 public String getEffectPerLevelDescription() {
61 return null;
62 }
63
64 public ScopeDescription getScopeDescription() {
65 return ScopeDescription.PILOTED_SHIP;
66 }
67 }
68
69 public static class Level3 implements ShipSkillEffect {
70 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
71 stats.getSystemRangeBonus().modifyPercent(id, RANGE_PERCENT);
72 }
73
74 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
75 stats.getSystemRangeBonus().unmodifyPercent(id);
76 }
77
78 public String getEffectDescription(float level) {
79 return "If the ship's system has range: +" + (int)(RANGE_PERCENT) + "% range";
80 }
81
82 public String getEffectPerLevelDescription() {
83 return null;
84 }
85
86 public ScopeDescription getScopeDescription() {
87 return ScopeDescription.PILOTED_SHIP;
88 }
89 }
90
91 public static class Level4 implements ShipSkillEffect {
92 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
93 stats.getSystemCooldownBonus().modifyMult(id, 1f - SYSTEM_COOLDOWN_REDUCTION_PERCENT / 100f);
94 }
95
96 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
97 stats.getSystemCooldownBonus().unmodify(id);
98 }
99
100 public String getEffectDescription(float level) {
101 return "If the ship's system has a cooldown: -" + (int)(SYSTEM_COOLDOWN_REDUCTION_PERCENT) + "% cooldown";
102 }
103
104 public String getEffectPerLevelDescription() {
105 return null;
106 }
107
108 public ScopeDescription getScopeDescription() {
109 return ScopeDescription.PILOTED_SHIP;
110 }
111 }
112
113
114 public static class Level5 implements ShipSkillEffect {
115 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
116 stats.getPeakCRDuration().modifyFlat(id, PEAK_TIME_BONUS);
117 }
118
119 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
120 stats.getPeakCRDuration().unmodifyFlat(id);
121 }
122
123 public String getEffectDescription(float level) {
124 return "+" + (int)(PEAK_TIME_BONUS) + " seconds peak operating time";
125 }
126
127 public String getEffectPerLevelDescription() {
128 return null;
129 }
130
131 public ScopeDescription getScopeDescription() {
132 return ScopeDescription.PILOTED_SHIP;
133 }
134 }
135
136 public static class Level6 implements ShipSkillEffect {
137
138 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
139 stats.getOverloadTimeMod().modifyMult(id, 1f - OVERLOAD_REDUCTION / 100f);
140 }
141
142 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
143 stats.getOverloadTimeMod().unmodify(id);
144 }
145
146 public String getEffectDescription(float level) {
147 return "-" + (int)(OVERLOAD_REDUCTION) + "% overload duration";
148 }
149
150 public String getEffectPerLevelDescription() {
151 return null;
152 }
153
154 public ScopeDescription getScopeDescription() {
155 return ScopeDescription.PILOTED_SHIP;
156 }
157 }
158
159 public static class Level7 implements ShipSkillEffect {
160 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
161 stats.getWeaponMalfunctionChance().modifyMult(id, MALFUNCTION_CHANCE_MULT);
162 stats.getEngineMalfunctionChance().modifyMult(id, MALFUNCTION_CHANCE_MULT);
163 }
164
165 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
166 stats.getWeaponMalfunctionChance().unmodifyMult(id);
167 stats.getEngineMalfunctionChance().unmodifyMult(id);
168 }
169
170 public String getEffectDescription(float level) {
171 String percent = "" + (int)Math.round((1f - MALFUNCTION_CHANCE_MULT) * 100f) + "%";
172 return "Chance of malfunctions when at low combat readiness reduced by " + percent;
173 }
174
175 public String getEffectPerLevelDescription() {
176 return null;
177 }
178
179 public ScopeDescription getScopeDescription() {
180 return ScopeDescription.PILOTED_SHIP;
181 }
182 }
183
184 public static class Level8 implements ShipSkillEffect {
185 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
186 stats.getArmorDamageTakenMult().modifyMult(id, 1f - ELITE_DAMAGE_REDUCTION / 100f);
187 stats.getHullDamageTakenMult().modifyMult(id, 1f - ELITE_DAMAGE_REDUCTION / 100f);
188 stats.getShieldDamageTakenMult().modifyMult(id, 1f - ELITE_DAMAGE_REDUCTION / 100f);
189 }
190
191 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
192 stats.getArmorDamageTakenMult().unmodifyMult(id);
193 stats.getHullDamageTakenMult().unmodifyMult(id);
194 stats.getShieldDamageTakenMult().unmodifyMult(id);
195 }
196
197 public String getEffectDescription(float level) {
198 String percent = "-" + (int)ELITE_DAMAGE_REDUCTION + "%";
199 return percent + " damage taken";
200 }
201
202 public String getEffectPerLevelDescription() {
203 return null;
204 }
205
206 public ScopeDescription getScopeDescription() {
207 return ScopeDescription.PILOTED_SHIP;
208 }
209 }
210
211
212}