001package com.fs.starfarer.api.impl.campaign.skills; 002 003import java.util.HashMap; 004import java.util.Map; 005 006import com.fs.starfarer.api.characters.ShipSkillEffect; 007import com.fs.starfarer.api.combat.MutableShipStatsAPI; 008import com.fs.starfarer.api.combat.ShipAPI; 009import com.fs.starfarer.api.combat.ShipAPI.HullSize; 010import com.fs.starfarer.api.impl.campaign.ids.Stats; 011 012public class OmegaECM { 013 014 public static Map<HullSize, Float> BONUS = new HashMap<ShipAPI.HullSize, Float>(); 015 static { 016 BONUS.put(HullSize.FRIGATE, 5f); 017 BONUS.put(HullSize.DESTROYER, 10f); 018 BONUS.put(HullSize.CRUISER, 15f); 019 BONUS.put(HullSize.CAPITAL_SHIP, 30f); 020 } 021 022 public static class Level1 implements ShipSkillEffect { 023 public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) { 024 Float bonus = BONUS.get(hullSize); 025 if (bonus != null) { 026 stats.getDynamic().getMod(Stats.ELECTRONIC_WARFARE_FLAT).modifyFlat(id, bonus); 027 } 028 } 029 public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) { 030 stats.getDynamic().getMod(Stats.ELECTRONIC_WARFARE_FLAT).unmodify(id); 031 } 032 public String getEffectDescription(float level) { 033 int min = (int)Math.round(BONUS.get(HullSize.FRIGATE)); 034 int max = (int)Math.round(BONUS.get(HullSize.CAPITAL_SHIP)); 035 return "+" + min + "-" + max + "% to ECM rating of ships, depending on ship size"; 036 } 037 public String getEffectPerLevelDescription() { 038 return null; 039 } 040 041 public ScopeDescription getScopeDescription() { 042 return ScopeDescription.PILOTED_SHIP; 043 } 044 } 045 046}