38 public FleetTotalItem getFleetTotalItem() {
42 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
44 stats.getCrewLossMult().modifyMult(
id, 1f - (lossPercent * 0.01f));
47 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
48 stats.getCrewLossMult().unmodify(
id);
51 public String getEffectDescription(
float level) {
55 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
56 TooltipMakerAPI info,
float width) {
63 info.addPara(
"-%s crew lost due to hull damage in combat (maximum: %s)", 0f,
hc,
hc,
64 "" + (
int) damBonus +
"%",
70 public ScopeDescription getScopeDescription() {
71 return ScopeDescription.ALL_SHIPS;
75 public static class Level2
implements FleetStatsSkillEffect {
76 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
77 stats.getDynamic().getStat(Stats.EMERGENCY_BURN_CR_MULT).modifyMult(
id, 0f);
80 public void unapply(MutableFleetStatsAPI stats, String
id) {
81 stats.getDynamic().getStat(Stats.EMERGENCY_BURN_CR_MULT).unmodify(
id);
84 public String getEffectDescription(
float level) {
85 return "The \"Emergency Burn\" ability no longer reduces combat readiness";
88 public String getEffectPerLevelDescription() {
92 public ScopeDescription getScopeDescription() {
93 return ScopeDescription.FLEET;
97 public static class Level3
implements FleetStatsSkillEffect {
98 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
99 stats.getDynamic().getStat(Stats.FUEL_SALVAGE_VALUE_MULT_FLEET).modifyFlat(
id,
FUEL_SALVAGE_BONUS * 0.01f);
102 public void unapply(MutableFleetStatsAPI stats, String
id) {
103 stats.getDynamic().getStat(Stats.FUEL_SALVAGE_VALUE_MULT_FLEET).unmodify(
id);
106 public String getEffectDescription(
float level) {
109 return "+" + (int) max +
"% fuel salvaged";
112 public String getEffectPerLevelDescription() {
116 public ScopeDescription getScopeDescription() {
117 return ScopeDescription.FLEET;
123 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
125 float useMult = getFuelUseMult(
id,
getFleetData(stats));
126 stats.getFuelUseMod().modifyMult(
id, useMult);
129 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
131 stats.getFuelUseMod().unmodifyMult(
id);
134 public String getEffectDescription(
float level) {
138 protected float getFuelUseBase(String
id, FleetDataAPI data) {
139 if (data ==
null)
return 0f;
142 for (FleetMemberAPI curr : data.getMembersListCopy()) {
143 StatBonus stat = curr.getStats().getFuelUseMod();
144 StatMod mod = stat.getMultBonus(
id);
146 stat.unmodifyMult(mod.source);
148 fuelUse += curr.getFuelUse();
150 stat.modifyMult(mod.source, mod.value, mod.desc);
156 protected float getFuelUseMult(String
id, FleetDataAPI data) {
157 if (data ==
null)
return 0f;
159 String key =
"conproc1";
160 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
161 if (bonus !=
null)
return bonus;
163 float fuelUse = getFuelUseBase(
id, data);
170 useMult = 1f - maxReduced / fuelUse;
174 data.getCacheClearedOnSync().put(key, useMult);
178 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
179 TooltipMakerAPI info,
float width) {
185 info.addPara(
"Reduces fuel consumption by %s or %s units, whichever is lower",
192 FleetDataAPI data =
Global.
getSector().getPlayerFleet().getFleetData();
194 float fuelUse = getFuelUseBase(
id, data);
195 float useMult = getFuelUseMult(
id, data);
197 float reduction = fuelUse * (1f - useMult);
199 boolean has = stats.getSkillLevel(skill.getId()) > 0;
201 if (!has) is =
"would be";
202 info.addPara(
indent +
"Your fleet has a base fuel consumption of %s, which " + is +
" reduced by %s, or %s units",
204 "" + Misc.getRoundedValueMaxOneAfterDecimal(fuelUse),
205 "" + (int)(Math.round((1f - useMult) * 100f)) +
"%",
206 "" + Misc.getRoundedValueMaxOneAfterDecimal(reduction)
218 public ScopeDescription getScopeDescription() {
219 return ScopeDescription.FLEET;
225 public void apply(MutableCharacterStatsAPI stats, String
id,
float level) {
226 stats.getDynamic().getMod(Stats.FUEL_SUPPLY_BONUS_MOD).modifyFlat(
id,
FUEL_PROD_BONUS);
229 public void unapply(MutableCharacterStatsAPI stats, String
id) {
230 stats.getDynamic().getMod(Stats.FUEL_SUPPLY_BONUS_MOD).unmodifyFlat(
id);
233 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
234 TooltipMakerAPI info,
float width) {
238 Color c = Misc.getBasePlayerColor();
239 info.addPara(
"Affects: %s", opad + 5f, Misc.getGrayColor(), c,
"governed colony");
240 info.addSpacer(opad);
241 info.addPara(
"+%s fuel production", 0f,
hc,
hc,
245 public ScopeDescription getScopeDescription() {
246 return ScopeDescription.GOVERNED_OUTPOST;