34 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
37 stats.getFuelUseMod().modifyMult(
id, useMult);
40 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
42 stats.getFuelUseMod().unmodifyMult(
id);
45 public String getEffectDescription(
float level) {
49 protected float getFuelUseBase(String
id, FleetDataAPI data) {
50 if (data ==
null)
return 0f;
53 for (FleetMemberAPI curr : data.getMembersListCopy()) {
54 StatBonus stat = curr.getStats().getFuelUseMod();
55 StatMod mod = stat.getMultBonus(
id);
57 stat.unmodifyMult(mod.source);
59 fuelUse += curr.getFuelUse();
61 stat.modifyMult(mod.source, mod.value, mod.desc);
67 protected float getFuelUseMult(String
id, FleetDataAPI data) {
68 if (data ==
null)
return 0f;
71 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
72 if (bonus !=
null)
return bonus;
74 float fuelUse = getFuelUseBase(
id, data);
81 useMult = 1f - maxReduced / fuelUse;
82 useMult = Math.round(useMult * 100f) / 100f;
85 data.getCacheClearedOnSync().put(key, useMult);
89 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
90 TooltipMakerAPI info,
float width) {
93 info.addPara(
"Reduces fuel consumption by %s or %s units, whichever is lower",
100 FleetDataAPI data =
Global.
getSector().getPlayerFleet().getFleetData();
102 float fuelUse = getFuelUseBase(
id, data);
103 float useMult = getFuelUseMult(
id, data);
105 float reduction = fuelUse * (1f - useMult);
107 boolean has = stats.getSkillLevel(skill.getId()) > 0;
109 if (!has) is =
"would be";
110 info.addPara(
indent +
"Your fleet has a base fuel consumption of %s, which " + is +
" reduced by %s, or %s units",
112 "" + Misc.getRoundedValueMaxOneAfterDecimal(fuelUse),
113 "" + (int)(Math.round((1f - useMult) * 100f)) +
"%",
114 "" + Misc.getRoundedValueMaxOneAfterDecimal(reduction)
120 public ScopeDescription getScopeDescription() {
121 return ScopeDescription.FLEET;
126 public static class Level1
implements CharacterStatsSkillEffect {
127 public void apply(MutableCharacterStatsAPI stats, String
id,
float level) {
128 stats.getDynamic().getStat(Stats.NAVIGATION_PENALTY_MULT).modifyFlat(
id,
132 public void unapply(MutableCharacterStatsAPI stats, String
id) {
133 stats.getDynamic().getStat(Stats.NAVIGATION_PENALTY_MULT).unmodify(
id);
136 public String getEffectDescription(
float level) {
140 public String getEffectPerLevelDescription() {
144 public ScopeDescription getScopeDescription() {
145 return ScopeDescription.FLEET;
149 public static class Level1B
implements FleetStatsSkillEffect {
150 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
151 stats.getDynamic().getMod(Stats.CAN_SEE_NASCENT_POINTS).modifyFlat(
id, 1);
154 public void unapply(MutableFleetStatsAPI stats, String
id) {
155 stats.getDynamic().getMod(Stats.CAN_SEE_NASCENT_POINTS).unmodify(
id);
158 public String getEffectDescription(
float level) {
159 return "Can detect nascent gravity wells in hyperspace around star systems";
162 public String getEffectPerLevelDescription() {
166 public ScopeDescription getScopeDescription() {
167 return ScopeDescription.FLEET;
217 public static class Level2
implements ShipSkillEffect {
218 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
222 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
223 stats.getFuelUseMod().unmodify(
id);
226 public String getEffectDescription(
float level) {
230 public String getEffectPerLevelDescription() {
234 public ScopeDescription getScopeDescription() {
235 return ScopeDescription.ALL_SHIPS;
240 public static class Level3A
implements FleetStatsSkillEffect {
241 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
242 stats.getFleetwideMaxBurnMod().modifyFlat(
id,
FLEET_BURN_BONUS,
"Navigation");
245 public void unapply(MutableFleetStatsAPI stats, String
id) {
246 stats.getFleetwideMaxBurnMod().unmodifyFlat(
id);
249 public String getEffectDescription(
float level) {
253 public String getEffectPerLevelDescription() {
257 public ScopeDescription getScopeDescription() {
258 return ScopeDescription.FLEET;
262 public static class Level3B
implements FleetStatsSkillEffect {
263 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
264 stats.getDynamic().getMod(Stats.SUSTAINED_BURN_BONUS).modifyFlat(
id,
SB_BURN_BONUS);
267 public void unapply(MutableFleetStatsAPI stats, String
id) {
268 stats.getDynamic().getMod(Stats.SUSTAINED_BURN_BONUS).unmodifyFlat(
id);
271 public String getEffectDescription(
float level) {
272 return "Increases the burn bonus of the \"Sustained Burn\" ability by " + (int)
SB_BURN_BONUS;
275 public String getEffectPerLevelDescription() {
279 public ScopeDescription getScopeDescription() {
280 return ScopeDescription.FLEET;