26 public static class Test
implements ShipSkillEffect, CustomSkillDescription {
28 protected float getReplacementRateBonus(MutableShipStatsAPI stats) {
29 FleetMemberAPI member = stats.getFleetMember();
30 if (member ==
null)
return 0f;
31 FleetDataAPI data = member.getFleetDataForStats();
32 if (data ==
null) data = member.getFleetData();
33 if (data ==
null)
return 0f;
35 return getReplacementRateBonus(data);
39 protected float getReplacementRateBonus(FleetDataAPI data) {
41 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
42 if (bonus !=
null)
return bonus;
45 for (FleetMemberAPI curr : data.getMembersListCopy()) {
46 bays += curr.getNumFlightDecks();
49 bonus = (float) Math.round(300f / (Math.max(bays, 6)));
50 data.getCacheClearedOnSync().put(key, bonus);
55 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
56 float bonus = getReplacementRateBonus(stats);
57 float timeMult = 1f / ((100f + bonus) / 100f);
58 stats.getFighterRefitTimeMult().modifyMult(
id, timeMult);
61 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
62 stats.getFighterRefitTimeMult().unmodify(
id);
66 public boolean hasCustomDescription() {
70 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
71 TooltipMakerAPI info,
float width) {
73 Color textColor = Misc.getTextColor();
74 Color highlightColor = Misc.getHighlightColor();
75 Color darkHighlightColor = Misc.setAlpha(highlightColor, 155);
77 float level = stats.getSkillLevel(skill.getId());
79 textColor = Misc.getGrayColor();
80 highlightColor = darkHighlightColor;
85 float bonus = getReplacementRateBonus(
Global.
getSector().getPlayerFleet().getFleetData());
86 info.addPara(
"%s faster fighter replacements " +
87 "(based on number of fighter bays in fleet)", 0f, textColor, highlightColor,
88 "" + (
int)(bonus) +
"%");
92 public String getEffectDescription(
float level) {
93 float bonus = getReplacementRateBonus(
Global.
getSector().getPlayerFleet().getFleetData());
94 return "" + (int)(bonus) +
"% faster fighter replacements (based on number of fighter bays in fleet)";
98 public String getEffectPerLevelDescription() {
102 public ScopeDescription getScopeDescription() {
103 return ScopeDescription.ALL_SHIPS;
108 public static class Level1
implements ShipSkillEffect {
110 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
114 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
115 stats.getDynamic().getStat(Stats.FIGHTER_CREW_LOSS_MULT).unmodify(
id);
118 public String getEffectDescription(
float level) {
122 public String getEffectPerLevelDescription() {
126 public ScopeDescription getScopeDescription() {
127 return ScopeDescription.ALL_SHIPS;
131 public static class Level2
implements ShipSkillEffect {
132 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
138 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
139 stats.getHullDamageTakenMult().unmodify(
id);
140 stats.getArmorDamageTakenMult().unmodify(
id);
141 stats.getShieldDamageTakenMult().unmodify(
id);
144 public String getEffectDescription(
float level) {
148 public String getEffectPerLevelDescription() {
152 public ScopeDescription getScopeDescription() {
153 return ScopeDescription.ALL_FIGHTERS;
157 public static class Level3
implements ShipSkillEffect {
159 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
161 stats.getFighterRefitTimeMult().modifyMult(
id, timeMult);
164 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
165 stats.getFighterRefitTimeMult().unmodify(
id);
168 public String getEffectDescription(
float level) {
172 public String getEffectPerLevelDescription() {
176 public ScopeDescription getScopeDescription() {
177 return ScopeDescription.ALL_SHIPS;