Starsector API
Loading...
Searching...
No Matches
LuddicKnightErrant.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.missions.luddic;
2
3import java.awt.Color;
4import java.util.List;
5import java.util.Map;
6
7import org.lwjgl.util.vector.Vector2f;
8
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.InteractionDialogAPI;
11import com.fs.starfarer.api.campaign.econ.MarketAPI;
12import com.fs.starfarer.api.campaign.rules.MemoryAPI;
13import com.fs.starfarer.api.characters.PersonAPI;
14import com.fs.starfarer.api.impl.campaign.econ.RecentUnrest;
15import com.fs.starfarer.api.impl.campaign.ids.Factions;
16import com.fs.starfarer.api.impl.campaign.ids.FleetTypes;
17import com.fs.starfarer.api.impl.campaign.ids.People;
18import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionWithSearch;
19import com.fs.starfarer.api.ui.TooltipMakerAPI;
20import com.fs.starfarer.api.util.Misc.Token;
21
23
24 public static enum Stage {
25 GO_TO_CHALCEDON,
26 CONTACT_RECRUITER,
27 GO_TO_MAZALOT,
28 CONTACT_VIRENS,
29 CONTACT_BORNANEW,
30 RETURN_TO_GILEAD,
31 RETURN_TO_GILEAD2,
32 COMPLETED,
33 }
34
36 protected PersonAPI jaspis;
38
40 protected MarketAPI mazalot;
41 protected MarketAPI gilead;
42
43 //public static float MISSION_DAYS = 120f;
44
45 //protected int payment;
46 //protected int paymentHigh;
47
48 @Override
49 protected boolean create(MarketAPI createdAt, boolean barEvent) {
50 // if already accepted by the player, abort
51 if (!setGlobalReference("$lke_ref", "$lke_inProgress")) {
52 return false;
53 }
54
56 if (chalcedon == null) return false;
57 if (!chalcedon.getFactionId().equals(Factions.LUDDIC_PATH)) return false;
58
60 if (gilead == null) return false;
61 if (!gilead.getFactionId().equals(Factions.LUDDIC_CHURCH)) return false;
62
64 if (mazalot == null) return false;
65 if (!mazalot.getFactionId().equals(Factions.PERSEAN)) return false;
66
68 if (bornanew == null) return false;
69
71 if (bornanew == null) return false;
72
74 if (nile_virens == null) return false;
75
77
78 setStartingStage(Stage.GO_TO_CHALCEDON);
79 makeImportant(chalcedon, "$lke_searchForBornanew", Stage.GO_TO_CHALCEDON);
80
81 setStageOnGlobalFlag(Stage.CONTACT_RECRUITER, "$lke_contactRecruiter");
82 makeImportant(chalcedon, "$lke_contactRecruiter", Stage.CONTACT_RECRUITER);
83
84 setStageOnGlobalFlag(Stage.GO_TO_MAZALOT, "$lke_gotBornanewLead");
85 makeImportant(mazalot, "$lke_searchForBornanew2", Stage.GO_TO_MAZALOT);
86
87 setStageOnGlobalFlag(Stage.CONTACT_VIRENS, "$lke_contactVirens");
88 makeImportant(mazalot, "$lke_contactVirens", Stage.CONTACT_VIRENS);
89
90 setStageOnGlobalFlag(Stage.CONTACT_BORNANEW, "$lke_contactBornanew");
91 makeImportant(mazalot, "$lke_contactBornanew", Stage.CONTACT_BORNANEW);
92
93 setStageOnGlobalFlag(Stage.RETURN_TO_GILEAD, "$lke_foundBornanew"); // he's alive
94 makeImportant(gilead, "$lke_returnWithBornanew", Stage.RETURN_TO_GILEAD);
95 makeImportant(jaspis, "$lke_returnWithBornanew", Stage.RETURN_TO_GILEAD);
96
97 setStageOnGlobalFlag(Stage.RETURN_TO_GILEAD2, "$lke_foundBornanew2"); // he's "dead"
98 makeImportant(gilead, "$lke_returnWithBornanewNews", Stage.RETURN_TO_GILEAD2);
99 makeImportant(jaspis, "$lke_returnWithBornanewNews", Stage.RETURN_TO_GILEAD2);
100
101 setStageOnGlobalFlag(Stage.COMPLETED, "$lke_completed");
102 addSuccessStages(Stage.COMPLETED);
103
104
105 setName("Knight Errant");
108
109 beginStageTrigger(Stage.COMPLETED);
110 triggerMakeNonStoryCritical("chalcedon", "mazalot", "gilead");
111 triggerSetGlobalMemoryValue("$lke_missionCompleted", true);
112 endTrigger();
113
114
115 // Spawn a Pather fleet near Chalcedon to spice things up.
116 //beginStageTrigger(Stage.GO_TO_CHALCEDON);
117 beginWithinHyperspaceRangeTrigger(chalcedon.getPlanetEntity(), 1f, false,Stage.GO_TO_CHALCEDON);
118 triggerCreateFleet(FleetSize.LARGE, FleetQuality.DEFAULT, Factions.LUDDIC_PATH, FleetTypes.PATROL_LARGE, chalcedon.getPlanetEntity());
122 triggerSpawnFleetAtPickedLocation("$lke_patherGoblins", null);
123 triggerSetFleetMissionRef("$lke_ref");
124
125 // if player is hostile to Path, Path fleet is hostile to player.
126 // if( Global.getSector().getFaction(Factions.LUDDIC_PATH).getRelToPlayer().isAtBest(RepLevel.HOSTILE) )
127 //{
128 // triggerMakeHostileAndAggressive();
129 //}
130
131 //triggerFleetSetPatrolLeashRange(1000f);
132 //triggerMakeFleetGoAwayAfterDefeat();
133 endTrigger();
134
135 // Luddic intercept fleet post-Chalcedon
136 beginWithinHyperspaceRangeTrigger(chalcedon, 3f, true, Stage.GO_TO_MAZALOT);
138 triggerSetFleetOfficers(OfficerNum.MORE, OfficerQuality.HIGHER);
141 triggerFleetMakeFaster(true, 2, true);
144 triggerSpawnFleetAtPickedLocation("$lke_patherIntercept", null);
147 triggerSetFleetMissionRef("$lke_ref");
148 triggerFleetMakeImportant(null, Stage.GO_TO_MAZALOT);
149 endTrigger();
150
151 return true;
152 }
153
154 protected void updateInteractionDataImpl() {
155 set("$lke_stage", getCurrentStage());
156 //set("$anh_robedman", robed_man);
157 }
158
159 @Override
160 protected boolean callAction(String action, String ruleId, final InteractionDialogAPI dialog,
161 List<Token> params, final Map<String, MemoryAPI> memoryMap) {
162// if ("THEDUEL".equals(action)) {
163// TextPanelAPI text = dialog.getTextPanel();
164// text.setFontOrbitronUnnecessarilyLarge();
165// Color color = Misc.getBasePlayerColor();
166// color = Global.getSector().getFaction(Factions.HEGEMONY).getBaseUIColor();
167// text.addPara("THE DUEL", color);
168// text.setFontInsignia();
169// text.addImage("misc", "THEDUEL");
170// return true;
171// }
172
173 if ("postMissionCleanup".equals(action)) {
174 // clean up any unneeded memory things.
175 //Global.getSector().getMemoryWithoutUpdate().unset("$lpp_didHesperusFirstShrineAttempt");
176 Global.getSector().getMemoryWithoutUpdate().unset("$global.lke_foundBornanew");
177
178 mazalot.getMemoryWithoutUpdate().unset("$market.dardanWontTalkLKE");
179
180 return true;
181 }
182 else if ("shootEm".equals(action))
183 {
184 Global.getSoundPlayer().playSound("storyevent_diktat_execution", 1, 1, Global.getSoundPlayer().getListenerPos(), new Vector2f());
185 return true;
186 }
187 else if ("resumeMusic".equals(action))
188 {
191 return true;
192 }
193 else if ("endMusic".equals(action))
194 {
197 //Global.getSoundPlayer().restartCurrentMusic();
198 return true;
199 }
200 else if ("playMusicCombat".equals(action))
201 {
202 Global.getSoundPlayer().playCustomMusic(1, 1, "music_combat", true);
203 return true;
204 }
205 else if ("playMusicSedge".equals(action))
206 {
207 Global.getSoundPlayer().playCustomMusic(1, 1, "music_luddite_encounter_hostile", true);
208 return true;
209 }
210 else if ("playMusicVirens".equals(action))
211 {
212 Global.getSoundPlayer().playCustomMusic(1, 1, "music_luddite_market_hostile", true);
213 return true;
214 }
215 else if ("playMusicJethro".equals(action))
216 {
217 Global.getSoundPlayer().playCustomMusic(1, 1, "music_luddite_market_friendly", true);
218 return true;
219 }
220 else if ("playMusicDardan".equals(action))
221 {
222 Global.getSoundPlayer().playCustomMusic(1, 1, "music_persean_league_market_hostile", true);
223 return true;
224 }
225 else if ("didMazalotRaid".equals(action))
226 {
227 RecentUnrest.get(mazalot).add(10, "Raided Mazalot and caused a Luddic uprising");
228 return true;
229 }
230 else if ("doCleanup".equals(action))
231 {
232
233 Global.getSector().getMemoryWithoutUpdate().unset("$lke_gotVirensContactFreebie");
234 Global.getSector().getMemoryWithoutUpdate().unset("$lke_didMazBarAgentEncounter");
235 chalcedon.getMemoryWithoutUpdate().unset("$lkeBuggedVIPs");
236 mazalot.getMemoryWithoutUpdate().unset("$lke_wontTellLied");
237 mazalot.getMemoryWithoutUpdate().unset("$lke_askedPMChurch");
238 mazalot.getMemoryWithoutUpdate().unset("$lkeSetUpVirensMeeting");
239 mazalot.getMemoryWithoutUpdate().unset("$dardanWontTalkLKE");
240
241 return true;
242 }
243
244 return super.callAction(action, ruleId, dialog, params, memoryMap);
245 }
246
247 /*
248 @Override
249 public void createSmallDescription(TooltipMakerAPI info, float width, float height) {
250 Color h = Misc.getHighlightColor();
251 Color g = Misc.getGrayColor();
252 float pad = 3f;
253 float opad = 10f;
254
255 FactionAPI faction = getFactionForUIColors();
256 PersonAPI person = getPerson();
257
258 //info.addImage(Global.getSettings().getSpriteName("illustrations", "luddic_shrine"), width, opad);
259
260 addDescriptionForCurrentStage(info, width, height);
261
262 addBulletPoints(info, ListInfoMode.IN_DESC);
263 }
264 */
265
266 @Override
267 public void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height) {
268 float opad = 10f;
269 //Color h = Misc.getHighlightColor();
270
271 //Color h2 = Misc.getDarkHighlightColor();
272 //FactionAPI church = Global.getSector().getFaction(Factions.LUDDIC_CHURCH);
273
274 //info.addImage(robed_man.getPortraitSprite(), width, 128, opad);
275
276 if (currentStage == Stage.GO_TO_CHALCEDON) {
277 info.addPara("Find Bornanew. His last mission was the infiltration of a Pather cell; someone must known something about where he is.", opad);
278 addStandardMarketDesc("Go to " + chalcedon.getOnOrAt(), chalcedon, info, opad);
279 }
280 else if (currentStage == Stage.CONTACT_RECRUITER) {
281 info.addPara("You have been told to meet with someone in a spacer bar on the surface of Chalcedon, presumably a recruiter for the Luddic Path.", opad);
282 addStandardMarketDesc("Go to " + chalcedon.getOnOrAt(), chalcedon, info, opad);
283 }
284 else if (currentStage == Stage.GO_TO_MAZALOT) {
285 info.addPara("A Pather, Sedge, claims that Jethro Bornanew travelled to Mazalot. Find him, or find where he has gone from there.", opad);
286 addStandardMarketDesc("Go to " + mazalot.getOnOrAt(), mazalot, info, opad);
287 }
288 else if (currentStage == Stage.CONTACT_VIRENS) {
289 info.addPara("Nile Virens runs the Luddic Path on Mazalot. If anyone knows where Bornanew is, it would be him or his organization. He might be persuaded to help by force or diplomacy.", opad);
290 addStandardMarketDesc("Contact Nile Virens " + mazalot.getOnOrAt(), mazalot, info, opad);
291 info.addImage(nile_virens.getPortraitSprite(), width, 128, opad);
292 info.addImage(nile_virens.getFaction().getCrest(), width, 128, opad);
293 }
294 else if (currentStage == Stage.CONTACT_BORNANEW) {
295 info.addPara("Nile Virens has provided you with the location of Jethro Bornanew, or so he claims. This consists of coordinates for a location on the surface of Mazalot, outside of a Luddic-majority settlement.", opad);
296 addStandardMarketDesc("Contact Jethro Bornanew " + mazalot.getOnOrAt(), mazalot, info, opad);
297 //info.addImage(bornanew.getPortraitSprite(), width, 128, opad);
298 }
299 else if (currentStage == Stage.RETURN_TO_GILEAD) {
300 info.addPara("Return with Jethro Bornanew to the office of Archcurate Jaspis.", opad);
301 addStandardMarketDesc("Go to " + gilead.getOnOrAt(), gilead, info, opad);
302 }
303 else if (currentStage == Stage.RETURN_TO_GILEAD2) {
304 info.addPara("Return to the office of Archcurate Jaspis with news of Jethro Bornanew's 'death'.", opad);
305 addStandardMarketDesc("Go to " + gilead.getOnOrAt(), gilead, info, opad);
306 }
307
308 }
309
310 @Override
311 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) {
312 //Color h = Misc.getHighlightColor();
313
314 if (currentStage == Stage.GO_TO_CHALCEDON) {
315 info.addPara("Go to Chalcedon and find Jethro Bornanew", tc, pad);
316 return true;
317 }
318 else if (currentStage == Stage.CONTACT_RECRUITER) {
319 info.addPara("Go to the spacer bar on Chalcedon and speak with the Luddic Path recruiter", tc, pad);
320 return true;
321 }
322 else if (currentStage == Stage.GO_TO_MAZALOT) {
323 info.addPara("Go to Mazalot and find Jethro Bornanew", tc, pad);
324 return true;
325 }
326 else if (currentStage == Stage.CONTACT_VIRENS) {
327 info.addPara("Talk to or raid Nile Virens on Mazalot", tc, pad);
328 return true;
329 }
330 else if (currentStage == Stage.CONTACT_BORNANEW) {
331 info.addPara("Go to the alleged location of Jethro Bornanew on Mazalot", tc, pad);
332 return true;
333 }
334 else if (currentStage == Stage.RETURN_TO_GILEAD) {
335 info.addPara("Return to Gilead with Bornanew", tc, pad);
336 return true;
337 }
338 else if (currentStage == Stage.RETURN_TO_GILEAD2) {
339 info.addPara("Return to Gilead with news of Bornanew's 'death'.", tc, pad);
340 return true;
341 }
342
343 return false;
344
345 /*
346 Color h = Misc.getHighlightColor();
347 if (currentStage == Stage.DROP_OFF) {
348 info.addPara("Deliver " + getWithoutArticle(thing) + " to specified location in the " +
349 system.getNameWithLowercaseTypeShort(), tc, pad);
350 return true;
351 }
352 */
353 }
354
355 @Override
356 public String getBaseName() {
357 return "Knight Errant";
358 }
359
360 @Override
361 public String getPostfixForState() {
362 if (startingStage != null) {
363 return "";
364 }
365 return super.getPostfixForState();
366 }
367}
368
369
370
371
372
static SoundPlayerAPI getSoundPlayer()
Definition Global.java:49
static SectorAPI getSector()
Definition Global.java:65
static RecentUnrest get(MarketAPI market)
void makeImportant(PersonAPI person, String flag, Enum ... stages)
static void addStandardMarketDesc(String prefix, MarketAPI market, TooltipMakerAPI info, float pad)
void triggerFleetMakeFaster(boolean navigationSkill, int numTugs, boolean allowLongPursuit)
void beginWithinHyperspaceRangeTrigger(SectorEntityToken entity, float rangeLY, boolean requirePlayerInHyperspace, Object ... stages)
void triggerPickLocationTowardsEntity(SectorEntityToken entity, float arc, float dist)
void triggerCreateFleet(FleetSize size, FleetQuality quality, String factionId, String type, StarSystemAPI roughlyWhere)
boolean callAction(String action, String ruleId, final InteractionDialogAPI dialog, List< Token > params, final Map< String, MemoryAPI > memoryMap)
boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad)
void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height)
void setSuspendDefaultMusicPlayback(boolean suspendMusicPlayback)
void playCustomMusic(int fadeOutIfAny, int fadeIn, String musicSetId)
SoundAPI playSound(String id, float pitch, float volume, Vector2f loc, Vector2f vel)
void addImage(String spriteName, float pad)
LabelAPI addPara(String format, float pad, Color hl, String... highlights)