39 public void applyEffectsAfterShipCreation(ShipAPI ship, String
id) {
40 ship.addListener(
new EWMDamageDealtMod(ship));
43 public void unapplyEffectsAfterShipCreation(ShipAPI ship, String
id) {
44 ship.removeListenerOfClass(EWMDamageDealtMod.class);
47 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
51 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
52 stats.getEnergyWeaponFluxBasedBonusDamageMagnitude().unmodifyFlat(
id);
53 stats.getEnergyWeaponFluxBasedBonusDamageMinLevel().unmodifyFlat(
id);
56 public String getEffectDescription(
float level) {
60 public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill,
61 TooltipMakerAPI info,
float width) {
65 info.addPara(
"Energy weapons deal up to %s damage at close range as the firing ship's flux level increases above %s",
71 info.addPara(
"Energy weapons deal up to %s damage at close range, based on the firing ship's flux level",
76 info.addPara(
indent +
"Full bonus damage at %s range and below, " +
77 "no bonus damage at %s range and above",
84 public ScopeDescription getScopeDescription() {
85 return ScopeDescription.PILOTED_SHIP;
89 public static class Level2
implements ShipSkillEffect {
90 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String
id,
float level) {
94 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String
id) {
95 stats.getEnergyWeaponFluxCostMod().unmodify(
id);
98 public String getEffectDescription(
float level) {
99 return "-" + (int)Math.round((1f -
FLUX_COST_MULT) * 100f) +
"% flux generated by energy weapons";
102 public String getEffectPerLevelDescription() {
106 public ScopeDescription getScopeDescription() {
107 return ScopeDescription.PILOTED_SHIP;
114 public static class EWMDamageDealtMod
implements DamageDealtModifier, AdvanceableListener {
115 protected ShipAPI ship;
116 public EWMDamageDealtMod(ShipAPI ship) {
120 public void advance(
float amount) {
124 int damageBonus = (int) Math.round((ship.getFluxBasedEnergyWeaponDamageMultiplier() * 100f - 100f));
125 if (damageBonus > 0) {
128 "Energy weapon mastery",
129 "+" + damageBonus +
"% energy weapon damage",
false);
135 public String modifyDamageDealt(Object param,
136 CombatEntityAPI target, DamageAPI damage,
137 Vector2f point,
boolean shieldHit) {
141 Vector2f from =
null;
142 WeaponAPI weapon =
null;
143 if (param instanceof DamagingProjectileAPI) {
144 from = ((DamagingProjectileAPI)param).getSpawnLocation();
145 weapon = ((DamagingProjectileAPI)param).getWeapon();
146 }
else if (param instanceof BeamAPI) {
147 from = ((BeamAPI)param).getFrom();
148 weapon = ((BeamAPI)param).getWeapon();
153 if (weapon ==
null || ship ==
null)
return null;
154 if (weapon.getSpec().getType() != WeaponType.ENERGY)
return null;
156 float mag = ship.getFluxBasedEnergyWeaponDamageMultiplier() - 1f;
157 if (mag <= 0)
return null;
159 float dist = Misc.getDistance(from, point);
174 String
id =
"ewm_dam_mod";
175 damage.getModifier().modifyPercent(
id, (mag * f) * 100f);