1package com.fs.starfarer.api.impl.campaign.abilities;
3import java.util.ArrayList;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.Script;
10import com.fs.starfarer.api.campaign.CampaignFleetAPI;
11import com.fs.starfarer.api.campaign.FactionAPI;
12import com.fs.starfarer.api.campaign.rules.MemoryAPI;
13import com.fs.starfarer.api.impl.campaign.CoreReputationPlugin.RepActions;
14import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
15import com.fs.starfarer.api.ui.LabelAPI;
16import com.fs.starfarer.api.ui.TooltipMakerAPI;
17import com.fs.starfarer.api.util.Misc;
31 return "Transponder on";
49 if (!factions.isEmpty()) {
69 if (fleet ==
null)
return;
113 if (fleet ==
null)
return;
124 String status =
" (off)";
138 tooltip.
addPara(
"Transponders transmit identifying information to all fleets within range.", pad);
142 if (!factions.isEmpty()) {
143 String text =
"Turning the transponder on now would reveal your hostile actions to";
144 boolean first =
true;
145 boolean last =
false;
147 last = factions.indexOf(faction) == factions.size() - 1;
148 if (first || !last) {
149 text +=
" " + faction.getDisplayNameWithArticle() +
",";
151 text +=
" and " + faction.getDisplayNameWithArticle() +
",";
154 text = text.substring(0, text.length() - 1) +
".";
155 tooltip.
addPara(text, red, pad);
159 tooltip.
addPara(
"When the transponder is on, your fleet can be detected at longer range and " +
160 "full information on its composition is available at maximum range.", pad);
161 tooltip.
addPara(
"Transponder status also affects the reputation changes from combat and trade. " +
162 "With it turned off, you might be able to trade with otherwise inhospitable factions.", pad);
163 tooltip.
addPara(
"In most places, running with the transponder off will attract the attention of nearby patrols, " +
164 "although several factions and certain free ports allow it. " +
165 "Having the transponder off does not grant perfect anonymity.", pad);
174 boolean first =
true;
175 boolean last =
false;
177 last = factions.indexOf(faction) == factions.size() - 1;
178 if (first || !last) {
179 text +=
" " + faction.getDisplayNameLongWithArticle() +
",";
181 text +=
" and " + faction.getDisplayNameLongWithArticle() +
",";
184 text = text.substring(0, text.length() - 1) +
"";
198 List<FactionAPI> result =
new ArrayList<FactionAPI>();
200 if (fleet ==
null)
return result;
206 if (other.getFleetData().getNumMembers() <= 0)
continue;
216 if (dist > detectRange)
continue;
218 MemoryAPI mem = other.getMemoryWithoutUpdate();
222 if (!result.contains(other.getFaction()) &&
224 !other.getFaction().isHostileTo(fleet.
getFaction())) {
225 result.add(other.getFaction());
231 private transient boolean showAlarm =
false;
235 super.advance(amount);
240 sinceWarning += amount;
243 if (factions.isEmpty()) {
280 sinceWarning = 1000f;
284 transient float sinceWarning = 1000f;
292 if (!factions.isEmpty()) {
294 String text =
"Turning the transponder on will reveal your identity and make " + list +
" hostile.\n\n" +
295 "Are you sure you want to do this?";
302 sinceWarning = 1000f;
309 sinceWarning = 1000f;
315 sinceWarning = 1000f;
337 return "Transponder shutdown initiated - use again to deactivate";
341 return "Activating the transponder will reveal your identity - use again to confirm";
343 return "Transponder primed - use again to activate";
352 return super.getCooldownFraction();
373 if (sinceWarning < t) {
374 b = sinceWarning / t;
381 return super.getCooldownColor();
static boolean CODEX_TOOLTIP_MODE
static SectorAPI getSector()
void modifyMult(String source, float value)
void modifyFlat(String source, float value)
transient AbilitySpecAPI spec
CampaignFleetAPI getFleet()
void addIncompatibleToTooltip(TooltipMakerAPI tooltip, boolean expanded)
float getCooldownFraction()
void createTooltip(TooltipMakerAPI tooltip, boolean expanded)
String getDeactivationText()
boolean isCooldownRenderingAdditive()
static final float DETECTABILITY_MULT
static final float DETECTABILITY_FLAT
boolean showProgressIndicator()
String getActivationMessage()
String getActivationText()
void advance(float amount)
static List< FactionAPI > getFactionsThatWouldBecomeHostile(CampaignFleetAPI fleet)
List< FactionAPI > getFactionsThatWouldBecomeHostile()
static final float CONFIRM_DURATION
float getProgressFraction()
String getFactionList(List< FactionAPI > factions)
void applyEffect(float amount, float level)
String getDeactivationMessage()
static final String MEMORY_KEY_MAKE_HOSTILE_WHILE_TOFF
static final String JUST_TOGGLED_TRANSPONDER
static final String MEMORY_KEY_LOW_REP_IMPACT
static Color getNegativeHighlightColor()
static Color getGrayColor()
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static Color scaleAlpha(Color color, float factor)
static Color getHighlightColor()
LocationAPI getContainingLocation()
MutableFleetStatsAPI getStats()
boolean showConfirmDialog(String message, String ok, String cancel, Script onOk, Script onCancel)
void addMessage(String text)
MessageDisplayAPI getMessageDisplay()
FaderUtil getSharedFader()
List< CampaignFleetAPI > getFleets()
void addMessage(String text)
void removeMessage(String text)
ReputationAdjustmentResult adjustPlayerReputation(Object action, String factionId)
CampaignUIAPI getCampaignUI()
MemoryAPI getMemoryWithoutUpdate()
boolean isTransponderOn()
void setTransponderOn(boolean transponderOn)
void set(String key, Object value)
boolean getBoolean(String key)
StatBonus getDetectedRangeMod()
void setHighlightColor(Color color)
void highlightLast(String substring)