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 Helmsmanship {
008        
009        public static float MANEUVERABILITY_BONUS = 50;
010        public static float SPEED_BONUS = 15f;
011        
012        public static float ELITE_SPEED_BONUS_FLAT = 10f;
013        
014        public static float ZERO_FLUX_LEVEL = 1f;
015        
016        //public static float DAMAGE_BONUS = 100f;
017
018        
019        public static class Level1 implements ShipSkillEffect {
020                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
021                        stats.getAcceleration().modifyPercent(id, MANEUVERABILITY_BONUS);
022                        stats.getDeceleration().modifyPercent(id, MANEUVERABILITY_BONUS);
023                        stats.getTurnAcceleration().modifyPercent(id, MANEUVERABILITY_BONUS * 2f);
024                        stats.getMaxTurnRate().modifyPercent(id, MANEUVERABILITY_BONUS);
025                        
026//                      stats.getBallisticWeaponDamageMult().modifyPercent(id, DAMAGE_BONUS);
027//                      stats.getEnergyWeaponDamageMult().modifyPercent(id, DAMAGE_BONUS);
028//                      stats.getMissileWeaponDamageMult().modifyPercent(id, DAMAGE_BONUS);
029                }
030                
031                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
032                        stats.getAcceleration().unmodify(id);
033                        stats.getDeceleration().unmodify(id);
034                        stats.getTurnAcceleration().unmodify(id);
035                        stats.getMaxTurnRate().unmodify(id);
036                        
037//                      stats.getBallisticWeaponDamageMult().unmodify(id);
038//                      stats.getEnergyWeaponDamageMult().unmodify(id);
039//                      stats.getMissileWeaponDamageMult().unmodify(id);
040                }
041                
042                public String getEffectDescription(float level) {
043                        return "+" + (int)(MANEUVERABILITY_BONUS) + "% maneuverability";
044                }
045                
046                public String getEffectPerLevelDescription() {
047                        return null;
048                }
049                
050                public ScopeDescription getScopeDescription() {
051                        return ScopeDescription.PILOTED_SHIP;
052                }
053        }
054
055        public static class Level2 implements ShipSkillEffect {
056                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
057                        stats.getMaxSpeed().modifyPercent(id, SPEED_BONUS);
058                }
059                
060                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
061                        stats.getMaxSpeed().unmodify(id);
062                }
063                
064                public String getEffectDescription(float level) {
065                        return "+" + (int)(SPEED_BONUS) + "% top speed";
066                }
067                
068                public String getEffectPerLevelDescription() {
069                        return null;
070                }
071
072                public ScopeDescription getScopeDescription() {
073                        return ScopeDescription.PILOTED_SHIP;
074                }
075        }
076        
077//      public static class Level3 implements ShipSkillEffect {
078//
079//              public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
080//                      stats.getZeroFluxMinimumFluxLevel().modifyFlat(id, ZERO_FLUX_LEVEL * 0.01f);
081//              }
082//              
083//              public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
084//                      stats.getZeroFluxMinimumFluxLevel().unmodify(id);
085//              }       
086//              
087//              public String getEffectDescription(float level) {
088//                      return "The 0-flux speed boost is activated at up to " + (int)(ZERO_FLUX_LEVEL) + "% flux";
089//              }
090//              
091//              public String getEffectPerLevelDescription() {
092//                      return null;
093//              }
094//              
095//              public ScopeDescription getScopeDescription() {
096//                      return ScopeDescription.PILOTED_SHIP;
097//              }
098//      }
099        
100        public static class Level3 implements ShipSkillEffect {
101
102                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
103                        stats.getAllowZeroFluxAtAnyLevel().modifyFlat(id, 1f);
104                }
105                
106                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
107                        stats.getAllowZeroFluxAtAnyLevel().unmodifyFlat(id);
108                }
109                
110                public String getEffectDescription(float level) {
111                        return "The 0-flux speed boost is activated at any flux level, if the ship is not generating flux or is venting / overloaded";
112                }
113                
114                public String getEffectPerLevelDescription() {
115                        return null;
116                }
117
118                public ScopeDescription getScopeDescription() {
119                        return ScopeDescription.PILOTED_SHIP;
120                }
121        }
122        
123        public static class Level4 implements ShipSkillEffect {
124                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
125                        stats.getMaxSpeed().modifyFlat(id, ELITE_SPEED_BONUS_FLAT);
126                }
127                
128                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
129                        stats.getMaxSpeed().unmodify(id);
130                }
131                
132                public String getEffectDescription(float level) {
133                        return "+" + (int)(ELITE_SPEED_BONUS_FLAT) + " su/second to top speed";
134                }
135                
136                public String getEffectPerLevelDescription() {
137                        return null;
138                }
139
140                public ScopeDescription getScopeDescription() {
141                        return ScopeDescription.PILOTED_SHIP;
142                }
143        }
144}