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;
006import com.fs.starfarer.api.impl.campaign.ids.Stats;
007
008public class PhaseMastery {
009        
010        public static final float FLUX_UPKEEP_REDUCTION = 25f;
011        public static final float PHASE_COOLDOWN_REDUCTION = 50f;
012        public static final float PHASE_SPEED_BONUS = 100f;
013        
014
015        public static class Level1 implements ShipSkillEffect {
016
017                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
018                        stats.getPhaseCloakUpkeepCostBonus().modifyMult(id, 1f - FLUX_UPKEEP_REDUCTION / 100f);
019                }
020                
021                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
022                        stats.getPhaseCloakUpkeepCostBonus().unmodify(id);
023                }
024                
025                public String getEffectDescription(float level) {
026                        return "-" + (int)(FLUX_UPKEEP_REDUCTION) + "% flux generated by active phase cloak";
027                }
028                
029                public String getEffectPerLevelDescription() {
030                        return null;
031                }
032                
033                public ScopeDescription getScopeDescription() {
034                        return ScopeDescription.PILOTED_SHIP;
035                }
036        }
037
038        public static class Level2 implements ShipSkillEffect {
039                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
040                        stats.getPhaseCloakCooldownBonus().modifyMult(id, 1f - PHASE_COOLDOWN_REDUCTION / 100f);
041                }
042                
043                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
044                        stats.getPhaseCloakCooldownBonus().unmodify(id);
045                }
046                
047                public String getEffectDescription(float level) {
048                        return "-" + (int)(PHASE_COOLDOWN_REDUCTION) + "% phase cloak cooldown";
049                }
050                
051                public String getEffectPerLevelDescription() {
052                        return null;
053                }
054                
055                public ScopeDescription getScopeDescription() {
056                        return ScopeDescription.PILOTED_SHIP;
057                }
058        }
059        
060        public static class Level3 implements ShipSkillEffect {
061
062                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
063                        stats.getDynamic().getMod(Stats.PHASE_CLOAK_SPEED_MOD).modifyFlat(id, PHASE_SPEED_BONUS);
064                }
065                
066                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
067                        stats.getDynamic().getMod(Stats.PHASE_CLOAK_SPEED_MOD).unmodifyFlat(id);
068                }       
069                
070                public String getEffectDescription(float level) {
071                        return "+" + (int)(PHASE_SPEED_BONUS) + "% top speed while phase cloak active";
072                }
073                
074                public String getEffectPerLevelDescription() {
075                        return null;
076                }
077                
078                public ScopeDescription getScopeDescription() {
079                        return ScopeDescription.PILOTED_SHIP;
080                }
081        }
082        
083        
084}