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 AdvancedCountermeasures {
008        
009        public static final float ARMOR_KINETIC_REDUCTION = 50f;
010        public static final float SHIELD_HE_REDUCTION = 25f;
011        public static final float FIGHTER_DAMAGE_BONUS = 50f;
012        public static final float MISSILE_DAMAGE_BONUS = 50f;
013        
014        
015
016        public static class Level1 implements ShipSkillEffect {
017
018                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
019                        stats.getKineticArmorDamageTakenMult().modifyMult(id, 1f - ARMOR_KINETIC_REDUCTION / 100f);
020                }
021                
022                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
023                        stats.getKineticArmorDamageTakenMult().unmodify(id);
024                }
025                
026                public String getEffectDescription(float level) {
027                        return "-" + (int)(ARMOR_KINETIC_REDUCTION) + "% kinetic damage taken by armor";
028                }
029                
030                public String getEffectPerLevelDescription() {
031                        return null;
032                }
033                
034                public ScopeDescription getScopeDescription() {
035                        return ScopeDescription.PILOTED_SHIP;
036                }
037        }
038
039        public static class Level2 implements ShipSkillEffect {
040                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
041                        stats.getHighExplosiveShieldDamageTakenMult().modifyMult(id, 1f - SHIELD_HE_REDUCTION / 100f);
042                }
043                
044                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
045                        stats.getHighExplosiveShieldDamageTakenMult().unmodify(id);
046                }
047                
048                public String getEffectDescription(float level) {
049                        return "-" + (int)(SHIELD_HE_REDUCTION) + "% high-explosive damage taken by shields";
050                }
051                
052                public String getEffectPerLevelDescription() {
053                        return null;
054                }
055
056                public ScopeDescription getScopeDescription() {
057                        return ScopeDescription.PILOTED_SHIP;
058                }
059        }
060        
061        public static class Level3A implements ShipSkillEffect {
062
063                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
064                        stats.getDamageToFighters().modifyFlat(id, FIGHTER_DAMAGE_BONUS / 100f);
065                }
066                
067                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
068                        stats.getDamageToFighters().unmodify(id);
069                }       
070                
071                public String getEffectDescription(float level) {
072                        return "+" + (int)(FIGHTER_DAMAGE_BONUS) + "% damage to fighters";
073                }
074                
075                public String getEffectPerLevelDescription() {
076                        return null;
077                }
078                
079                public ScopeDescription getScopeDescription() {
080                        return ScopeDescription.PILOTED_SHIP;
081                }
082        }
083        
084        public static class Level3B implements ShipSkillEffect {
085
086                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
087                        stats.getDamageToMissiles().modifyFlat(id, MISSILE_DAMAGE_BONUS / 100f);
088                }
089                
090                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
091                        stats.getDamageToMissiles().unmodify(id);
092                }       
093                
094                public String getEffectDescription(float level) {
095                        return "+" + (int)(MISSILE_DAMAGE_BONUS) + "% damage to missiles";
096                }
097                
098                public String getEffectPerLevelDescription() {
099                        return null;
100                }
101                
102                public ScopeDescription getScopeDescription() {
103                        return ScopeDescription.PILOTED_SHIP;
104                }
105        }
106}