1package com.fs.starfarer.api.impl.campaign.abilities;
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.campaign.CampaignFleetAPI;
7import com.fs.starfarer.api.fleet.FleetMemberViewAPI;
8import com.fs.starfarer.api.ui.Alignment;
9import com.fs.starfarer.api.ui.LabelAPI;
10import com.fs.starfarer.api.ui.TooltipMakerAPI;
11import com.fs.starfarer.api.util.Misc;
46 return "Drive field polarity reversed";
52 if (!super.isUsable())
return false;
53 if (
getFleet() ==
null)
return false;
57 if (!fleet.isInHyperspace())
return false;
65 if (fleet ==
null)
return;
67 if (fleet.getContainingLocation() ==
null || !fleet.getContainingLocation().isHyperspace()) {
87 if (fleet ==
null)
return;
89 Color c =
new Color(255,0,255,255);
90 Color cDim =
new Color(255,0,255,50);
91 Color cDim2 =
new Color(255,0,255,120);
92 for (FleetMemberViewAPI view : fleet.getViews()) {
94 view.getContrailColor().shift(
getModId(), cDim2, 1f, 1f, .75f);
95 view.getEngineGlowColor().shift(
getModId(), cDim, 1f, 1f, .5f);
96 view.getEngineGlowSizeMult().shift(
getModId(), 3f, 1f, 1f, 1f);
104 CampaignFleetAPI fleet =
getFleet();
105 if (fleet ==
null)
return false;
106 return Misc.isInsideSlipstream(fleet);
111 CampaignFleetAPI fleet =
getFleet();
112 if (fleet ==
null)
return;
114 Color gray = Misc.getGrayColor();
115 Color highlight = Misc.getHighlightColor();
117 String status =
" (off)";
122 LabelAPI title = tooltip.addTitle(
"Reverse Polarity" + status);
123 title.highlightLast(status);
124 title.setHighlightColor(gray);
129 tooltip.addPara(
"Reverse the polarity of the drive field, causing the fleet to travel "
130 +
"against the current of slipstreams.", pad);
133 tooltip.addPara(
"Going against the current is less efficient and results in "
134 +
"the slipstream current's effect being reduced by %s.", pad,
140 tooltip.addPara(
"When used outside a slipstream, incurs no cost, penalty, or risk of ship damage.", pad);
142 tooltip.addSectionHeading(
"Use inside slipstreams", Alignment.MID, pad);
143 addCostTooltipSection(tooltip, expanded,
"An emergency maneuver when performed inside a slipstream, "
144 +
"reversing drive field polarity");
153 CampaignFleetAPI fleet =
getFleet();
154 if (fleet ==
null)
return;
156 Color bad = Misc.getNegativeHighlightColor();
157 if (!fleet.isInHyperspace()) {
158 tooltip.addPara(
"Can only be used in hyperspace.", bad, 10f);
171 Color color = Misc.getNegativeHighlightColor();
172 if (!super.showAlarm()) {
173 color = Misc.getHighlightColor();
175 return Misc.scaleAlpha(color,
Global.
getSector().getCampaignUI().getSharedFader().getBrightness() * 0.5f);
177 return super.getCooldownColor();
static SectorAPI getSector()
CampaignFleetAPI getFleet()
void addIncompatibleToTooltip(TooltipMakerAPI tooltip, boolean expanded)
float getDeactivationDays()
float getCRCostMult(boolean forTooltip)
static String POLARITY_SPEED_MULT
static String POLARITY_WIND_GLOW_COLOR_KEY
static String REVERSED_POLARITY
String getActivationText()
static float ACTIVATION_DAMAGE_PROB
void createTooltip(TooltipMakerAPI tooltip, boolean expanded)
boolean isFleetInSlipstream()
float getFuelCostMult(boolean forTooltip)
static float CR_COST_MULT
void applyStatsEffect(float amount, float level)
void addOtherNotUsableReason(TooltipMakerAPI tooltip, boolean expanded)
static Color POLARITY_WIND_GLOW_COLOR
boolean canRecoverCRWhileActive(boolean forTooltip)
static float SLIPSTREAM_SPEED_MULT
static float FUEL_COST_MULT
void applyFleetVisual(float amount, float level)
void addCostTooltipSection(TooltipMakerAPI tooltip, boolean expanded, String prefix)