1package com.fs.starfarer.api.impl.campaign.missions;
7import com.fs.starfarer.api.Global;
8import com.fs.starfarer.api.campaign.CampaignFleetAPI;
9import com.fs.starfarer.api.campaign.InteractionDialogAPI;
10import com.fs.starfarer.api.campaign.PlanetAPI;
11import com.fs.starfarer.api.campaign.SectorEntityToken;
12import com.fs.starfarer.api.campaign.StarSystemAPI;
13import com.fs.starfarer.api.campaign.econ.MarketAPI;
14import com.fs.starfarer.api.campaign.rules.MemoryAPI;
15import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionWithSearch;
16import com.fs.starfarer.api.impl.campaign.procgen.themes.MiscellaneousThemeGenerator;
17import com.fs.starfarer.api.ui.SectorMapAPI;
18import com.fs.starfarer.api.ui.TooltipMakerAPI;
19import com.fs.starfarer.api.util.Misc;
20import com.fs.starfarer.api.util.Misc.Token;
24 public static enum Stage {
32 return Global.
getSector().getMemoryWithoutUpdate().getBoolean(
"$pk_startedAtPather");
35 return Global.
getSector().getMemoryWithoutUpdate().getBoolean(
"$pk_startedAtNexus");
38 return Global.
getSector().getMemoryWithoutUpdate().getBoolean(
"$pk_gotDataFromMysteryAI");
41 return (CampaignFleetAPI)
Global.
getSector().getPersistentData().get(MiscellaneousThemeGenerator.PK_NEXUS_KEY);
45 if (nexus !=
null && nexus.isAlive()) {
46 return nexus.getStarSystem();
52 if (p ==
null)
return null;
56 return (PlanetAPI)
Global.
getSector().getPersistentData().get(MiscellaneousThemeGenerator.PK_PLANET_KEY);
59 return (StarSystemAPI)
Global.
getSector().getPersistentData().get(MiscellaneousThemeGenerator.PK_SYSTEM_KEY);
63 protected boolean create(MarketAPI createdAt,
boolean barEvent) {
65 setPersonOverride(
null);
70 if (!setGlobalReference(
"$pk_ref",
"$pk_inProgress")) {
75 if (nexus !=
null && nexus.isAlive()) {
76 makeImportant(nexus,
"$pk_nexus", Stage.GO_TO_NEXUS);
80 setStartingStage(Stage.RECOVER_PK);
82 if (nexus ==
null || !nexus.isAlive() ||
getNexusSystem() ==
null) {
85 setStartingStage(Stage.GO_TO_NEXUS);
88 setSuccessStage(Stage.COMPLETED);
89 setFailureStage(Stage.FAILED);
94 setRepPenaltyFaction(0f);
95 setRepPenaltyPerson(0f);
97 connectWithGlobalFlag(Stage.GO_TO_NEXUS, Stage.RECOVER_PK,
"$pk_nexusDataGained");
99 connectWithEntityNotAlive(Stage.GO_TO_NEXUS, Stage.RECOVER_PK, nexus);
101 setStageOnGlobalFlag(Stage.COMPLETED,
"$pk_completed");
103 beginStageTrigger(Stage.COMPLETED);
104 triggerSetGlobalMemoryValue(
"$pk_recovered",
true);
105 triggerSetGlobalMemoryValue(
"$pk_missionCompleted",
true);
113 if (currentStage == Stage.RECOVER_PK) {
116 return super.getMapLocation(map, currentStage);
126 protected void endFailureImpl(InteractionDialogAPI dialog, Map<String, MemoryAPI> memoryMap) {
127 if (currentStage == Stage.FAILED) {
134 CampaignFleetAPI nexus =
getNexus();
138 if (getCurrentStage() !=
null) {
139 set(
"$pk_stage", ((Enum)getCurrentStage()).name());
143 set(
"$pk_nexusSystemName", ns.getNameWithLowercaseTypeShort());
146 set(
"$pk_pkSystemName", pks.getNameWithLowercaseTypeShort());
153 Color h = Misc.getHighlightColor();
154 if (currentStage == Stage.GO_TO_NEXUS) {
157 info.addPara(
"Recover information about a Hegemony fleet last seen in a Tri-Tachyon held "
158 +
"system during the first AI War, more than a hundred cycles ago. The fleet is rumored to "
159 +
"have been carrying a planetkiller weapon.", opad);
160 info.addPara(
"The information should be contained in the data banks of a remnant Nexus"
161 +
" located in the " +
162 ns.getNameWithLowercaseType() +
".", opad);
164 }
else if (currentStage == Stage.RECOVER_PK) {
168 info.addPara(
"You've destroyed a remnant Nexus and recovered information about "
169 +
"a Hegemony fleet estimated to be carrying a planetkiller weapon.", opad);
170 info.addPara(
"A log entry records "
171 +
"a large Ordo sent in pursuit; its last hyperwave report placed it "
172 +
"near the " + pks.getNameWithLowercaseTypeShort() +
173 ". The log entry dates to the first AI War, more than a hundred cycles ago", opad);
175 info.addPara(
"A mysterious voice, some kind of AI, provided you with coordinates for the " + pks.getNameWithLowercaseTypeShort() +
", and implied that the planetkiller weapon could be found there.", opad);
176 info.addPara(
"Perhaps it brings 'much amusement' to this AI to not provide more detailed instructions.", opad);
179 info.addPara(
"The data banks of the remnant Nexus contained information about the Hegemony fleet rumored "
180 +
"to be carrying a planetkiller weapon. ", opad);
181 info.addPara(
"A log entry records "
182 +
"a large Ordo sent in pursuit; its last hyperwave report placed it "
183 +
"near the " + pks.getNameWithLowercaseTypeShort() +
184 ". The log entry dates to the first AI War, more than a hundred cycles ago", opad);
187 }
else if (currentStage == Stage.FAILED) {
194 Color h = Misc.getHighlightColor();
195 if (currentStage == Stage.GO_TO_NEXUS) {
198 info.addPara(
"Recover information from remnant Nexus in the " + ns.getNameWithLowercaseTypeShort(), tc, pad);
201 }
else if (currentStage == Stage.RECOVER_PK) {
204 info.addPara(
"Investigate the " + pks.getNameWithLowercaseTypeShort(), tc, pad);
217 if (startingStage !=
null) {
220 return super.getPostfixForState();
224 return "The Scythe of Orion";
231 public void acceptImpl(InteractionDialogAPI dialog, Map<String, MemoryAPI> memoryMap) {
232 super.acceptImpl(dialog, memoryMap);
238 super.notifyEnding();
243 protected boolean callAction(String action, String ruleId, InteractionDialogAPI dialog, List<Token> params,
244 Map<String, MemoryAPI> memoryMap) {
245 if (action.equals(
"showNexusSystem")) {
247 if (system !=
null) {
248 dialog.getVisualPanel().showMapMarker(system.getHyperspaceAnchor(),
249 system.getNameWithLowercaseTypeShort(), getFactionForUIColors().getBaseUIColor(),
250 true, getIcon(),
null, getIntelTags(
null));
253 }
else if (action.equals(
"hideNexusSystem")) {
254 dialog.getVisualPanel().removeMapMarkerFromPersonInfo();
257 return super.callAction(action, ruleId, dialog, params, memoryMap);
static SectorAPI getSector()
static boolean gotDataFromMysteryAI()
boolean create(MarketAPI createdAt, boolean barEvent)
static CampaignFleetAPI getNexus()
String getMissionTypeNoun()
void endFailureImpl(InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
SectorEntityToken getMapLocation(SectorMapAPI map, Object currentStage)
static StarSystemAPI getPKSystem()
void updateInteractionDataImpl()
static boolean startedAtNexus()
boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad)
void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height)
StarSystemAPI getNexusSystem()
boolean callAction(String action, String ruleId, InteractionDialogAPI dialog, List< Token > params, Map< String, MemoryAPI > memoryMap)
static boolean startedAtPather()
static MarketAPI getTundraMarket()
void acceptImpl(InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
static PlanetAPI getTundra()
String getPostfixForState()