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 EvasiveAction {
008        
009        public static final float MANEUVERABILITY_BONUS = 50;
010        public static final float DAMAGE_TO_MODULES_REDUCTION = 50;
011        public static final float EFFECTIVE_ARMOR_BONUS = 50;
012        
013
014        public static class Level1 implements ShipSkillEffect {
015
016                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
017                        stats.getAcceleration().modifyPercent(id, MANEUVERABILITY_BONUS);
018                        stats.getDeceleration().modifyPercent(id, MANEUVERABILITY_BONUS);
019                        stats.getTurnAcceleration().modifyPercent(id, MANEUVERABILITY_BONUS * 2f);
020                        stats.getMaxTurnRate().modifyPercent(id, MANEUVERABILITY_BONUS);
021                }
022                
023                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
024                        stats.getAcceleration().unmodify(id);
025                        stats.getDeceleration().unmodify(id);
026                        stats.getTurnAcceleration().unmodify(id);
027                        stats.getMaxTurnRate().unmodify(id);
028                }
029                
030                public String getEffectDescription(float level) {
031                        return "+" + (int)(MANEUVERABILITY_BONUS) + "% maneuverability";
032                }
033                
034                public String getEffectPerLevelDescription() {
035                        return null;
036                }
037                
038                public ScopeDescription getScopeDescription() {
039                        return ScopeDescription.PILOTED_SHIP;
040                }
041        }
042
043        public static class Level2 implements ShipSkillEffect {
044
045                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
046                        stats.getEngineDamageTakenMult().modifyMult(id, 1f - DAMAGE_TO_MODULES_REDUCTION / 100f);
047                        stats.getWeaponDamageTakenMult().modifyMult(id, 1f - DAMAGE_TO_MODULES_REDUCTION / 100f);
048                }
049                
050                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
051                        stats.getEngineDamageTakenMult().unmodify(id);
052                        stats.getWeaponDamageTakenMult().unmodify(id);
053                }
054                
055                public String getEffectDescription(float level) {
056                        return "-" + (int)(DAMAGE_TO_MODULES_REDUCTION) + "% weapon and engine damage taken";
057                }
058                
059                public String getEffectPerLevelDescription() {
060                        return null;
061                }
062
063                public ScopeDescription getScopeDescription() {
064                        return ScopeDescription.PILOTED_SHIP;
065                }
066        }
067        
068        public static class Level3 implements ShipSkillEffect {
069
070                public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
071                        stats.getEffectiveArmorBonus().modifyPercent(id, EFFECTIVE_ARMOR_BONUS);
072                }
073                
074                public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
075                        stats.getEffectiveArmorBonus().unmodify(id);
076                }       
077                
078                public String getEffectDescription(float level) {
079                        return "+" + (int)(EFFECTIVE_ARMOR_BONUS) + "% armor for damage reduction calculation only";
080                }
081                
082                public String getEffectPerLevelDescription() {
083                        return null;
084                }
085                
086                public ScopeDescription getScopeDescription() {
087                        return ScopeDescription.PILOTED_SHIP;
088                }
089        }
090        
091}