28 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
30 stats.getMaxBurnLevel().modifyFlat(
id,
BURN_BONUS);
34 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
35 stats.getMaxBurnLevel().unmodifyFlat(
id);
39 public boolean hasCustomDescription() {
43 public String getEffectDescription(
float level) {
44 return "Increases the burn level of all non-militarized civilian-grade ships by " + (int)
BURN_BONUS;
47 public ScopeDescription getScopeDescription() {
48 return ScopeDescription.ALL_SHIPS;
53 protected abstract String getModifierId();
54 protected abstract String getCacheKey();
55 protected abstract String getCapacityString();
56 protected abstract float getCapacity(FleetMemberAPI member);
57 protected abstract float getMaxPercent();
58 protected abstract float getThreshold();
59 protected abstract StatBonus getShipStat(MutableShipStatsAPI stats);
60 protected abstract boolean withSpacerAfter();
62 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
64 float capBonus = getCapacityBonus(
id,
getFleetData(stats));
65 getShipStat(stats).modifyMult(
id, 1f + (capBonus / 100f));
68 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
70 getShipStat(stats).unmodifyMult(
id);
73 public String getEffectDescription(
float level) {
77 protected float getCapacityBase(String
id, FleetDataAPI data) {
78 if (data ==
null)
return 0f;
81 for (FleetMemberAPI curr : data.getMembersListCopy()) {
82 cap += getCapacityBase(
id, curr);
87 protected float getCapacityBase(String
id, FleetMemberAPI curr) {
88 StatBonus stat = getShipStat(curr.getStats());
89 StatMod mod = stat.getMultBonus(
id);
91 stat.unmodifyMult(mod.source);
93 float cap = getCapacity(curr);
95 stat.modifyMult(mod.source, mod.value, mod.desc);
100 protected float getCapacityBonus(String
id, FleetDataAPI data) {
101 if (data ==
null)
return getMaxPercent();
103 String key = getCacheKey();
104 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
105 if (bonus !=
null)
return bonus;
107 float base = getCapacityBase(
id, data);
117 data.getCacheClearedOnSync().put(key, bonus);
121 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
122 TooltipMakerAPI info,
float width) {
133 float capBonus = getCapacityBonus(getModifierId(), data);;
135 info.addPara(
"+%s " + getCapacityString().toLowerCase() +
" (maximum: %s)", 0f,
hc,
hc,
136 "" + (
int)(Math.round(capBonus)) +
"%",
137 "" + (
int) getMaxPercent() +
"%");
141 float baseCap = getCapacityBase(getModifierId(), data);
142 info.addPara(
indent +
"Maximum at %s or less base " + getCapacityString().toLowerCase() +
143 " in fleet, your fleet has %s base " + getCapacityString().toLowerCase(),
145 "" + (
int) getThreshold(),
146 "" + (
int)Math.round(baseCap));
148 info.addPara(
indent +
"Maximum at %s or less base " + getCapacityString().toLowerCase() +
151 "" + (
int) getThreshold());
154 if (withSpacerAfter()) {
207 public ScopeDescription getScopeDescription() {
208 return ScopeDescription.FLEET;
214 public static class Level1
extends BaseCapacityModifierEffect {
215 public String getModifierId() {
216 return "bt_cargo_cap_mod";
218 public String getCacheKey() {
219 return "bt_cargo_cap";
221 public StatBonus getShipStat(MutableShipStatsAPI stats) {
222 return stats.getCargoMod();
224 public float getCapacity(FleetMemberAPI member) {
225 return member.getCargoCapacity();
228 public String getCapacityString() {
229 return "Cargo capacity";
232 public float getMaxPercent() {
236 public float getThreshold() {
240 public boolean withSpacerAfter() {
245 public static class Level2
extends BaseCapacityModifierEffect {
246 public String getModifierId() {
247 return "bt_fuel_cap_mod";
249 public String getCacheKey() {
250 return "bt_fuel_cap";
252 public StatBonus getShipStat(MutableShipStatsAPI stats) {
253 return stats.getFuelMod();
255 public float getCapacity(FleetMemberAPI member) {
256 return member.getFuelCapacity();
259 public String getCapacityString() {
260 return "Fuel capacity";
263 public float getMaxPercent() {
267 public float getThreshold() {
271 public boolean withSpacerAfter() {
276 public static class Level3
extends BaseCapacityModifierEffect {
277 public String getModifierId() {
278 return "bt_crew_cap_mod";
280 public String getCacheKey() {
281 return "bt_crew_cap";
283 public StatBonus getShipStat(MutableShipStatsAPI stats) {
284 return stats.getMaxCrewMod();
286 public float getCapacity(FleetMemberAPI member) {
287 return member.getMaxCrew();
290 public String getCapacityString() {
291 return "Personnel capacity";
294 public float getMaxPercent() {
298 public float getThreshold() {
302 public boolean withSpacerAfter() {