001package com.fs.starfarer.api.impl.campaign.skills;
002
003import java.awt.Color;
004
005import com.fs.starfarer.api.characters.CharacterStatsSkillEffect;
006import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
007import com.fs.starfarer.api.characters.SkillSpecAPI;
008import com.fs.starfarer.api.impl.campaign.ids.Stats;
009import com.fs.starfarer.api.ui.TooltipMakerAPI;
010import com.fs.starfarer.api.util.Misc;
011
012public class IndustrialPlanning {
013        
014        public static int SUPPLY_BONUS = 1;
015        public static float CUSTOM_PRODUCTION_BONUS = 50f;
016        
017        public static class Level1 implements CharacterStatsSkillEffect {
018                public void apply(MutableCharacterStatsAPI stats, String id, float level) {
019                        stats.getDynamic().getMod(Stats.SUPPLY_BONUS_MOD).modifyFlat(id, SUPPLY_BONUS);
020                }
021
022                public void unapply(MutableCharacterStatsAPI stats, String id) {
023                        stats.getDynamic().getMod(Stats.SUPPLY_BONUS_MOD).unmodifyFlat(id);
024                }
025                
026                public String getEffectDescription(float level) {
027                        return "All industries supply " + SUPPLY_BONUS + " more unit of all the commodities they produce";
028                }
029                
030                public String getEffectPerLevelDescription() {
031                        return null;
032                }
033
034                public ScopeDescription getScopeDescription() {
035                        return ScopeDescription.GOVERNED_OUTPOST;
036                }
037        }
038        
039        public static class Level2 extends BaseSkillEffectDescription implements CharacterStatsSkillEffect {
040                public void apply(MutableCharacterStatsAPI stats, String id, float level) {
041                        //stats.getDynamic().getMod(Stats.CUSTOM_PRODUCTION_MOD).modifyPercent(id, CUSTOM_PRODUCTION_BONUS, "Industrial planning");
042                        stats.getDynamic().getMod(Stats.CUSTOM_PRODUCTION_MOD).modifyMult(id, 1f + CUSTOM_PRODUCTION_BONUS/100f, "Industrial planning");
043                }
044
045                public void unapply(MutableCharacterStatsAPI stats, String id) {
046                        //stats.getDynamic().getMod(Stats.CUSTOM_PRODUCTION_MOD).unmodifyPercent(id);
047                        stats.getDynamic().getMod(Stats.CUSTOM_PRODUCTION_MOD).unmodifyMult(id);
048                }
049                
050                public void createCustomDescription(MutableCharacterStatsAPI stats, SkillSpecAPI skill, 
051                                                                                        TooltipMakerAPI info, float width) {
052                        init(stats, skill);
053                        float opad = 10f;
054                        Color c = Misc.getBasePlayerColor();
055                        info.addPara("Affects: %s", opad + 5f, Misc.getGrayColor(), c, "all colonies");
056                        info.addSpacer(opad);
057                        info.addPara("+%s maximum value of custom ship and weapon production per month", 0f, hc, hc,
058                                        "" + (int) CUSTOM_PRODUCTION_BONUS + "%");
059                }
060                
061                public ScopeDescription getScopeDescription() {
062                        return ScopeDescription.ALL_OUTPOSTS;
063                }
064        }
065        
066//      public static class Level1A implements CharacterStatsSkillEffect {
067//
068//              public void apply(MutableCharacterStatsAPI stats, String id, float level) {
069//                      stats.getDynamic().getMod(Stats.DEMAND_REDUCTION_MOD).modifyFlat(id, DEMAND_REDUCTION);
070//              }
071//
072//              public void unapply(MutableCharacterStatsAPI stats, String id) {
073//                      stats.getDynamic().getMod(Stats.DEMAND_REDUCTION_MOD).unmodifyFlat(id);
074//              }
075//              
076//              public String getEffectDescription(float level) {
077//                      return "All industries require " + DEMAND_REDUCTION + " less unit of all the commodities they need";
078//              }
079//              
080//              public String getEffectPerLevelDescription() {
081//                      return null;
082//              }
083//
084//              public ScopeDescription getScopeDescription() {
085//                      return ScopeDescription.GOVERNED_OUTPOST;
086//              }
087//      }
088//      
089//      public static class Level1B implements MarketSkillEffect {
090//              public void apply(MarketAPI market, String id, float level) {
091//                      market.getUpkeepMult().modifyMult(id, UPKEEP_MULT, "Industrial planning");
092//              }
093//
094//              public void unapply(MarketAPI market, String id) {
095//                      market.getUpkeepMult().unmodifyMult(id);
096//              }
097//              
098//              public String getEffectDescription(float level) {
099//                      return "-" + (int)Math.round(Math.abs((1f - UPKEEP_MULT)) * 100f) + "% upkeep for colonies";
100//              }
101//              
102//              public String getEffectPerLevelDescription() {
103//                      return null;
104//              }
105//
106//              public ScopeDescription getScopeDescription() {
107//                      return ScopeDescription.GOVERNED_OUTPOST;
108//              }
109//      }
110//      
111//      public static class Level3A implements MarketSkillEffect {
112//              public void apply(MarketAPI market, String id, float level) {
113//                      market.getIncomeMult().modifyMult(id, INCOME_MULT, "Industrial planning");
114//              }
115//
116//              public void unapply(MarketAPI market, String id) {
117//                      market.getIncomeMult().unmodifyMult(id);
118//              }
119//              
120//              public String getEffectDescription(float level) {
121//                      return "+" + (int)Math.round((INCOME_MULT - 1f) * 100f) + "% income from colonies, including exports";
122//              }
123//              
124//              public String getEffectPerLevelDescription() {
125//                      return null;
126//              }
127//
128//              public ScopeDescription getScopeDescription() {
129//                      return ScopeDescription.GOVERNED_OUTPOST;
130//              }
131//      }
132        
133//      public static void main(String[] args) {
134//              System.out.println((int)((1.331 - 1.) * 1000.));
135//      }
136        
137}
138
139