Starsector API
Loading...
Searching...
No Matches
RaidSecretOutpostMission.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.missions;
2
3import java.util.List;
4import java.util.Map;
5
6import java.awt.Color;
7
8import com.fs.starfarer.api.campaign.InteractionDialogAPI;
9import com.fs.starfarer.api.campaign.PlanetAPI;
10import com.fs.starfarer.api.campaign.econ.CommodityOnMarketAPI;
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.ids.Conditions;
15import com.fs.starfarer.api.impl.campaign.ids.Tags;
16import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionWithBarEvent;
17import com.fs.starfarer.api.impl.campaign.missions.hub.ReqMode;
18import com.fs.starfarer.api.ui.TooltipMakerAPI;
19import com.fs.starfarer.api.util.Misc;
20import com.fs.starfarer.api.util.Misc.Token;
21
23
24 //public static float PIRATE_PROB = 0.5f;
25 public static float MISSION_DAYS = 120f;
26 public static int RAID_DIFFICULTY = 48;
27 public static int MARINES_REQUIRED = RAID_DIFFICULTY / 2;
28 public static float MIN_VALUE = 80000f;
29 public static float MAX_VALUE = 140000f;
30
31 public static enum Stage {
32 GO_TO_OUTPOST,
33 COMPLETED,
34 FAILED,
35 }
36
37 public static enum Variation {
38 BASIC,
39 DECIV,
40 }
41
42 protected MarketAPI market;
43 protected PersonAPI person;
44 protected PlanetAPI planet;
45 protected int goodsAmount;
47 protected int quantity;
48 //protected Variation variation;
49
50
51 @Override
52 protected boolean create(MarketAPI createdAt, boolean barEvent) {
53 // if this mission type was already accepted by the player, abort
54 if (!setGlobalReference("$rsom_ref")) {
55 return false;
56 }
57
62 //requireSystemHasPulsar();
63 //requireSystemIsDense();
64 //requirePlanetIsGasGiant();
66 requirePlanetNotGasGiant(); // for the writing.
73
74// spawnEntity(Entities.INACTIVE_GATE, "$gaData_test", EntityLocationType.ORBITING_PARAM,
75// planet, planet.getStarSystem(), false);
76// spawnMissionNode("$gaData_test", EntityLocationType.ORBITING_PARAM, planet, planet.getStarSystem());
77
78 if (planet == null) return false;
79
80 person = getPerson();
81 if (person == null) return false;
82
84 if (market == null) return false;
85
86 setStartingStage(Stage.GO_TO_OUTPOST);
87 addSuccessStages(Stage.COMPLETED);
88 addFailureStages(Stage.FAILED);
89
90 makeImportant(planet, "$rsom_targetPlanet", Stage.GO_TO_OUTPOST);
91 //makeImportant(person, "$rsom_contact", Stage.RETURN);
92
93 connectWithGlobalFlag(Stage.GO_TO_OUTPOST, Stage.COMPLETED, "$rsom_raidedOutpost");
94 //connectWithGlobalFlag(Stage.RETURN, Stage.COMPLETED, "$rsom_returnedData");
95
97 setTimeLimit(Stage.FAILED, MISSION_DAYS, null);
98
101
102 //market = com.getMarket();
103 //if (market == null) return false;
104
105 com = pickCommodity();
106 if (com == null) return false;
107
108 float value = MIN_VALUE + getQuality() * (MAX_VALUE - MIN_VALUE);
109 value *= 0.9f + genRandom.nextFloat() * 0.2f;
110
112 if (quantity < 10) quantity = 10;
113
114
115 //setCreditReward(CreditReward.AVERAGE);
116
117// spawnEntity(Entities.FUSION_LAMP, "$gaData_test", EntityLocationType.ORBITING_PARAM,
118// planet, planet.getStarSystem(), false);
119
120// beginStageTrigger(Stage.GET_IN_COMMS_RANGE);
121// triggerSpawnEntity(Entities.INACTIVE_GATE, "$gaData_test", EntityLocationType.ORBITING_PARAM,
122// planet, planet.getStarSystem(), false);
123// triggerEntityMakeImportant();
124// endTrigger();
125
126 //StarSystemAPI system = planet.getStarSystem();
127
128 setRepFactionChangesNone(); // intra-underworld meddling pans out to no change, let's say.
129
130 return true;
131 }
132
133 protected void updateInteractionDataImpl() {
134 set("$rsom_contactName", person.getNameString());
135 set("$rsom_market", market.getName());
136 set("$rsom_planetId", planet.getId());
137 set("$rsom_planetName", planet.getName());
138 set("$rsom_systemName", planet.getStarSystem().getNameWithLowercaseType());
139 set("$rsom_dist", getDistanceLY(planet));
140 set("$rsom_product", com.getCommodity().getLowerCaseName());
141 set("$rsom_productID", com.getCommodity().getId());
142 set("$rsom_quantity", quantity);
143 set("$rsom_marinesReq", MARINES_REQUIRED);
144 set("$rsom_raidDifficulty", RAID_DIFFICULTY);
145
146 }
147
148 @Override
149 protected boolean callAction(String action, String ruleId, final InteractionDialogAPI dialog,
150 List<Token> params, final Map<String, MemoryAPI> memoryMap) {
151 if ("giveOutpostPlunder".equals(action)) {
152
153 return true;
154 }
155
156 return super.callAction(action, ruleId, dialog, params, memoryMap);
157 }
158
159 @Override
160 public void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height) {
161 float opad = 10f;
162 Color h = Misc.getHighlightColor();
163 if (currentStage == Stage.GO_TO_OUTPOST) {
164
166 ", use the codes to bypass defenses to raid and plunder the " + com.getCommodity().getLowerCaseName() + " in the hidden outpost there. "
167 + "Bring at least %s marines to ensure success.", opad, h, Misc.getWithDGS(MARINES_REQUIRED));
168
169 //} else if (currentStage == Stage.RETURN) {
170 // info.addPara(getReturnText(market), opad);
171 }
172// else {
173// super.addDescriptionForCurrentStage(info, width, height); // shows the completed/failed/abandoned text, if needed
174// }
175 }
176
177 @Override
178 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) {
179 Color h = Misc.getHighlightColor();
180 if (currentStage == Stage.GO_TO_OUTPOST) {
181 //info.addPara("Go to " + planet.getName() + " in the " + planet.getStarSystem().getNameWithLowercaseTypeShort(), tc, pad);
182 info.addPara(getGoToPlanetTextShort(planet), tc, pad);
183 return true;
184 //} else if (currentStage == Stage.RETURN) {
185 // info.addPara(getReturnTextShort(market), tc, pad);
186 // return true;
187 }
188 return false;
189 }
190
191 @Override
192 public String getBaseName() {
193 return "Raid Secret Outpost";
194 }
195
196 @Override
197 public String getBlurbText() {
198 return null; // rules.csv
199 }
200
201}
202
203
static final String THEME_REMNANT_SUPPRESSED
Definition Tags.java:187
void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height)
boolean callAction(String action, String ruleId, final InteractionDialogAPI dialog, List< Token > params, final Map< String, MemoryAPI > memoryMap)
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)