28 public static boolean isOfficer(MutableShipStatsAPI stats) {
29 if (stats.getEntity() instanceof ShipAPI) {
30 ShipAPI ship = (ShipAPI) stats.getEntity();
31 if (ship.getCaptain().isAICore())
return false;
32 return !ship.getCaptain().isDefault();
34 FleetMemberAPI member = stats.getFleetMember();
35 if (member ==
null)
return false;
36 if (member.getCaptain().isAICore())
return false;
37 return !member.getCaptain().isDefault();
41 public static boolean isFlagship(MutableShipStatsAPI stats) {
42 if (stats.getEntity() instanceof ShipAPI) {
43 ShipAPI ship = (ShipAPI) stats.getEntity();
44 if (ship.getFleetMember() !=
null &&
45 ship.getFleetMember().getFleetCommander() == ship.getCaptain()) {
48 return ship.getCaptain().isPlayer();
50 FleetMemberAPI member = stats.getFleetMember();
51 if (member ==
null)
return false;
52 if (member.isFlagship()) {
55 return member.getCaptain().isPlayer();
60 FleetMemberAPI member = stats.getFleetMember();
61 if (member ==
null && stats.getEntity() instanceof ShipAPI) {
62 ShipAPI ship = (ShipAPI) stats.getEntity();
63 member = ship.getFleetMember();
66 if (member ==
null)
return 0f;
67 PersonAPI person = member.getFleetCommanderForStats();
68 if (person ==
null) person = member.getFleetCommander();
69 if (person ==
null)
return 0f;
71 MutableCharacterStatsAPI fcStats = person.getStats();
72 if (fcStats ==
null)
return 0f;
78 for (SkillLevelAPI sl : stats.getSkillsCopy()) {
79 if (sl.getLevel() >= 2f && sl.getSkill().isElite()) {
86 public static class Level0
implements DescriptionSkillEffect {
87 public String getString() {
89 return "\n*The base maximum number of elite skills per officer is " + base +
".";
91 public Color[] getHighlightColors() {
92 Color h = Misc.getDarkHighlightColor();
93 return new Color[] {h};
95 public String[] getHighlights() {
97 return new String [] {
"" + base};
99 public Color getTextColor() {
104 public static class Level1
implements CharacterStatsSkillEffect {
106 public void apply(MutableCharacterStatsAPI stats, String
id,
float level) {
110 public void unapply(MutableCharacterStatsAPI stats, String
id) {
111 stats.getDynamic().getMod(Stats.OFFICER_MAX_ELITE_SKILLS_MOD).unmodify(
id);
114 public String getEffectDescription(
float level) {
115 return "+" + (int)
MAX_ELITE_SKILLS_BONUS +
" to maximum number of elite skills* for officers under your command";
118 public String getEffectPerLevelDescription() {
122 public ScopeDescription getScopeDescription() {
123 return ScopeDescription.NONE;
127 public static class Level2
extends BaseSkillEffectDescription implements ShipSkillEffect {
128 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
129 TooltipMakerAPI info,
float width) {
132 Color c = Misc.getBasePlayerColor();
134 info.addPara(
"Affects: %s", opad + 5f, Misc.getGrayColor(), c,
"all ships with officers, including flagship");
135 info.addSpacer(opad);
139 info.addPara(
"Reduces the weapon range penalty due to superior enemy Electronic Warfare by up to %s percentage points", 0f,
hc,
hc,
143 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
145 stats.getDynamic().getMod(Stats.ELECTRONIC_WARFARE_PENALTY_MOD).modifyFlat(
id, -
ECCM_BONUS);
149 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
150 stats.getDynamic().getMod(Stats.ELECTRONIC_WARFARE_PENALTY_MOD).unmodifyFlat(
id);
154 public static class Level3
extends BaseSkillEffectDescription implements ShipSkillEffect {
155 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
156 TooltipMakerAPI info,
float width) {
159 Color c = Misc.getBasePlayerColor();
161 info.addPara(
"Affects: %s", opad + 5f, Misc.getGrayColor(), c,
"all ships with officers (but not AI cores), including flagship");
162 info.addSpacer(opad);
168 info.addPara(
"%s damage dealt and %s damage taken (%s for each elite skill you have)", 0f,
hc,
hc,
169 "+" + (
int) Math.round(bonus) +
"%",
170 "-" + (
int) Math.round(bonus) +
"%",
173 info.addPara(
"The damage-dealt bonus is doubled for the flagship",
hc, 0f);
180 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
190 stats.getArmorDamageTakenMult().modifyMult(
id, 1f - bonusTaken / 100f);
191 stats.getHullDamageTakenMult().modifyMult(
id, 1f - bonusTaken / 100f);
192 stats.getShieldDamageTakenMult().modifyMult(
id, 1f - bonusTaken / 100f);
194 stats.getBallisticWeaponDamageMult().modifyPercent(
id, bonusDealt);
195 stats.getEnergyWeaponDamageMult().modifyPercent(
id, bonusDealt);
196 stats.getMissileWeaponDamageMult().modifyPercent(
id, bonusDealt);
200 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
201 stats.getArmorDamageTakenMult().unmodifyMult(
id);
202 stats.getHullDamageTakenMult().unmodifyMult(
id);
203 stats.getShieldDamageTakenMult().unmodifyMult(
id);
205 stats.getBallisticWeaponDamageMult().unmodify(
id);
206 stats.getEnergyWeaponDamageMult().unmodify(
id);
207 stats.getMissileWeaponDamageMult().unmodify(
id);