Starsector API
Loading...
Searching...
No Matches
OrdnanceExpertise.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.skills;
2
3import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
4import com.fs.starfarer.api.characters.ShipSkillEffect;
5import com.fs.starfarer.api.combat.MutableShipStatsAPI;
6import com.fs.starfarer.api.combat.ShipAPI.HullSize;
7import com.fs.starfarer.api.util.Misc;
8
9public class OrdnanceExpertise {
10
11 public static float MAX_CR_BONUS = 15;
12 //public static float FLUX_PER_OP = 2;
13 public static float FLUX_PER_OP = 1.5f;
14 public static float CAP_PER_OP = 20;
15
16
17
18
19// public static class Level1 extends BaseSkillEffectDescription implements AfterShipCreationSkillEffect {
20// public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
21// ship.addListener(new RangedSpecDamageDealtMod());
22// }
23//
24// public void unapplyEffectsAfterShipCreation(ShipAPI ship, String id) {
25// ship.removeListenerOfClass(RangedSpecDamageDealtMod.class);
26// }
27//
28// public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
29//
30// }
31// public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {}
32//
33// public String getEffectDescription(float level) {
34// return null;
35// }
36//
37// public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
38// TooltipMakerAPI info, float width) {
39// init(stats, skill);
40//
41//
42//
43// if (CRITS) {
44// info.addPara("Ballistic and energy weapons have a chance to deal %s damage at long range",
45// 0f, hc, hc, "+" + (int) CRIT_DAMAGE_BONUS_PERCENT + "%");
46// info.addPara(indent + "%s chance at %s range and below, " +
47// "%s chance at %s range and above",
48// 0f, tc, hc,
49// "0%",
50// "" + (int) MIN_RANGE,
51// "" + (int) MAX_CHANCE_PERCENT + "%",
52// "" + (int) MAX_RANGE
53// );
54// } else {
55// info.addPara("Ballistic and energy weapons deal up to %s damage at long range",
56// 0f, hc, hc, "+" + (int) MAX_CHANCE_PERCENT + "%");
57// info.addPara(indent + "%s at %s range and below, " +
58// "%s at %s range and above",
59// 0f, tc, hc,
60// "0%",
61// "" + (int) MIN_RANGE,
62// "" + (int) MAX_CHANCE_PERCENT + "%",
63// "" + (int) MAX_RANGE
64// );
65// }
66// //info.addPara(indent + "Beam weapons have their damage increased by the chance percentage instead", tc, 0f);
67// }
68//
69// public ScopeDescription getScopeDescription() {
70// return ScopeDescription.PILOTED_SHIP;
71// }
72// }
73
74
75 public static class Level1 implements ShipSkillEffect {
76
77// public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
78// System.out.println("ewfwefwe");
79// }
80// public void unapplyEffectsAfterShipCreation(ShipAPI ship, String id) {
81// }
82
83 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
84 if (stats.getVariant() != null) {
85 MutableCharacterStatsAPI cStats = BaseSkillEffectDescription.getCommanderStats(stats);
86 float flux = FLUX_PER_OP * stats.getVariant().computeWeaponOPCost(cStats);
87 stats.getFluxDissipation().modifyFlat(id, flux);
88 }
89 }
90
91 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
92 stats.getFluxDissipation().unmodifyFlat(id);
93 }
94
95 public String getEffectDescription(float level) {
96 if ((int)FLUX_PER_OP != FLUX_PER_OP) {
97// if (FLUX_PER_OP == 1.5f) {
98// return "+3 flux dissipation per every 2 ordnance points spent on weapons";
99// }
100 return "+" + Misc.getRoundedValueMaxOneAfterDecimal(FLUX_PER_OP) + " flux dissipation per ordnance point spent on weapons";
101 }
102 return "+" + (int)(FLUX_PER_OP) + " flux dissipation per ordnance point spent on weapons";
103 }
104
105 public String getEffectPerLevelDescription() {
106 return null;
107 }
108
109 public ScopeDescription getScopeDescription() {
110 return ScopeDescription.PILOTED_SHIP;
111 }
112 }
113
114 public static class Level3 implements ShipSkillEffect {
115
116 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
117 if (stats.getVariant() != null) {
118 MutableCharacterStatsAPI cStats = BaseSkillEffectDescription.getCommanderStats(stats);
119 float flux = CAP_PER_OP * stats.getVariant().computeWeaponOPCost(cStats);
120 stats.getFluxCapacity().modifyFlat(id, flux);
121 }
122 }
123
124 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
125 stats.getFluxCapacity().unmodifyFlat(id);
126 }
127
128 public String getEffectDescription(float level) {
129 return "+" + (int)(CAP_PER_OP) + " flux capacity per ordnance point spent on weapons";
130 }
131
132 public String getEffectPerLevelDescription() {
133 return null;
134 }
135
136 public ScopeDescription getScopeDescription() {
137 return ScopeDescription.PILOTED_SHIP;
138 }
139 }
140
141 public static class Level2 implements ShipSkillEffect {
142
143 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
144 stats.getMaxCombatReadiness().modifyFlat(id, MAX_CR_BONUS * 0.01f, "Ordnance Expertise skill");
145 }
146
147 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
148 stats.getMaxCombatReadiness().unmodify(id);
149 }
150
151 public String getEffectDescription(float level) {
152 return "+" + (int)(MAX_CR_BONUS) + "% maximum combat readiness";
153 }
154
155 public String getEffectPerLevelDescription() {
156 return null;
157 }
158
159 public ScopeDescription getScopeDescription() {
160 return ScopeDescription.PILOTED_SHIP;
161 }
162 }
163
164}
165
166
167
168
169
170
171
172
173
174
175
static MutableCharacterStatsAPI getCommanderStats(MutableShipStatsAPI stats)