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 WingCommander {
008        
009        public static final float SPEED_BONUS = 25f;
010        public static final float DAMAGE_TO_FIGHTERS_BONUS = 30f;
011        public static final float DAMAGE_TO_MISSILES_BONUS = 30f;
012        public static final float TARGET_LEADING_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.getMaxSpeed().modifyPercent(id, SPEED_BONUS);
020                        stats.getAcceleration().modifyPercent(id, SPEED_BONUS);
021                        stats.getDeceleration().modifyPercent(id, SPEED_BONUS);
022                        stats.getTurnAcceleration().modifyPercent(id, SPEED_BONUS * 2f);
023                        stats.getMaxTurnRate().modifyPercent(id, SPEED_BONUS);
024                }
025                
026                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
027                        stats.getMaxSpeed().unmodify(id);
028                        stats.getAcceleration().unmodify(id);
029                        stats.getDeceleration().unmodify(id);
030                        stats.getTurnAcceleration().unmodify(id);
031                        stats.getMaxTurnRate().unmodify(id);
032                }
033                
034                public String getEffectDescription(float level) {
035                        return "+" + (int)(SPEED_BONUS) + "% top speed and maneuverability";
036                }
037                
038                public String getEffectPerLevelDescription() {
039                        return null;
040                }
041                
042                public ScopeDescription getScopeDescription() {
043                        return ScopeDescription.SHIP_FIGHTERS;
044                }
045        }
046
047        public static class Level2A implements ShipSkillEffect {
048
049                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
050                        stats.getDamageToFighters().modifyFlat(id, DAMAGE_TO_FIGHTERS_BONUS / 100f);
051                }
052                
053                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
054                        stats.getDamageToFighters().unmodify(id);
055                }       
056                
057                public String getEffectDescription(float level) {
058                        return "+" + (int)(DAMAGE_TO_FIGHTERS_BONUS) + "% damage to fighters";
059                }
060                
061                public String getEffectPerLevelDescription() {
062                        return null;
063                }
064                
065                public ScopeDescription getScopeDescription() {
066                        return ScopeDescription.SHIP_FIGHTERS;
067                }
068        }
069        
070        public static class Level2B implements ShipSkillEffect {
071
072                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
073                        stats.getDamageToMissiles().modifyFlat(id, DAMAGE_TO_MISSILES_BONUS / 100f);
074                }
075                
076                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
077                        stats.getDamageToMissiles().unmodify(id);
078                }       
079                
080                public String getEffectDescription(float level) {
081                        return "+" + (int)(DAMAGE_TO_MISSILES_BONUS) + "% damage to missiles";
082                }
083                
084                public String getEffectPerLevelDescription() {
085                        return null;
086                }
087                
088                public ScopeDescription getScopeDescription() {
089                        return ScopeDescription.SHIP_FIGHTERS;
090                }
091        }
092        
093        public static class Level3 implements ShipSkillEffect {
094
095                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
096                        stats.getAutofireAimAccuracy().modifyFlat(id, TARGET_LEADING_BONUS * 0.01f);
097                }
098                
099                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
100                        stats.getAutofireAimAccuracy().unmodify(id);
101                }       
102                
103                public String getEffectDescription(float level) {
104                        return "+" + (int)(TARGET_LEADING_BONUS) + "% target leading accuracy";
105                }
106                
107                public String getEffectPerLevelDescription() {
108                        return null;
109                }
110                
111                public ScopeDescription getScopeDescription() {
112                        return ScopeDescription.SHIP_FIGHTERS;
113                }
114        }
115        
116}