1package com.fs.starfarer.api.impl.campaign.abilities;
4import java.util.ArrayList;
5import java.util.Iterator;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.CampaignFleetAPI;
10import com.fs.starfarer.api.campaign.PlanetAPI;
11import com.fs.starfarer.api.campaign.SectorEntityToken.VisibilityLevel;
12import com.fs.starfarer.api.campaign.econ.MarketAPI;
13import com.fs.starfarer.api.campaign.econ.MarketAPI.SurveyLevel;
14import com.fs.starfarer.api.impl.campaign.ids.Pings;
15import com.fs.starfarer.api.ui.LabelAPI;
16import com.fs.starfarer.api.ui.TooltipMakerAPI;
17import com.fs.starfarer.api.util.Misc;
30 if (
entity.isInCurrentLocation()) {
31 VisibilityLevel
level =
entity.getVisibilityLevelToPlayerFleet();
32 if (
level != VisibilityLevel.NONE) {
44 if (fleet ==
null)
return;
49 fleet.getStats().getFleetwideMaxBurnMod().modifyMult(
getModId(), 0f,
"Remote survey");
57 MarketAPI market = planet.getMarket();
58 SurveyLevel surveyLevel = market.getSurveyLevel();
59 if (market ==
null || (surveyLevel != SurveyLevel.SEEN && surveyLevel != SurveyLevel.NONE)) {
63 Misc.setPreliminarySurveyed(market,
null,
true);
72 if (!super.isUsable())
return false;
73 if (
getFleet() ==
null)
return false;
76 if (fleet.isInHyperspace() || fleet.isInHyperspaceTransition())
return false;
84 List<PlanetAPI> result =
new ArrayList<PlanetAPI>();
87 if (fleet ==
null)
return result;
88 if (fleet.isInHyperspace())
return result;
91 for (PlanetAPI planet : fleet.getContainingLocation().getPlanets()) {
92 if (planet.isStar())
continue;
93 if (planet.getMarket() ==
null)
continue;
97 float dist = Misc.getDistance(fleet.getLocation(), planet.getLocation());
108 Iterator<PlanetAPI> iter = result.iterator();
109 while (iter.hasNext()) {
110 PlanetAPI curr = iter.next();
111 SurveyLevel
level = curr.getMarket().getSurveyLevel();
112 if (
level != SurveyLevel.SEEN &&
level != SurveyLevel.NONE) {
128 CampaignFleetAPI fleet =
getFleet();
129 if (fleet ==
null)
return;
131 fleet.getStats().getDetectedRangeMod().unmodify(
getModId());
132 fleet.getStats().getFleetwideMaxBurnMod().unmodify(
getModId());
133 fleet.getStats().getAccelerationMult().unmodify(
getModId());
140 CampaignFleetAPI fleet =
getFleet();
141 if (fleet ==
null)
return;
143 Color gray = Misc.getGrayColor();
144 Color highlight = Misc.getHighlightColor();
145 Color bad = Misc.getNegativeHighlightColor();
147 LabelAPI title = tooltip.addTitle(
spec.getName());
152 tooltip.addPara(
"Coordinate the fleet's active sensor network to perform a preliminary survey of all unsurveyed planets within %s* units.",
156 tooltip.addPara(
"Increases the range at which the fleet can be detected by %s* units and brings the fleet to a near-stop as drives are powered down to reduce interference.",
164 if (planets.isEmpty()) {
166 tooltip.addPara(
"No planets in range.", bad, pad);
168 tooltip.addPara(
"You have either full or preliminary survey data for all planets in range.", bad, pad);
171 tooltip.addPara(
"The following unsurveyed planets are in range:", pad);
192 for (PlanetAPI planet : planets) {
194 LabelAPI label = tooltip.addPara(indent + planet.getName() +
", %s",
195 currPad, planet.getSpec().getIconColor(),
196 planet.getTypeNameWithWorld().toLowerCase());
207 tooltip.addPara(
"*2000 units = 1 map grid cell", gray, pad);
static SectorAPI getSector()
transient AbilitySpecAPI spec
CampaignFleetAPI getFleet()
void addIncompatibleToTooltip(TooltipMakerAPI tooltip, boolean expanded)
static final float DETECTABILITY_RANGE_BONUS
void applyEffect(float amount, float level)
void createTooltip(TooltipMakerAPI tooltip, boolean expanded)
List< PlanetAPI > getSurveyableInRange()
static final float SURVEY_RANGE
List< PlanetAPI > getAllPlanetsInRange()
static final float ACCELERATION_MULT