001package com.fs.starfarer.api.impl.campaign.intel.bases;
002
003import java.awt.Color;
004
005import com.fs.starfarer.api.Global;
006import com.fs.starfarer.api.impl.campaign.econ.BaseMarketConditionPlugin;
007import com.fs.starfarer.api.impl.campaign.ids.Factions;
008import com.fs.starfarer.api.ui.TooltipMakerAPI;
009
010public class LuddicPathCells extends BaseMarketConditionPlugin {
011
012        public static int STABLITY_PENALTY = 1;
013        
014        protected LuddicPathCellsIntel intel;
015        
016        public LuddicPathCells() {
017        }
018
019        @Override
020        public void setParam(Object param) {
021                intel = (LuddicPathCellsIntel) param;
022        }
023        
024        public LuddicPathCellsIntel getIntel() {
025                return intel;
026        }
027
028        public void apply(String id) {
029                if (!intel.isSleeper()) {
030                        float stability = STABLITY_PENALTY;
031                        String name = "Active Luddic Path cells";
032                        if (stability != 0) {
033                                market.getStability().modifyFlat(id, -stability, name);
034                        }
035                }
036        }
037
038        public void unapply(String id) {
039                market.getStability().unmodifyFlat(id);
040        }
041        
042        
043        @Override
044        public void advance(float amount) {
045                
046        }
047
048        @Override
049        public String getIconName() {
050                return intel.getIcon();
051        }
052
053        @Override
054        public String getName() {
055                return intel.getName();
056        }
057
058
059        @Override
060        public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) {
061                
062                //Color color = market.getTextColorForFactionOrPlanet();
063                Color color = Global.getSector().getFaction(Factions.LUDDIC_PATH).getBaseUIColor();
064                tooltip.addTitle(condition.getName(), color);
065                
066                intel.createSmallDescription(tooltip, 0, 0);
067        }
068
069//      @Override
070//      public void createTooltipAfterDescription(TooltipMakerAPI tooltip, boolean expanded) {
071//              Color h = Misc.getHighlightColor();
072//              Color n = Misc.getNegativeHighlightColor();
073//              
074//              float pad = 3f;
075//              float small = 5f;
076//              float opad = 10f;
077//              
078//
079//              if (!intel.isSleeper()) {
080//                      float stability = STABLITY_PENALTY;
081//                      tooltip.addPara("%s stability. Possibility of various acts of terror and sabotage, " +
082//                                      "if smugglers from a Luddic Path base are able to provide material support.", 
083//                                      opad, h,
084//                                      "-" + (int)stability);
085//              } else {
086//                      tooltip.addPara("No perceptible impact on operations as of yet.", opad);
087//              }
088//      }
089
090        @Override
091        public float getTooltipWidth() {
092                return super.getTooltipWidth();
093        }
094
095        @Override
096        public boolean hasCustomTooltip() {
097                return true;
098        }
099
100        @Override
101        public boolean isTooltipExpandable() {
102                return super.isTooltipExpandable();
103        }
104
105        @Override
106        public boolean isTransient() {
107                return false;
108        }
109
110}
111
112
113
114
115