28 public static boolean isOfficer(MutableShipStatsAPI stats) {
29 if (stats.getEntity() instanceof ShipAPI) {
30 ShipAPI ship = (ShipAPI) stats.getEntity();
31 if (ship ==
null)
return false;
32 if (ship.isFighter() && ship.getWing() !=
null && ship.getWing().getSourceShip() !=
null) {
33 ship = ship.getWing().getSourceShip();
35 return ship.getCaptain() !=
null && !ship.getCaptain().isDefault();
37 FleetMemberAPI member = stats.getFleetMember();
38 if (member ==
null)
return false;
39 return !member.getCaptain().isDefault();
45 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
48 stats.getDynamic().getStat(Stats.FIGHTER_CREW_LOSS_MULT).modifyMult(
id, 1f - crewLossReduction / 100f);
51 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
52 stats.getDynamic().getStat(Stats.FIGHTER_CREW_LOSS_MULT).unmodifyMult(
id);
55 public String getEffectDescription(
float level) {
59 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
60 TooltipMakerAPI info,
float width) {
67 info.addPara(
"-%s crew lost due to fighter losses in combat (maximum: %s)", 0f,
hc,
hc,
68 "" + (
int) crewLossReduction +
"%",
73 public ScopeDescription getScopeDescription() {
74 return ScopeDescription.ALL_SHIPS;
80 public static class Level2
extends BaseSkillEffectDescription implements ShipSkillEffect, FleetTotalSource {
82 public FleetTotalItem getFleetTotalItem() {
86 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
92 float speedBonus = getMaxSpeedBonus(stats);
94 stats.getMaxSpeed().modifyPercent(
id, speedBonus);
95 stats.getAcceleration().modifyPercent(
id, speedBonus * 2f);
96 stats.getDeceleration().modifyPercent(
id, speedBonus * 2f);
98 float aimBonus = getAimBonus(stats);
100 stats.getAutofireAimAccuracy().modifyFlat(
id, aimBonus * 0.01f);
103 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
108 stats.getMaxSpeed().unmodifyPercent(
id);
109 stats.getAcceleration().unmodifyPercent(
id);
110 stats.getDeceleration().unmodifyPercent(
id);
112 stats.getAutofireAimAccuracy().unmodifyFlat(
id);
115 public String getEffectDescription(
float level) {
135 protected float getMaxSpeedBonus(MutableShipStatsAPI stats) {
137 return getMaxSpeedBonus(data);
140 protected float getMaxSpeedBonus(FleetDataAPI data) {
142 String key =
"fighter_uplink_max_speed";
143 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
144 if (bonus !=
null)
return bonus;
149 data.getCacheClearedOnSync().put(key, bonus);
153 protected float getAimBonus(MutableShipStatsAPI stats) {
155 return getAimBonus(data);
158 protected float getAimBonus(FleetDataAPI data) {
160 String key =
"fighter_uplink_aim";
161 Float bonus = (Float) data.getCacheClearedOnSync().get(key);
162 if (bonus !=
null)
return bonus;
167 data.getCacheClearedOnSync().put(key, bonus);
171 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
172 TooltipMakerAPI info,
float width) {
182 float speedBonus = getMaxSpeedBonus(data);
183 float aimBonus = getAimBonus(data);
193 info.addPara(
"+%s top speed (maximum: %s)", 0f,
hc,
hc,
194 "" + (
int) speedBonus +
"%",
196 info.addPara(
"+%s target leading accuracy (maximum: %s)", 0f,
hc,
hc,
197 "" + (
int) aimBonus +
"%",
200 info.addPara(
indent +
"Effect increased by %s for ships with offcers, including flagship",
202 "" + Misc.getRoundedValueMaxOneAfterDecimal(
OFFICER_MULT) + Strings.X);
207 public ScopeDescription getScopeDescription() {
208 return ScopeDescription.ALL_FIGHTERS;