Starsector API
Loading...
Searching...
No Matches
RuinsDataSwapMission.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.missions;
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.characters.PersonAPI;
8import com.fs.starfarer.api.impl.campaign.ids.Conditions;
9import com.fs.starfarer.api.impl.campaign.ids.Tags;
10import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionWithBarEvent;
11import com.fs.starfarer.api.impl.campaign.missions.hub.ReqMode;
12import com.fs.starfarer.api.ui.TooltipMakerAPI;
13import com.fs.starfarer.api.util.Misc;
14
16
17 //public static float PIRATE_PROB = 0.5f;
18 public static float MISSION_DAYS = 120f;
19 public static int RAID_DIFFICULTY = 60;
20 public static int MARINES_REQUIRED = RAID_DIFFICULTY / 2;
21
22
23 public static enum Stage {
24 GO_TO_RUINS,
25 RETURN,
26 COMPLETED,
27 FAILED,
28 }
29
30 public static enum Variation {
31 BASIC,
32 DECIV,
33 }
34
35 protected MarketAPI market;
36 protected PersonAPI person;
37 protected PlanetAPI planet;
38 protected String targetWithArticle;
39 protected String target;
40 protected String megacorp;
41 protected Variation variation;
42 //protected int piratePayment;
43
44 @Override
45 protected boolean create(MarketAPI createdAt, boolean barEvent) {
46 // if this mission type was already accepted by the player, abort
47 if (!setGlobalReference("$rdsm_ref")) {
48 return false;
49 }
50
51 targetWithArticle = pickOne("a library", "a datavault", "an archive", "a laboratory");
52 target = targetWithArticle.substring(targetWithArticle.indexOf(" ") + 1);
53
54 megacorp = pickOne("Fabrique Orbitale", "Bhilai Exospace", "Hastaeus Industries", "Exogen Systems", "Ursa Group");
55
59 //requireSystemInInnerSector();
60 //requireSystemHasPulsar();
61 //requireSystemIsDense();
62 //requirePlanetIsGasGiant();
63 //requirePlanetConditions(ReqMode.ALL, Conditions.DECIVILIZED);
70
71// spawnEntity(Entities.INACTIVE_GATE, "$gaData_test", EntityLocationType.ORBITING_PARAM,
72// planet, planet.getStarSystem(), false);
73// spawnMissionNode("$gaData_test", EntityLocationType.ORBITING_PARAM, planet, planet.getStarSystem());
74
75 if (planet == null) return false;
76
77 person = getPerson();
78 if (person == null) return false;
79
81 if (market == null) return false;
82
83 setStartingStage(Stage.GO_TO_RUINS);
84 addSuccessStages(Stage.COMPLETED);
85 addFailureStages(Stage.FAILED);
86
87 makeImportant(planet, "$rdsm_targetPlanet", Stage.GO_TO_RUINS);
88 makeImportant(person, "$rdsm_contact", Stage.RETURN);
89
90 connectWithGlobalFlag(Stage.GO_TO_RUINS, Stage.RETURN, "$rdsm_gotData");
91 connectWithGlobalFlag(Stage.RETURN, Stage.COMPLETED, "$rdsm_returnedData");
92
93 //setNoAbandon();
94 setTimeLimit(Stage.FAILED, MISSION_DAYS, null, Stage.RETURN);
95
96 setCreditReward(CreditReward.AVERAGE);
97
98// spawnEntity(Entities.FUSION_LAMP, "$gaData_test", EntityLocationType.ORBITING_PARAM,
99// planet, planet.getStarSystem(), false);
100
101// beginStageTrigger(Stage.GET_IN_COMMS_RANGE);
102// triggerSpawnEntity(Entities.INACTIVE_GATE, "$gaData_test", EntityLocationType.ORBITING_PARAM,
103// planet, planet.getStarSystem(), false);
104// triggerEntityMakeImportant();
105// endTrigger();
106
107 //StarSystemAPI system = planet.getStarSystem();
109 variation = Variation.DECIV;
110 } else {
111 variation = Variation.BASIC;
112 }
113
114 return true;
115 }
116
117 protected void updateInteractionDataImpl() {
118 set("$rdsm_contactName", person.getNameString());
119 set("$rdsm_megacorpName", megacorp);
120 set("$rdsm_market", market.getName());
121 set("$rdsm_target", target);
122 set("$rdsm_planetId", planet.getId());
123 set("$rdsm_planetName", planet.getName());
124 set("$rdsm_systemName", planet.getStarSystem().getNameWithLowercaseType());
125 set("$rdsm_dist", getDistanceLY(planet));
126 set("$rdsm_reward", Misc.getWithDGS(getCreditsReward()));
127 //set("$gaData_piratePayment", Misc.getWithDGS(piratePayment));
128 //variation = Variation.BASIC;
129 set("$rdsm_variation", variation);
130 if (variation == Variation.DECIV) {
131 set("$rdsm_marinesReq", MARINES_REQUIRED);
132 set("$rdsm_raidDifficulty", RAID_DIFFICULTY);
133 }
134 }
135
136 @Override
137 public void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height) {
138 float opad = 10f;
139 Color h = Misc.getHighlightColor();
140 if (currentStage == Stage.GO_TO_RUINS) {
141 if (variation == Variation.DECIV) {
143 ", and swap the datacore from the " + megacorp + " " + target + " in the ruins there. There have "
144 + "been reports of decivs so you should bring at least %s " +
145 "marines to ensure the job goes smoothly.", opad, h, Misc.getWithDGS(MARINES_REQUIRED));
146 } else {
147 String extra = "";
149 ", and swap the datacore from the " + megacorp + " " + target + " in the ruins there with the one provided." + extra, opad);
150 }
151 } else if (currentStage == Stage.RETURN) {
152 info.addPara(getReturnText(market), opad);
153 }
154// else {
155// super.addDescriptionForCurrentStage(info, width, height); // shows the completed/failed/abandoned text, if needed
156// }
157 }
158
159 @Override
160 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) {
161 Color h = Misc.getHighlightColor();
162 if (currentStage == Stage.GO_TO_RUINS) {
163 //info.addPara("Go to " + planet.getName() + " in the " + planet.getStarSystem().getNameWithLowercaseTypeShort(), tc, pad);
164 info.addPara(getGoToPlanetTextShort(planet), tc, pad);
165 return true;
166 } else if (currentStage == Stage.RETURN) {
167 info.addPara(getReturnTextShort(market), tc, pad);
168 return true;
169 }
170 return false;
171 }
172
173 @Override
174 public String getBaseName() {
175 return "Ruins Datacore Swap";
176 }
177
178 @Override
179 public String getBlurbText() {
180 return null; // rules.csv
181 }
182
183}
184
185
static final String THEME_REMNANT_SUPPRESSED
Definition Tags.java:187
void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height)
boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad)
void connectWithGlobalFlag(Object from, Object to, String flag)
void setTimeLimit(Object failStage, float days, StarSystemAPI noLimitWhileInSystem, Object ... noLimitAfterStages)
void makeImportant(PersonAPI person, String flag, Enum ... stages)
static String getWithDGS(float num)
Definition Misc.java:1381
static Color getHighlightColor()
Definition Misc.java:792
LabelAPI addPara(String format, float pad, Color hl, String... highlights)