001package com.fs.starfarer.api.impl.campaign.skills;
002
003import com.fs.starfarer.api.characters.ShipSkillEffect;
004import com.fs.starfarer.api.combat.MutableShipStatsAPI;
005import com.fs.starfarer.api.combat.ShipAPI.HullSize;
006
007public class FieldModulation {
008        
009        public static float SHIELD_DAMAGE_REDUCTION = 15f;
010        public static float FLUX_SHUNT_DISSIPATION = 20f;
011        
012        public static float PHASE_FLUX_UPKEEP_REDUCTION = 25f;
013        public static float PHASE_COOLDOWN_REDUCTION = 50f;
014        
015        public static float ELITE_DAMAGE_TO_SHIELDS_PERCENT = 5f;
016        public static float OVERLOAD_REDUCTION = 25f;
017
018
019        public static class Level1 implements ShipSkillEffect {
020                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
021                        stats.getShieldDamageTakenMult().modifyMult(id, 1f - SHIELD_DAMAGE_REDUCTION / 100f);
022                }
023                
024                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
025                        stats.getShieldDamageTakenMult().unmodify(id);
026                }
027                
028                public String getEffectDescription(float level) {
029                        return "-" + (int)(SHIELD_DAMAGE_REDUCTION) + "% damage taken by shields";
030                }
031                
032                public String getEffectPerLevelDescription() {
033                        return null;
034                }
035
036                public ScopeDescription getScopeDescription() {
037                        return ScopeDescription.PILOTED_SHIP;
038                }
039        }
040        
041        public static class Level2 implements ShipSkillEffect {
042
043                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
044                        stats.getPhaseCloakUpkeepCostBonus().modifyMult(id, 1f - PHASE_FLUX_UPKEEP_REDUCTION / 100f);
045                }
046                
047                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
048                        stats.getPhaseCloakUpkeepCostBonus().unmodify(id);
049                }
050                
051                public String getEffectDescription(float level) {
052                        return "-" + (int)(PHASE_FLUX_UPKEEP_REDUCTION) + "% flux generated by active phase cloak";
053                }
054                
055                public String getEffectPerLevelDescription() {
056                        return null;
057                }
058                
059                public ScopeDescription getScopeDescription() {
060                        return ScopeDescription.PILOTED_SHIP;
061                }
062        }
063        
064        public static class Level3 implements ShipSkillEffect {
065
066                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
067                        stats.getHardFluxDissipationFraction().modifyFlat(id, FLUX_SHUNT_DISSIPATION / 100f);
068                }
069                
070                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
071                        stats.getHardFluxDissipationFraction().unmodify(id);
072                }       
073                
074                public String getEffectDescription(float level) {
075                        return "" + (int)(FLUX_SHUNT_DISSIPATION) + "% hard flux dissipation while shields are active";
076                }
077                
078                public String getEffectPerLevelDescription() {
079                        return null;
080                }
081                
082                public ScopeDescription getScopeDescription() {
083                        return ScopeDescription.PILOTED_SHIP;
084                }
085        }
086        
087        public static class Level4 implements ShipSkillEffect {
088                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
089                        stats.getPhaseCloakCooldownBonus().modifyMult(id, 1f - PHASE_COOLDOWN_REDUCTION / 100f);
090                }
091                
092                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
093                        stats.getPhaseCloakCooldownBonus().unmodify(id);
094                }
095                
096                public String getEffectDescription(float level) {
097                        return "-" + (int)(PHASE_COOLDOWN_REDUCTION) + "% phase cloak cooldown";
098                }
099                
100                public String getEffectPerLevelDescription() {
101                        return null;
102                }
103                
104                public ScopeDescription getScopeDescription() {
105                        return ScopeDescription.PILOTED_SHIP;
106                }
107        }
108        
109        
110        public static class Level5 implements ShipSkillEffect {
111
112                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
113                        stats.getDamageToTargetShieldsMult().modifyPercent(id, ELITE_DAMAGE_TO_SHIELDS_PERCENT);
114                }
115                
116                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
117                        stats.getDamageToTargetShieldsMult().unmodifyPercent(id);
118                }
119                
120                public String getEffectDescription(float level) {
121                        return "+" + (int)(ELITE_DAMAGE_TO_SHIELDS_PERCENT) + "% damage dealt to shields";
122                }
123                
124                public String getEffectPerLevelDescription() {
125                        return null;
126                }
127                
128                public ScopeDescription getScopeDescription() {
129                        return ScopeDescription.PILOTED_SHIP;
130                }
131        }
132        
133        public static class Level6 implements ShipSkillEffect {
134                
135                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
136                        stats.getOverloadTimeMod().modifyMult(id, 1f - OVERLOAD_REDUCTION / 100f);
137                }
138                
139                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
140                        stats.getOverloadTimeMod().unmodify(id);
141                }       
142                
143                public String getEffectDescription(float level) {
144                        return "-" + (int)(OVERLOAD_REDUCTION) + "% overload duration";
145                }
146                
147                public String getEffectPerLevelDescription() {
148                        return null;
149                }
150                
151                public ScopeDescription getScopeDescription() {
152                        return ScopeDescription.PILOTED_SHIP;
153                }
154        }
155}