Starsector API
Loading...
Searching...
No Matches
ReliabilityEngineering.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;
7
9
10 public static float PEAK_TIME_BONUS = 60;
11 public static float DEGRADE_REDUCTION_PERCENT = 25f;
12 public static float MAX_CR_BONUS = 15;
13
14 public static float OVERLOAD_REDUCTION = 30f;
15
16 public static class Level1 implements ShipSkillEffect {
17
18 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
19 stats.getDynamic().getMod(Stats.INDIVIDUAL_SHIP_RECOVERY_MOD).modifyFlat(id, 1000f);
20 }
21
22 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
23 stats.getDynamic().getMod(Stats.INDIVIDUAL_SHIP_RECOVERY_MOD).unmodify(id);
24 }
25
26 public String getEffectDescription(float level) {
27 return "If lost in combat, ship is almost always recoverable";
28 }
29
30 public String getEffectPerLevelDescription() {
31 return null;
32 }
33
34 public ScopeDescription getScopeDescription() {
35 return ScopeDescription.PILOTED_SHIP;
36 }
37 }
38
39 public static class Level2 implements ShipSkillEffect {
40 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
41 stats.getPeakCRDuration().modifyFlat(id, PEAK_TIME_BONUS);
42 }
43
44 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
45 stats.getPeakCRDuration().unmodifyFlat(id);
46 }
47
48 public String getEffectDescription(float level) {
49 return "+" + (int)(PEAK_TIME_BONUS) + " seconds peak operating time";
50 }
51
52 public String getEffectPerLevelDescription() {
53 return null;
54 }
55
56 public ScopeDescription getScopeDescription() {
57 return ScopeDescription.PILOTED_SHIP;
58 }
59 }
60
61 public static class Level3 implements ShipSkillEffect {
62 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
63 stats.getCRLossPerSecondPercent().modifyMult(id, 1f - DEGRADE_REDUCTION_PERCENT / 100f);
64 }
65
66 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
67 stats.getCRLossPerSecondPercent().unmodifyMult(id);
68 }
69
70 public String getEffectDescription(float level) {
71 return "-" + (int)(DEGRADE_REDUCTION_PERCENT) + "% combat readiness degradation rate after peak performance time runs out";
72 }
73
74 public String getEffectPerLevelDescription() {
75 return null;
76 }
77
78 public ScopeDescription getScopeDescription() {
79 return ScopeDescription.PILOTED_SHIP;
80 }
81 }
82
83 public static class Level4 implements ShipSkillEffect {
84
85 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
86 stats.getMaxCombatReadiness().modifyFlat(id, MAX_CR_BONUS * 0.01f, "Reliabilty Engineering skill");
87 }
88
89 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
90 stats.getMaxCombatReadiness().unmodify(id);
91 }
92
93 public String getEffectDescription(float level) {
94 return "+" + (int)(MAX_CR_BONUS) + "% maximum combat readiness";
95 }
96
97 public String getEffectPerLevelDescription() {
98 return null;
99 }
100
101 public ScopeDescription getScopeDescription() {
102 return ScopeDescription.PILOTED_SHIP;
103 }
104 }
105
106 public static class Level5 implements ShipSkillEffect {
107
108 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
109 stats.getOverloadTimeMod().modifyMult(id, 1f - OVERLOAD_REDUCTION / 100f);
110 }
111
112 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
113 stats.getOverloadTimeMod().unmodify(id);
114 }
115
116 public String getEffectDescription(float level) {
117 return "-" + (int)(OVERLOAD_REDUCTION) + "% overload duration";
118 }
119
120 public String getEffectPerLevelDescription() {
121 return null;
122 }
123
124 public ScopeDescription getScopeDescription() {
125 return ScopeDescription.PILOTED_SHIP;
126 }
127 }
128
129
130
131// public static class Level2 implements ShipSkillEffect {
132// public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
133// stats.getCriticalMalfunctionChance().modifyMult(id, 1f - CRITICAL_MALFUNCTION_REDUCTION / 100f);
134// stats.getWeaponMalfunctionChance().modifyMult(id, 1f - MALFUNCTION_REDUCTION / 100f);
135// stats.getEngineMalfunctionChance().modifyMult(id, 1f - MALFUNCTION_REDUCTION / 100f);
136// }
137//
138// public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
139// stats.getCriticalMalfunctionChance().unmodify(id);
140// stats.getWeaponMalfunctionChance().unmodify(id);
141// stats.getEngineMalfunctionChance().unmodify(id);
142// }
143//
144// public String getEffectDescription(float level) {
145// //return "" + (int)(RECOVERY_RATE_BONUS) + "% faster repairs and CR recovery";
146// //return "-" + (int)(CRITICAL_MALFUNCTION_REDUCTION) + "% chance of critical malfunctions when at low combat readiness";
147// return "-" + (int)(CRITICAL_MALFUNCTION_REDUCTION) + "% chance of malfunctions when at low combat readiness";
148// }
149//
150// public String getEffectPerLevelDescription() {
151// return null;
152// }
153//
154// public ScopeDescription getScopeDescription() {
155// return ScopeDescription.PILOTED_SHIP;
156// }
157// }
158
159
160
161
162}