Starsector API
Loading...
Searching...
No Matches
ScientistAICoreBarEvent.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.bar.events;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.campaign.CargoAPI;
7import com.fs.starfarer.api.campaign.StarSystemAPI;
8import com.fs.starfarer.api.campaign.TextPanelAPI;
9import com.fs.starfarer.api.campaign.econ.MarketAPI;
10import com.fs.starfarer.api.impl.campaign.ids.Entities;
11import com.fs.starfarer.api.impl.campaign.ids.Factions;
12import com.fs.starfarer.api.impl.campaign.ids.Ranks;
13import com.fs.starfarer.api.impl.campaign.ids.Tags;
14import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator;
15import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.AddedEntity;
16import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.EntityLocation;
17import com.fs.starfarer.api.util.Misc;
18import com.fs.starfarer.api.util.WeightedRandomPicker;
19
21
23 super();
24 }
25
26 public boolean shouldShowAtMarket(MarketAPI market) {
27 if (!super.shouldShowAtMarket(market)) return false;
28
29 if (market.getFactionId().equals(Factions.LUDDIC_CHURCH) ||
30 market.getFactionId().equals(Factions.LUDDIC_PATH)) {
31 return false;
32 }
33
34 return true;
35 }
36
37 @Override
38 protected void regen(MarketAPI market) {
39 if (this.market == market) return;
40 super.regen(market);
41 }
42
43 @Override
44 protected void doStandardConfirmActions() {
45 // we want to do nothing here, real work in doConfirmActionsPreAcceptText()
46 }
47
48 @Override
50 // spawn entity with AI core etc here
51
52 CargoAPI cargo = Global.getSector().getPlayerFleet().getCargo();
53 TextPanelAPI text = dialog.getTextPanel();
54
55 WeightedRandomPicker<StarSystemAPI> picker = new WeightedRandomPicker<StarSystemAPI>(random);
56 for (StarSystemAPI system : Global.getSector().getStarSystems()) {
57 if (system.hasTag(Tags.THEME_CORE_POPULATED)) continue;
58 if (system.hasTag(Tags.THEME_REMNANT_MAIN)) continue;
59 if (system.hasTag(Tags.THEME_REMNANT_RESURGENT)) continue;
60 if (system.hasTag(Tags.THEME_HIDDEN)) continue;
61
62// if (system.getStar() != null && system.getStar().getSpec().isBlackHole()) continue;
63// if (system.getSecondary() != null && system.getSecondary().getSpec().isBlackHole()) continue;
64// if (system.getTertiary() != null && system.getTertiary().getSpec().isBlackHole()) continue;
65
66 float sinceVisit = Global.getSector().getClock().getElapsedDaysSince(system.getLastPlayerVisitTimestamp());
67 if (sinceVisit < 60) continue;
68
69 //if (!Misc.getMarketsInLocation(system).isEmpty()) continue;
70
71 picker.add(system);
72 }
73
74 StarSystemAPI system = picker.pick();
75 if (system == null) {
76 doDataFail();
77 return;
78 }
79
80 //EntityLocation loc = BaseThemeGenerator.pickHiddenLocation(random, system, 100f, null);
81 EntityLocation loc = BaseThemeGenerator.pickHiddenLocationNotNearStar(random, system, 100f, null);
82 if (loc == null) {
83 doDataFail();
84 return;
85 }
86
87 //AddedEntity added = BaseThemeGenerator.addNonSalvageEntity(system, loc, Entities.STABLE_LOCATION, Factions.NEUTRAL);
88 AddedEntity added = BaseThemeGenerator.addEntity(random, system, loc, Entities.TECHNOLOGY_CACHE, Factions.NEUTRAL);
89
90 if (added == null || added.entity == null) {
91 doDataFail();
92 return;
93 }
94 //added.entity.setName("Technology Cache");
95
96 //added.entity.removeTag(Tags.SALVAGEABLE);
97 added.entity.setDiscoverable(null);
98 added.entity.setDiscoveryXP(null);
99 added.entity.setSensorProfile(null);
100
101 added.entity.addTag(Tags.EXPIRES); // so it doesn't get targeted by "analyze entity" missions
102
103 ScientistAICoreIntel intel = new ScientistAICoreIntel(added.entity, this);
104 //intel.setImportant(true);
105 Global.getSector().getIntelManager().addIntel(intel, false, text);
106 }
107
108 protected transient boolean failed = false;
109 protected void doDataFail() {
110 failed = true;
111 }
112
113 @Override
114 protected String getPersonFaction() {
115 return Factions.INDEPENDENT;
116 }
117
118 @Override
119 protected String getPersonRank() {
120 return Ranks.CITIZEN;
121 }
122
123 @Override
124 protected String getPersonPost() {
125 return Ranks.CITIZEN;
126 }
127
128 @Override
129 protected float getPriceMult() {
130 return 0;
131 }
132
133 @Override
134 protected String getPrompt() {
135 return "A disheveled " + getManOrWoman() + " in academic uniform is bothering some of the " +
136 "better-dressed spacers with " + getHisOrHer() + " glowing TriPad.";
137 }
138
139 @Override
140 protected String getOptionText() {
141 return "Flag down the academic with the TriPad";
142 }
143
144 @Override
145 protected String getMainText() {
146 return Misc.ucFirst(getHeOrShe()) + " turns out to be a scientist, maybe a \"scientist\", " +
147 "and is delighted to have someone finally listen to " + getHisOrHer() + " story. " +
148 "You set your face to a practiced stern-but-receptive look as " +
149 "you hear " + getHisOrHer() + " pitch through to the end.\n\n" +
150
151 "\"The data doesn’t lie!\" " + getHeOrShe() + " cries again and again, " +
152 "though you can’t make sense of the arcane tables scrolling " +
153 "on " + getHisOrHer() + " greasy TriPad. \"There’s an enormous stock of " +
154 "unrecovered Domain-era technology in this system. No one else can see it! " +
155 "All I ask is,\" " + getHisOrHer() + " voice drops to a whisper, " +
156 "\"you retrieve for me the AI core hidden in the midst of the trove. " +
157 "That, I get to keep. I’ll tell you exactly where to look if you agree to my terms.\"";
158 }
159
160 @Override
161 protected String [] getMainTextTokens() {
162 return new String [] {};
163 }
164 @Override
165 protected Color [] getMainTextColors() {
166 return new Color [] {};
167 }
168
169 @Override
170 protected String getConfirmText() {
171 return "Accept and promise to ship the AI core to the given address in a specially shielded crate";
172 }
173
174 @Override
175 protected String getCancelText() {
176 return "Decline " + getHisOrHer() + " proposal and walk away";
177 }
178
179 @Override
180 protected String getAcceptText() {
181 if (failed) {
182 return "Unfortunately, a closer analysis of the data brings to light several glaring inconsistencies. " +
183 "Looks like " + getHeOrShe() + " was a bit unhinged, after all - " +
184 "there's nothing here worth investigating.";
185 }
186 return null;
187 }
188
189 @Override
190 protected String getDeclineText() {
191 return "You hear the scientist's offended, quavering voice at your back, \"The truth is out there! " +
192 "I won't be held back by small-minds like all of you!\" Most of the other patrons pretend extreme " +
193 "interest in their drinks, though at least one looses a mocking laugh.";
194 }
195
196 protected boolean showCargoCap() {
197 return false;
198 }
199
200 @Override
201 protected void showTotalAndOptions() {
202 super.showTotalAndOptions();
203
204 // can't actually show the location of the cache pre-accept because it's only
205 // generated once the mission is accepted
206// String icon = Global.getSettings().getCommoditySpec(Commodities.ALPHA_CORE).getIconName();
207// String text = null;
208// Set<String> tags = new LinkedHashSet<String>();
209// tags.add(Tags.INTEL_MISSIONS);
210//
211// dialog.getVisualPanel().showMapMarker(getDestination().getPrimaryEntity(),
212// "Destination: " + getDestination().getName(), getDestination().getFaction().getId(),
213// true, icon, text, tags);
214 }
215
216
217}
218
219
220
static SectorAPI getSector()
Definition Global.java:59