30 public static class Level1
implements FleetStatsSkillEffect {
31 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
32 String desc =
"Salvaging skill";
33 stats.getDynamic().getStat(Stats.SALVAGE_VALUE_MULT_FLEET_NOT_RARE).modifyFlat(
id,
SALVAGE_BONUS * 0.01f, desc);
36 public void unapply(MutableFleetStatsAPI stats, String
id) {
37 stats.getDynamic().getStat(Stats.SALVAGE_VALUE_MULT_FLEET_NOT_RARE).unmodify(
id);
40 public String getEffectDescription(
float level) {
42 return "+" + (int)
SALVAGE_BONUS +
"% resources - but not rare items, such as blueprints - recovered from abandoned stations and other derelicts";
45 public String getEffectPerLevelDescription() {
49 public ScopeDescription getScopeDescription() {
50 return ScopeDescription.FLEET;
54 public static class Level2
implements FleetStatsSkillEffect {
55 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
56 stats.getDynamic().getStat(Stats.FUEL_SALVAGE_VALUE_MULT_FLEET).modifyFlat(
id,
FUEL_SALVAGE_BONUS * 0.01f);
59 public void unapply(MutableFleetStatsAPI stats, String
id) {
60 stats.getDynamic().getStat(Stats.FUEL_SALVAGE_VALUE_MULT_FLEET).unmodify(
id);
63 public String getEffectDescription(
float level) {
66 return "+" + (int) max +
"% fuel salvaged";
69 public String getEffectPerLevelDescription() {
73 public ScopeDescription getScopeDescription() {
74 return ScopeDescription.FLEET;
78 public static class Level3
implements FleetStatsSkillEffect {
79 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
80 stats.getDynamic().getStat(Stats.BATTLE_SALVAGE_MULT_FLEET).modifyFlat(
id,
COMBAT_SALVAGE * 0.01f);
83 public void unapply(MutableFleetStatsAPI stats, String
id) {
84 stats.getDynamic().getStat(Stats.BATTLE_SALVAGE_MULT_FLEET).unmodify(
id);
87 public String getEffectDescription(
float level) {
91 public String getEffectPerLevelDescription() {
95 public ScopeDescription getScopeDescription() {
96 return ScopeDescription.FLEET;
100 public static class Level5
implements FleetStatsSkillEffect {
101 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
102 stats.getDynamic().getStat(Stats.NON_COMBAT_CREW_LOSS_MULT).modifyMult(
id, 1f -
CREW_LOSS_REDUCTION / 100f);
105 public void unapply(MutableFleetStatsAPI stats, String
id) {
106 stats.getDynamic().getStat(Stats.NON_COMBAT_CREW_LOSS_MULT).unmodify(
id);
109 public String getEffectDescription(
float level) {
113 public String getEffectPerLevelDescription() {
117 public ScopeDescription getScopeDescription() {
118 return ScopeDescription.FLEET;
125 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
127 float capMult = getCargoCapacityMult(
id,
getFleetData(stats));
128 stats.getCargoMod().modifyMult(
id, capMult);
131 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
133 stats.getCargoMod().unmodifyMult(
id);
136 public String getEffectDescription(
float level) {
140 protected float getCargoCapacityBase(String
id, FleetDataAPI data) {
141 if (data ==
null)
return 0f;
144 for (FleetMemberAPI curr : data.getMembersListCopy()) {
145 StatBonus stat = curr.getStats().getCargoMod();
146 StatMod mod = stat.getMultBonus(
id);
148 stat.unmodifyMult(mod.source);
150 cargoCap += curr.getCargoCapacity();
152 stat.modifyMult(mod.source, mod.value, mod.desc);
158 protected float getCargoCapacityMult(String
id, FleetDataAPI data) {
159 if (data ==
null)
return 0f;
161 String key =
"salvaging1";
162 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
163 if (bonus !=
null)
return bonus;
165 float cargoBase = getCargoCapacityBase(
id, data);
172 capMult = 1f + addCapacity / cargoBase;
173 capMult = Math.round(capMult * 100f) / 100f;
176 data.getCacheClearedOnSync().put(key, capMult);
180 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
181 TooltipMakerAPI info,
float width) {
185 info.addPara(
"Cargo capacity increased by %s or %s units, whichever is lower",
192 FleetDataAPI data =
Global.
getSector().getPlayerFleet().getFleetData();
194 float cargoCap = getCargoCapacityBase(
id, data);
195 float capMult = getCargoCapacityMult(
id, data);
197 float increase = cargoCap * (capMult - 1f);
199 boolean has = stats.getSkillLevel(skill.getId()) > 0;
201 if (!has) is =
"would be";
202 info.addPara(
indent +
"Your fleet has a base cargo capacity of %s, which " + is +
" increased by %s, or approximately %s units",
204 "" + Misc.getRoundedValueMaxOneAfterDecimal(cargoCap),
205 "" + (int)(Math.round((capMult - 1f) * 100f)) +
"%",
206 "" + Misc.getRoundedValueMaxOneAfterDecimal(increase)
212 public ScopeDescription getScopeDescription() {
213 return ScopeDescription.FLEET;