001package com.fs.starfarer.api.impl.hullmods;
002
003import com.fs.starfarer.api.combat.BaseHullMod;
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 DesignCompromises extends BaseHullMod {
009
010        public static float RANGE_MULT = 0.8f;
011        public static float FLUX_MULT = 0.6f;
012        public static float ENERGY_WEAPON_FLUX_INCREASE = 100f;
013        public static float MISSILE_ROF_MULT = 0.5f;
014        public static float BALLISTIC_RANGE_MULT = 0.85f;
015        
016        public static boolean AlLOW_CONVERTED_HANGAR = true;
017        
018        public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
019                stats.getBallisticWeaponRangeBonus().modifyMult(id, BALLISTIC_RANGE_MULT);
020                stats.getMissileRoFMult().modifyMult(id, MISSILE_ROF_MULT);
021                stats.getEnergyWeaponFluxCostMod().modifyPercent(id, ENERGY_WEAPON_FLUX_INCREASE);
022                
023                stats.getFluxDissipation().modifyMult(id, FLUX_MULT);
024                stats.getFluxCapacity().modifyMult(id, FLUX_MULT);
025                stats.getSystemFluxCostBonus().modifyMult(id, FLUX_MULT);
026                
027                if (AlLOW_CONVERTED_HANGAR) {
028                        stats.getDynamic().getMod(Stats.FORCE_ALLOW_CONVERTED_HANGAR).modifyFlat(id, 1f);
029                        stats.getDynamic().getMod(Stats.CONVERTED_HANGAR_NO_CREW_INCREASE).modifyFlat(id, 1f);
030                        stats.getDynamic().getMod(Stats.CONVERTED_HANGAR_NO_REARM_INCREASE).modifyFlat(id, 1f);
031                        stats.getDynamic().getMod(Stats.CONVERTED_HANGAR_NO_REFIT_PENALTY).modifyFlat(id, 1f);
032                        //stats.getDynamic().getMod(Stats.CONVERTED_HANGAR_NO_DP_INCREASE).modifyFlat(id, 1f);
033                }
034        }
035
036
037        public String getDescriptionParam(int index, HullSize hullSize) {
038                if (index == 0) return "" + (int)Math.round((1f - FLUX_MULT) * 100f) + "%";
039                if (index == 1) return "" + (int)Math.round((1f - BALLISTIC_RANGE_MULT) * 100f) + "%";
040                if (index == 2) return "" + (int)Math.round((1f - MISSILE_ROF_MULT) * 100f) + "%";
041                if (index == 3) return "" + (int)Math.round(ENERGY_WEAPON_FLUX_INCREASE) + "%";
042                
043                if (index == 4) return "Converted Hangar";
044                if (index == 5) return "" + (int)Math.round(2);
045                return null;
046        }
047        
048}
049
050
051
052
053
054
055
056
057