Starsector API
Loading...
Searching...
No Matches
BasicExampleGADataFromRuins.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.missions.academy;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.campaign.PlanetAPI;
6import com.fs.starfarer.api.campaign.econ.MarketAPI;
7import com.fs.starfarer.api.impl.campaign.ids.Factions;
8import com.fs.starfarer.api.impl.campaign.ids.FleetTypes;
9import com.fs.starfarer.api.impl.campaign.ids.Tags;
10import com.fs.starfarer.api.impl.campaign.missions.hub.ReqMode;
11import com.fs.starfarer.api.ui.TooltipMakerAPI;
12import com.fs.starfarer.api.util.Misc;
13
15
16// public static class GADataFromRuinsCreator extends BaseHubMissionCreator {
17// @Override
18// public HubMission createHubMission(MissionHub hub) {
19// return new BasicExampleGADataFromRuins();
20// }
21// }
22
23 public static float MISSION_DAYS = 120f;
24
25 public static enum Stage {
26 GO_TO_RUINS,
27 GET_IN_COMMS_RANGE,
28 COMPLETED,
29 FAIL_TIME,
30 }
31
32 protected PlanetAPI planet;
33 protected String target;
34
35 @Override
36 protected boolean create(MarketAPI createdAt, boolean barEvent) {
37 // if this mission type was already accepted by the player, abort
38 if (!setGlobalReference("$gaData_ref")) {
39 return false;
40 }
41
43 target = pickOne("library", "datavault", "archive", "laboratory");
44
45 requireSystemTags(ReqMode.ANY, Tags.THEME_REMNANT_RESURGENT, Tags.THEME_REMNANT_SUPPRESSED,
46 Tags.THEME_DERELICT, Tags.THEME_MISC, Tags.THEME_RUINS);
47 requireSystemTags(ReqMode.NOT_ANY, Tags.THEME_REMNANT_SECONDARY);
48 //requireSystemInInnerSector();
49 requirePlanetUnpopulated();
50 requirePlanetWithRuins();
51 preferPlanetNotFullySurveyed();
52 preferPlanetUnexploredRuins();
53 planet = pickPlanet();
54
55 if (planet == null) {
56 return false;
57 }
58
59 setStartingStage(Stage.GO_TO_RUINS);
60 addSuccessStages(Stage.COMPLETED);
61 addFailureStages(Stage.FAIL_TIME);
62
63 connectWithGlobalFlag(Stage.GO_TO_RUINS, Stage.GET_IN_COMMS_RANGE, "$gaData_gotData");
64 connectWithInRangeOfCommRelay(Stage.GET_IN_COMMS_RANGE, Stage.COMPLETED);
65
66 makeImportant(planet, "$gaData_targetPlanet", Stage.GO_TO_RUINS);
67
68 setTimeLimit(Stage.FAIL_TIME, MISSION_DAYS, planet.getStarSystem(), Stage.GET_IN_COMMS_RANGE);
69 //setCreditReward(30000, 60000);
70 setCreditReward(CreditReward.AVERAGE);
71
72 beginWithinHyperspaceRangeTrigger(planet, 1f, false, Stage.GO_TO_RUINS);
73 triggerCreateFleet(FleetSize.MEDIUM, FleetQuality.DEFAULT, Factions.PIRATES, FleetTypes.PATROL_MEDIUM, planet);
74 triggerSetStandardAggroPirateFlags();
75 //triggerPickLocationAroundEntity(planet, 3000f);
76 triggerPickLocationAtInSystemJumpPoint(planet.getStarSystem());
77 triggerSpawnFleetAtPickedLocation("$gaData_pirate", null);
78 triggerOrderFleetPatrol(planet);
79 endTrigger();
80
81 return true;
82 }
83
84 protected void updateInteractionDataImpl() {
85 set("$gaData_department", department);
86 set("$gaData_target", target);
87 set("$gaData_planetName", planet.getName());
88 set("$gaData_systemName", planet.getStarSystem().getNameWithNoType());
89 set("$gaData_dist", getDistanceLY(planet));
90 set("$gaData_reward", Misc.getWithDGS(getCreditsReward()));
91 }
92
93 @Override
94 public void addDescriptionForCurrentStage(TooltipMakerAPI info, float width, float height) {
95 float opad = 10f;
96 Color h = Misc.getHighlightColor();
97 if (currentStage == Stage.GO_TO_RUINS) {
98 info.addPara("Go to " + planet.getName() + " and retrieve the data from the ruins.", opad);
99 } else if (currentStage == Stage.GET_IN_COMMS_RANGE) {
100 info.addPara("Get within range of a functional comm relay to complete the mission and receive " +
101 "your reward.", opad);
102 } else {
103 super.addDescriptionForCurrentStage(info, width, height);
104 }
105 }
106
107 @Override
108 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) {
109 Color h = Misc.getHighlightColor();
110 if (currentStage == Stage.GO_TO_RUINS) {
111 info.addPara("Go to " + planet.getName() + "", tc, pad);
112 return true;
113 } else if (currentStage == Stage.GET_IN_COMMS_RANGE) {
114 info.addPara("Get within comms range to complete the mission", tc, pad);
115 return true;
116 }
117 return false;
118 }
119
120 @Override
121 public String getBaseName() {
122 return "Ruins Data Recovery";
123 }
124
125 @Override
126 public String getBlurbText() {
127 return null; // this should be done via rules.csv
128// return "The " + department + " department has turned up records of a data cache on " +
129// planet.getName() + " in the " + planet.getStarSystem().getNameWithNoType() + " system; " +
130// "they just need someone to go find it and transmit the contents back to the Academy.";
131 }
132
133}
134
135