Starsector API
Loading...
Searching...
No Matches
FleetLogistics.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.skills;
2
3import com.fs.starfarer.api.campaign.econ.MarketAPI;
4import com.fs.starfarer.api.characters.FleetStatsSkillEffect;
5import com.fs.starfarer.api.characters.MarketSkillEffect;
6import com.fs.starfarer.api.characters.ShipSkillEffect;
7import com.fs.starfarer.api.combat.MutableShipStatsAPI;
8import com.fs.starfarer.api.combat.ShipAPI.HullSize;
9import com.fs.starfarer.api.fleet.MutableFleetStatsAPI;
10import com.fs.starfarer.api.impl.campaign.ids.Stats;
11
12public class FleetLogistics {
13
14 public static final float ACCESS_1 = 0.15f;
15 public static final float ACCESS_2 = 0.15f;
16 public static final float FLEET_SIZE = 25f;
17
18 public static final float REPAIR_RATE_INCREASE = 25f;
19
20 public static final float OFFICER_SHIP_RECOVERY_MOD = 1000f;
21 public static final float MAINTENANCE_COST_REDUCTION = 25f;
22 public static final float MAX_CR_BONUS = 15f;
23
24
25
26 public static class Level1 implements ShipSkillEffect {
27
28 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
29 stats.getRepairRatePercentPerDay().modifyPercent(id, REPAIR_RATE_INCREASE);
30 }
31
32 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
33 stats.getRepairRatePercentPerDay().unmodify(id);
34 }
35
36 public String getEffectDescription(float level) {
37 return "" + (int)(REPAIR_RATE_INCREASE) + "% faster repair rate";
38 }
39
40 public String getEffectPerLevelDescription() {
41 return null;
42 }
43
44 public ScopeDescription getScopeDescription() {
45 return ScopeDescription.ALL_SHIPS;
46 }
47 }
48
49 public static class Level1B implements FleetStatsSkillEffect {
50 public void apply(MutableFleetStatsAPI stats, String id, float level) {
51 stats.getDynamic().getMod(Stats.OFFICER_SHIP_RECOVERY_MOD).modifyFlat(id, OFFICER_SHIP_RECOVERY_MOD * 0.01f);
52 }
53
54 public void unapply(MutableFleetStatsAPI stats, String id) {
55 stats.getDynamic().getMod(Stats.OFFICER_SHIP_RECOVERY_MOD).unmodify(id);
56 }
57
58 public String getEffectDescription(float level) {
59 return "Flagship and ships with an officer in command nearly guaranteed to be recoverable if lost";
60 }
61
62 public String getEffectPerLevelDescription() {
63 return null;
64 }
65
66 public ScopeDescription getScopeDescription() {
67 return ScopeDescription.FLEET;
68 }
69 }
70
71 public static class Level2 implements ShipSkillEffect {
72 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
73 stats.getSuppliesPerMonth().modifyMult(id, 1f - MAINTENANCE_COST_REDUCTION/100f, "Fleet logistics skill");
74 }
75
76 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
77 stats.getSuppliesPerMonth().unmodify(id);
78 }
79
80 public String getEffectDescription(float level) {
81 return "-" + (int) (MAINTENANCE_COST_REDUCTION) + "% supply use for maintenance";
82 }
83
84 public String getEffectPerLevelDescription() {
85 return null;
86 }
87
88 public ScopeDescription getScopeDescription() {
89 return ScopeDescription.ALL_SHIPS;
90 }
91 }
92
93 public static class Level3 implements ShipSkillEffect {
94
95 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
96 stats.getMaxCombatReadiness().modifyFlat(id, MAX_CR_BONUS * 0.01f, "Fleet logistics skill");
97 }
98
99 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
100 stats.getMaxCombatReadiness().unmodify(id);
101 }
102
103 public String getEffectDescription(float level) {
104 return "+" + (int)(MAX_CR_BONUS) + "% maximum combat readiness";
105 }
106
107 public String getEffectPerLevelDescription() {
108 return null;
109 }
110
111 public ScopeDescription getScopeDescription() {
112 return ScopeDescription.ALL_SHIPS;
113 }
114 }
115
116
117 public static class Market1 implements MarketSkillEffect {
118 public void apply(MarketAPI market, String id, float level) {
119 if (level <= 1) {
120 market.getAccessibilityMod().modifyFlat(id, ACCESS_1, "Fleet logistics");
121 } else if (level >= 2) {
122 market.getAccessibilityMod().modifyFlat(id, ACCESS_1 + ACCESS_2, "Fleet logistics");
123 }
124 }
125
126 public void unapply(MarketAPI market, String id) {
127 market.getAccessibilityMod().unmodifyFlat(id);
128 }
129
130 public String getEffectDescription(float level) {
131 return "+" + (int)Math.round(ACCESS_1 * 100f) + "% accessibility";
132 }
133
134 public String getEffectPerLevelDescription() {
135 return null;
136 }
137
138 public ScopeDescription getScopeDescription() {
139 return ScopeDescription.GOVERNED_OUTPOST;
140 }
141 }
142
143 public static class Market2 implements MarketSkillEffect {
144 public void apply(MarketAPI market, String id, float level) {
145 //market.getAccessibilityMod().modifyFlat(id, ACCESS_2, "Fleet logistics");
146 }
147
148 public void unapply(MarketAPI market, String id) {
149 //market.getAccessibilityMod().unmodifyFlat(id);
150 }
151
152 public String getEffectDescription(float level) {
153 return "+" + (int)Math.round(ACCESS_2 * 100f) + "% accessibility";
154 }
155
156 public String getEffectPerLevelDescription() {
157 return null;
158 }
159
160 public ScopeDescription getScopeDescription() {
161 return ScopeDescription.GOVERNED_OUTPOST;
162 }
163 }
164 public static class Market3 implements MarketSkillEffect {
165 public void apply(MarketAPI market, String id, float level) {
166 market.getStats().getDynamic().getMod(Stats.COMBAT_FLEET_SIZE_MULT).modifyFlat(id, FLEET_SIZE / 100f, "Fleet logistics");
167 }
168
169 public void unapply(MarketAPI market, String id) {
170 market.getStats().getDynamic().getMod(Stats.COMBAT_FLEET_SIZE_MULT).unmodifyFlat(id);
171 }
172
173 public String getEffectDescription(float level) {
174 return "" + (int)Math.round(FLEET_SIZE) + "% larger fleets";
175 }
176
177 public String getEffectPerLevelDescription() {
178 return null;
179 }
180
181 public ScopeDescription getScopeDescription() {
182 return ScopeDescription.GOVERNED_OUTPOST;
183 }
184 }
185}