29 public static class Level1
implements FleetStatsSkillEffect {
30 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
31 String desc =
"Surveying skill";
32 stats.getDynamic().getStat(Stats.SURVEY_COST_MULT).modifyMult(
id,
SURVEY_COST_MULT, desc);
35 public void unapply(MutableFleetStatsAPI stats, String
id) {
36 stats.getDynamic().getStat(Stats.SURVEY_COST_MULT).unmodifyMult(
id);
39 public String getEffectDescription(
float level) {
40 return "-" + (int) Math.round((1f -
SURVEY_COST_MULT) * 100f) +
"% resources required to survey planets";
43 public String getEffectPerLevelDescription() {
47 public ScopeDescription getScopeDescription() {
48 return ScopeDescription.FLEET;
52 public static class Level2
implements FleetStatsSkillEffect {
53 public void apply(MutableFleetStatsAPI stats, String
id,
float level) {
54 String desc =
"Surveying skill";
55 stats.getDynamic().getStat(Stats.PLANET_MINING_VALUE_MULT).modifyMult(
id,
SURVEY_COST_MULT, desc);
58 public void unapply(MutableFleetStatsAPI stats, String
id) {
59 stats.getDynamic().getStat(Stats.PLANET_MINING_VALUE_MULT).unmodify(
id);
62 public String getEffectDescription(
float level) {
63 return "+" + (int) Math.round((1f -
SURVEY_COST_MULT) * 100f) +
"% resources extracted from surface deposits on uncolonized planets";
66 public String getEffectPerLevelDescription() {
70 public ScopeDescription getScopeDescription() {
71 return ScopeDescription.FLEET;
77 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
79 float useMult = getSupplyUseMult(
id,
getFleetData(stats));
80 stats.getSuppliesPerMonth().modifyMult(
id, useMult);
83 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
85 stats.getSuppliesPerMonth().unmodifyMult(
id);
88 public String getEffectDescription(
float level) {
92 protected float getSupplyUseBase(String
id, FleetDataAPI data) {
93 if (data ==
null)
return 0f;
96 for (FleetMemberAPI curr : data.getMembersListCopy()) {
97 MutableStat stat = curr.getStats().getSuppliesPerMonth();
98 StatMod mod = stat.getMultStatMod(
id);
100 stat.unmodifyMult(mod.source);
102 supplyUse += stat.getModifiedValue();
104 stat.modifyMult(mod.source, mod.value, mod.desc);
110 protected float getSupplyUseMult(String
id, FleetDataAPI data) {
111 if (data ==
null)
return 0f;
113 String key =
"makeshift1";
114 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
115 if (bonus !=
null)
return bonus;
117 float supplyUse = getSupplyUseBase(
id, data);
124 useMult = 1f - maxReduced / supplyUse;
128 data.getCacheClearedOnSync().put(key, useMult);
132 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
133 TooltipMakerAPI info,
float width) {
137 info.addPara(
"Reduces monthly supply consumption for ship maintenance by %s or %s units, whichever is lower",
144 FleetDataAPI data =
Global.
getSector().getPlayerFleet().getFleetData();
146 float supplyUse = getSupplyUseBase(
id, data);
147 float useMult = getSupplyUseMult(
id, data);
149 float reduction = supplyUse * (1f - useMult);
151 boolean has = stats.getSkillLevel(skill.getId()) > 0;
153 if (!has) is =
"would be";
154 info.addPara(
indent +
"Your fleet requires a base %s supplies per month for maintenance, which " + is +
" reduced by %s, or %s units",
156 "" + Misc.getRoundedValueMaxOneAfterDecimal(supplyUse),
157 "" + (int)(Math.round((1f - useMult) * 100f)) +
"%",
158 "" + Misc.getRoundedValueMaxOneAfterDecimal(reduction)
172 public ScopeDescription getScopeDescription() {
173 return ScopeDescription.FLEET;