Starsector API
Loading...
Searching...
No Matches
KantaCMD.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.rulecmd;
2
3import java.awt.Color;
4import java.util.List;
5import java.util.Map;
6import java.util.Random;
7
8import org.lwjgl.util.vector.Vector2f;
9
10import com.fs.starfarer.api.EveryFrameScript;
11import com.fs.starfarer.api.Global;
12import com.fs.starfarer.api.campaign.CampaignFleetAPI;
13import com.fs.starfarer.api.campaign.CargoAPI;
14import com.fs.starfarer.api.campaign.CargoAPI.CargoItemType;
15import com.fs.starfarer.api.campaign.CargoStackAPI;
16import com.fs.starfarer.api.campaign.CustomCampaignEntityAPI;
17import com.fs.starfarer.api.campaign.FactionAPI;
18import com.fs.starfarer.api.campaign.InteractionDialogAPI;
19import com.fs.starfarer.api.campaign.OptionPanelAPI;
20import com.fs.starfarer.api.campaign.PersonImportance;
21import com.fs.starfarer.api.campaign.SpecialItemData;
22import com.fs.starfarer.api.campaign.TextPanelAPI;
23import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
24import com.fs.starfarer.api.campaign.econ.Industry;
25import com.fs.starfarer.api.campaign.econ.MarketAPI;
26import com.fs.starfarer.api.campaign.listeners.ColonyPlayerHostileActListener;
27import com.fs.starfarer.api.campaign.rules.MemKeys;
28import com.fs.starfarer.api.campaign.rules.MemoryAPI;
29import com.fs.starfarer.api.characters.PersonAPI;
30import com.fs.starfarer.api.combat.ShipAPI.HullSize;
31import com.fs.starfarer.api.combat.ShipHullSpecAPI;
32import com.fs.starfarer.api.combat.WeaponAPI.WeaponSize;
33import com.fs.starfarer.api.fleet.FleetMemberAPI;
34import com.fs.starfarer.api.impl.campaign.CoreReputationPlugin.CustomRepImpact;
35import com.fs.starfarer.api.impl.campaign.CoreReputationPlugin.RepActionEnvelope;
36import com.fs.starfarer.api.impl.campaign.CoreReputationPlugin.RepActions;
37import com.fs.starfarer.api.impl.campaign.DelayedBlueprintLearnScript;
38import com.fs.starfarer.api.impl.campaign.FusionLampEntityPlugin;
39import com.fs.starfarer.api.impl.campaign.econ.impl.InstallableItemEffect;
40import com.fs.starfarer.api.impl.campaign.econ.impl.ItemEffectsRepo;
41import com.fs.starfarer.api.impl.campaign.ids.Conditions;
42import com.fs.starfarer.api.impl.campaign.ids.Entities;
43import com.fs.starfarer.api.impl.campaign.ids.Factions;
44import com.fs.starfarer.api.impl.campaign.ids.FleetTypes;
45import com.fs.starfarer.api.impl.campaign.ids.Industries;
46import com.fs.starfarer.api.impl.campaign.ids.Items;
47import com.fs.starfarer.api.impl.campaign.ids.People;
48import com.fs.starfarer.api.impl.campaign.ids.Tags;
49import com.fs.starfarer.api.impl.campaign.intel.contacts.ContactIntel;
50import com.fs.starfarer.api.impl.campaign.intel.contacts.ContactIntel.ContactState;
51import com.fs.starfarer.api.impl.campaign.intel.events.HostileActivityEventIntel;
52import com.fs.starfarer.api.impl.campaign.intel.events.KantasProtectionOneTimeFactor;
53import com.fs.starfarer.api.impl.campaign.intel.events.PiracyRespiteScript;
54import com.fs.starfarer.api.impl.campaign.intel.events.PirateHostileActivityFactor;
55import com.fs.starfarer.api.impl.campaign.missions.DelayedFleetEncounter;
56import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionWithTriggers.FleetQuality;
57import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionWithTriggers.FleetSize;
58import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD.TempData;
59import com.fs.starfarer.api.loading.IndustrySpecAPI;
60import com.fs.starfarer.api.loading.WeaponSpecAPI;
61import com.fs.starfarer.api.util.DelayedActionScript;
62import com.fs.starfarer.api.util.IntervalUtil;
63import com.fs.starfarer.api.util.Misc;
64import com.fs.starfarer.api.util.Misc.Token;
65import com.fs.starfarer.api.util.Pair;
66import com.fs.starfarer.api.util.WeightedRandomPicker;
67
71public class KantaCMD extends BaseCommandPlugin {
72
73 public static final String KANTA_PROTECTION = "$kantaProtection";
74 public static final String EVER_HAD_KANTA_PROTECTION = "$everHadKantaProtection";
75
76 public static boolean playerHasProtection() {
77 //if (true) return false;
78 return Global.getSector().getCharacterData().getMemoryWithoutUpdate().getBoolean(KANTA_PROTECTION);
79 }
80 public static boolean playerEverHadProtection() {
81 return Global.getSector().getCharacterData().getMemoryWithoutUpdate().getBoolean(EVER_HAD_KANTA_PROTECTION);
82 }
83
84 public static class KantaFavorTrigger implements EveryFrameScript {
85
86 public static float MIN_ELAPSED = 720f;
87
88 // around 50ish percent after 5 cycles
89 // want this to feel unpredictable and like it might not happen
90 public static float PROB_PER_MONTH = 0.01f;
91
92 public static float MIN_DELAY_BETWEEN_COURIERS = 60f;
93 public static float MAX_DELAY_BETWEEN_COURIERS = 90f;
94 public static int MAX_ATTEMPTS = 5;
95
96
97 protected IntervalUtil interval = new IntervalUtil(20f, 40f);
98 protected float elapsed = 0f;
99 protected float resendTimeout = 0f;
100 protected int attempts = 0;
101 protected Random random = new Random();
102 protected boolean done = false;
103
104 public void advance(float amount) {
105 if (Global.getSector().getMemoryWithoutUpdate().getBoolean("$affk_inProgress")) {
106 done = true;
107 return;
108 }
109
110 //amount *= 1000f;
111
112 float days = Global.getSector().getClock().convertToDays(amount);
113 elapsed += days;
114
115 boolean send = false;
116
117 interval.advance(days);
118 if (interval.intervalElapsed()) {
119 if (random.nextFloat() < PROB_PER_MONTH) {
120 send = true;
121 }
122 }
123
124// if (true) {
125// loseProtection(null);
126// Global.getSector().getCampaignUI().addMessage("Kanta's Protection lost", Misc.getNegativeHighlightColor());
127// send = false;
128// done = true;
129// return;
130// }
131
132 if (attempts <= 0 && elapsed < MIN_ELAPSED) {
133 send = false; // initial timeout
134 }
135 if (attempts > 0 && elapsed < resendTimeout) {
136 send = false; // sent a courier recently
137 } else if (attempts > 0) {
138 if (attempts >= MAX_ATTEMPTS) { // too many failed attempts
139 loseProtection(null);
140 Global.getSector().getCampaignUI().addMessage("Kanta's Protection lost", Misc.getNegativeHighlightColor());
141 send = false;
142 done = true;
143 return;
144 } else {
145 send = true; // sent a courier already, and not recently - always send another one
146 }
147 }
148
149 //send = true;
150 if (send) {
151 elapsed = 0;
152 sendCourier();
153 attempts++;
154 resendTimeout = MIN_DELAY_BETWEEN_COURIERS +
155 (MAX_DELAY_BETWEEN_COURIERS - MIN_DELAY_BETWEEN_COURIERS) * random.nextFloat();
156 }
157 }
158
159 public boolean isDone() {
160 return done;
161 }
162
163 public boolean runWhilePaused() {
164 return false;
165 }
166
167 public void sendCourier() {
168 DelayedFleetEncounter e = new DelayedFleetEncounter(random, "kantaFavorCourier");
169 e.setDelayNone();
170 e.setLocationInnerSector(false, null);
171 e.setEncounterFromSomewhereInSystem();
172 e.setDoNotAbortWhenPlayerFleetTooStrong();
173 e.beginCreate();
174 e.triggerCreateFleet(FleetSize.VERY_SMALL, FleetQuality.HIGHER,
175 Factions.PIRATES, FleetTypes.PATROL_SMALL, new Vector2f());
176 e.triggerFleetSetName("Courier");
177 e.triggerMakeNonHostile();
178 e.triggerFleetMakeImportantPermanent(null);
179 e.triggerFleetMakeFaster(true, 0, true);
180 e.triggerOrderFleetInterceptPlayer();
181 e.triggerOrderFleetEBurn(1f);
182 e.triggerSetFleetGenericHailPermanent("KantaFavorCourierHail");
183 e.endCreate();
184 }
185
186 }
187
188
189 public static class TakingBackTheNanoforgeChecker implements ColonyPlayerHostileActListener {
190 protected MarketAPI market;
191 public TakingBackTheNanoforgeChecker(MarketAPI market) {
192 this.market = market;
193 }
194
195 public void reportRaidForValuablesFinishedBeforeCargoShown(InteractionDialogAPI dialog, MarketAPI market,
196 TempData actionData, CargoAPI cargo) {
197 if (this.market.hasCondition(Conditions.DECIVILIZED)) {
198 Global.getSector().getListenerManager().removeListener(this);
199 }
200 if (actionData.secret) {
201 return;
202 }
203 if (market == this.market) {
204 if (cargo.getQuantity(CargoItemType.SPECIAL, new SpecialItemData(Items.PRISTINE_NANOFORGE, null)) > 0) {
205 PersonAPI kanta = People.getPerson(People.KANTA);
206 if (kanta != null) {
207 TextPanelAPI text = dialog.getTextPanel();
208 text.addPara("Word of this is bound to get back to Kanta. "
209 + "You can't imagine she would react well to being made a fool of.");
210 loseProtection(dialog);
211 }
212 Global.getSector().getListenerManager().removeListener(this);
213 }
214 }
215 }
216
217 public void reportRaidToDisruptFinished(InteractionDialogAPI dialog, MarketAPI market, TempData actionData, Industry industry) {
218 }
219
220 public void reportTacticalBombardmentFinished(InteractionDialogAPI dialog, MarketAPI market, TempData actionData) {
221 }
222
223 public void reportSaturationBombardmentFinished(InteractionDialogAPI dialog, MarketAPI market, TempData actionData) {
224 }
225
226 }
227
228 public static class FusionLampColorChanger implements EveryFrameScript {
229 public boolean isDone() {
230 return market.getContainingLocation() == null;
231 }
232
233 public boolean runWhilePaused() {
234 return false;
235 }
236
237 protected MarketAPI market;
238 protected IntervalUtil interval = new IntervalUtil(0.5f, 1f);
239 public FusionLampColorChanger(MarketAPI market) {
240 this.market = market;
241 }
242
243 public void advance(float amount) {
244 float days = Global.getSector().getClock().convertToDays(amount);
245 if (Global.getSector().getClock().getMonth() == 11 &&
246 Global.getSector().getClock().getDay() == 28) {
247 days *= 100f;
248 }
249
250 interval.advance(days);
251 if (interval.intervalElapsed()) {
252 for (CustomCampaignEntityAPI curr : market.getContainingLocation().getCustomEntities()) {
253 if (curr.getCustomEntityType().equals(Entities.FUSION_LAMP) &&
254 curr.getOrbitFocus() == market.getPrimaryEntity()) {
255
256 WeightedRandomPicker<Pair<Color, Color>> picker = new WeightedRandomPicker<Pair<Color, Color>>();
257
258 // orange
259 picker.add(new Pair<Color, Color>(FusionLampEntityPlugin.GLOW_COLOR, FusionLampEntityPlugin.LIGHT_COLOR));
260
261 // red
262 picker.add(new Pair<Color, Color>(new Color(255,50,50,255), new Color(255,50,50,255)));
263
264 // blue
265 picker.add(new Pair<Color, Color>(new Color(210,230,255,255), new Color(210,230,255,255)));
266
267 // white
268 picker.add(new Pair<Color, Color>(new Color(245,250,255,255), new Color(245,250,255,255)));
269
270 // yellow
271 picker.add(new Pair<Color, Color>(new Color(255,225,125,255), new Color(255,225,125,255)));
272
273 // green
274 picker.add(new Pair<Color, Color>(new Color(100,255,100,255), new Color(100,255,100,255)));
275
276 Pair<Color, Color> pick = picker.pick();
277
278 FusionLampEntityPlugin plugin = (FusionLampEntityPlugin) curr.getCustomPlugin();
279 plugin.setGlowColor(pick.one);
280 plugin.setLightColor(pick.two);
281
282 break;
283 }
284 }
285
286 }
287 }
288 }
289
290 public static class DelayedInstallItemScript extends DelayedActionScript {
291 protected MarketAPI market;
292 protected String industryId;
293 protected String itemId;
294
295 public DelayedInstallItemScript(float daysLeft, MarketAPI market, String industryId, String itemId) {
296 super(daysLeft);
297 this.market = market;
298 this.industryId = industryId;
299 this.itemId = itemId;
300 }
301
302 @Override
303 public void doAction() {
304 InstallableItemEffect effect = ItemEffectsRepo.ITEM_EFFECTS.get(itemId);
305 Industry ind = market.getIndustry(industryId);
306 if (ind != null && effect != null && !market.hasCondition(Conditions.DECIVILIZED)) {
307 List<String> unmet = effect.getUnmetRequirements(ind);
308 if (unmet == null || unmet.isEmpty()) {
309 ind.setSpecialItem(new SpecialItemData(itemId, null));
310 }
311 }
312 }
313 }
314
315
316 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
317 if (dialog == null) return false;
318
319 OptionPanelAPI options = dialog.getOptionPanel();
320 TextPanelAPI text = dialog.getTextPanel();
321 CampaignFleetAPI pf = Global.getSector().getPlayerFleet();
322 CargoAPI cargo = pf.getCargo();
323
324 String action = params.get(0).getString(memoryMap);
325
326 MemoryAPI memory = memoryMap.get(MemKeys.LOCAL);
327 if (memory == null) return false; // should not be possible unless there are other big problems already
328
329 MarketAPI market = dialog.getInteractionTarget().getMarket();
330
331 if ("findLargeOmega".equals(action)) {
332 for (CargoStackAPI stack : cargo.getStacksCopy()) {
333 if (!stack.isWeaponStack()) continue;
334
335 WeaponSpecAPI spec = stack.getWeaponSpecIfWeapon();
336 if (spec.getSize() != WeaponSize.LARGE) continue;
337
338 if (!spec.hasTag(Tags.OMEGA)) continue;
339
340 memory.set("$foundWeaponId", spec.getWeaponId());
341 memory.set("$foundWeaponName", spec.getWeaponName());
342 memory.set("$foundWeaponQuantity", (int) Math.round(stack.getSize()));
343 return true;
344 }
345 } else if ("findContactToBetray".equals(action)) {
346 ContactIntel best = null;
347 int bestImportance = 0;
348 float bestRel = 0f;
349 for (IntelInfoPlugin curr : Global.getSector().getIntelManager().getIntel(ContactIntel.class)) {
350 ContactIntel intel = (ContactIntel) curr;
351 if (intel.isEnding() || intel.isEnded() || intel.getState() == ContactState.POTENTIAL) continue;
352
353 int importance = intel.getPerson().getImportance().ordinal();
354 float rel = intel.getPerson().getRelToPlayer().getRel();
355
356 if (intel.getPerson().getImportance().ordinal() <= PersonImportance.MEDIUM.ordinal()) continue;
357 //if (intel.getPerson().getRelToPlayer().isAtBest(RepLevel.WELCOMING)) continue;
358
359 if (importance > bestImportance || (importance >= bestImportance && rel > bestRel)) {
360 best = intel;
361 bestImportance = importance;
362 bestRel = rel;
363 }
364 }
365
366 if (best == null) return false;
367
368 PersonAPI contact = best.getPerson();
369 memory.set("$foundContactName", contact.getNameString());
370 memory.set("$foundContactRank", contact.getRank().toLowerCase());
371 memory.set("$foundContactPost", contact.getPost().toLowerCase());
372 memory.set("$foundContactFaction", contact.getFaction().getPersonNamePrefixAOrAn() + " " + contact.getFaction().getPersonNamePrefix());
373 memory.set("$foundContactIntel", best);
374
375 return true;
376 } else if ("betrayContact".equals(action)) {
377 ContactIntel intel = (ContactIntel) memory.get("$foundContactIntel");
378 CustomRepImpact impact = new CustomRepImpact();
379 impact.delta = -0.75f;
380 Global.getSector().adjustPlayerReputation(
381 new RepActionEnvelope(RepActions.CUSTOM,
382 impact, null, text, true, true),
383 intel.getPerson());
384 intel.loseContact(dialog);
385 } else if ("gaveHamatsu".equals(action)) {
386 PersonAPI ibrahim = People.getPerson(People.IBRAHIM);
387 if (ibrahim != null) {
388 CustomRepImpact impact = new CustomRepImpact();
389 impact.delta = -2f;
390 Global.getSector().adjustPlayerReputation(
391 new RepActionEnvelope(RepActions.CUSTOM,
392 impact, null, text, true, true),
393 ibrahim);
394 ContactIntel intel = ContactIntel.getContactIntel(ibrahim);
395 if (intel != null) {
396 intel.loseContact(dialog);
397 }
398 }
399 } else if ("findRemnantCapital".equals(action)) {
400 for (FleetMemberAPI member : pf.getFleetData().getMembersListCopy()) {
401 if (member.getHullSpec().hasTag(Tags.SHIP_REMNANTS) && member.isCapital()) {
402 memory.set("$foundShipId", member.getId());
403 memory.set("$foundShipClass", member.getHullSpec().getNameWithDesignationWithDashClass());
404 memory.set("$foundShipName", member.getShipName());
405 return true;
406 }
407 }
408 } else if ("findShieldBlueprint".equals(action)) {
409 for (CargoStackAPI stack : cargo.getStacksCopy()) {
410 if (!stack.isSpecialStack()) continue;
411
412 SpecialItemData data = stack.getSpecialDataIfSpecial();
413 if (data.getData() == null) continue;
414
415 if (!data.getId().equals(Items.INDUSTRY_BP)) continue;
416
417 IndustrySpecAPI spec = Global.getSettings().getIndustrySpec(data.getData());
418
419 if (spec.getId().equals(Industries.PLANETARYSHIELD)) {
420 memory.set("$foundIndustryId", spec.getId());
421 String firstWord = stack.getDisplayName().split(" ")[0];
422 memory.set("$foundIndustryName", Misc.ucFirst(Misc.getAOrAnFor(firstWord)) + " " + stack.getDisplayName().replace("Blueprint", "blueprint"));
423 return true;
424 }
425 }
426 } else if ("findShipBlueprint".equals(action)) {
427 FactionAPI pirates = Global.getSector().getFaction(Factions.PIRATES);
428 for (CargoStackAPI stack : cargo.getStacksCopy()) {
429 if (!stack.isSpecialStack()) continue;
430
431 SpecialItemData data = stack.getSpecialDataIfSpecial();
432 if (data.getData() == null) continue;
433
434 if (!data.getId().equals(Items.SHIP_BP)) continue;
435
436 if (pirates.knowsShip(data.getData())) continue;
437
438 ShipHullSpecAPI spec = Global.getSettings().getHullSpec(data.getData());
439
440 boolean match = spec.hasTag(Tags.KANTA_GIFT);
441 match |= !spec.isCivilianNonCarrier() && spec.getHullSize() == HullSize.CAPITAL_SHIP;
442
443 if (match) {
444 memory.set("$foundShipBPId", data.getData());
445 String firstWord = stack.getDisplayName().split(" ")[0];
446 memory.set("$foundShipBPName", Misc.ucFirst(Misc.getAOrAnFor(firstWord)) + " " + stack.getDisplayName().replace("Blueprint", "blueprint"));
447 return true;
448 }
449 }
450 } else if ("learnShipBP".equals(action)) {
451 String hullId = params.get(1).getString(memoryMap);
452 float daysDelay = params.get(2).getFloat(memoryMap);
453 DelayedBlueprintLearnScript script = new DelayedBlueprintLearnScript(Factions.PIRATES, daysDelay);
454 script.getShips().add(hullId);
455 Global.getSector().addScript(script);
456 return true;
457 } else if ("oweKantaAFavor".equals(action)) {
458 Global.getSector().addScript(new KantaFavorTrigger());
459 } else if ("abortFavor".equals(action)) {
460 Global.getSector().removeScriptsOfClass(KantaFavorTrigger.class);
461 } else if ("alreadyDidFavor".equals(action)) {
462 return !Global.getSector().hasScript(KantaFavorTrigger.class) && playerHasProtection();
464 } else if ("installFusionLamp".equals(action)) {
465 SpecialItemData data = new SpecialItemData(Items.ORBITAL_FUSION_LAMP, null);
466 InstallableItemEffect effect = ItemEffectsRepo.ITEM_EFFECTS.get(data.getId());
467 Industry ind = market.getIndustry(Industries.POPULATION);
468 if (ind != null && effect != null) {
469 List<String> unmet = effect.getUnmetRequirements(ind);
470 if (unmet == null || unmet.isEmpty()) {
471 ind.setSpecialItem(data);
472 market.getPrimaryEntity().addScript(new FusionLampColorChanger(market));
473 }
474 }
475 return true;
476 } else if ("buildPlanetaryShield".equals(action)) {
477 Industry ind = market.getIndustry(Industries.PLANETARYSHIELD);
478 if (ind == null) {
479 market.addIndustry(Industries.PLANETARYSHIELD);
480
481 // not very promising - shield is under the station etc
482// PlanetAPI planet = market.getContainingLocation().addPlanet(market.getId() + "_fakeForShield", market.getPrimaryEntity(), "", Planets.TUNDRA, 0, 100f, 0f, 1f);
483// market.getConnectedEntities().add(planet);
484// ind = market.getIndustry(Industries.PLANETARYSHIELD);
485// if (ind != null) {
486// ind.startBuilding();
487// }
488 }
489 return true;
490 } else if ("gavePristineNanoforge".equals(action)) {
491 float daysDelay = params.get(1).getFloat(memoryMap);
492 //daysDelay = 0;
493 MarketAPI kapteyn = Global.getSector().getEconomy().getMarket("station_kapteyn");
494 if (kapteyn != null) {
495 Global.getSector().addScript(
496 new DelayedInstallItemScript(daysDelay,
497 kapteyn, Industries.ORBITALWORKS, Items.PRISTINE_NANOFORGE));
498 Global.getSector().getListenerManager().addListener(new TakingBackTheNanoforgeChecker(kapteyn));
499 }
500 return true;
501 } else if ("kapteynHasForge".equals(action)) {
502 MarketAPI kapteyn = Global.getSector().getEconomy().getMarket("station_kapteyn");
503 if (kapteyn == null || kapteyn.hasCondition(Conditions.DECIVILIZED)) return false;
504
505 Industry ind = market.getIndustry(Industries.ORBITALWORKS);
506 if (ind == null) return false;
507
508 return ind.getSpecialItem() != null && Items.PRISTINE_NANOFORGE.equals(ind.getSpecialItem().getId());
509 } else if ("gainProtection".equals(action)) {
510 Global.getSector().getCharacterData().getMemoryWithoutUpdate().set(KANTA_PROTECTION, true);
511 Global.getSector().getCharacterData().getMemoryWithoutUpdate().set(EVER_HAD_KANTA_PROTECTION, true);
512 text.setFontSmallInsignia();
513 text.addPara("Kanta's Protection gained", Misc.getPositiveHighlightColor());
514 text.setFontInsignia();
515
516 Global.getSoundPlayer().playUISound("ui_rep_raise", 1f, 1f);
517
518 PirateHostileActivityFactor.avertOrAbortRaid();
519
520 HostileActivityEventIntel intel = HostileActivityEventIntel.get();
521 if (intel != null) {
522 intel.addFactor(new KantasProtectionOneTimeFactor(-Global.getSettings().getInt("HA_kantaProtection")), dialog);
523 }
524
525 new PiracyRespiteScript();
526
527 } else if ("loseProtection".equals(action)) {
528 loseProtection(dialog);
529 }
530
531
532
533 return false;
534 }
535
536 public static void loseProtection(InteractionDialogAPI dialog) {
537 if (!playerHasProtection()) return;
538
539 PersonAPI kanta = People.getPerson(People.KANTA);
540 if (kanta != null) {
541 Misc.incrUntrustwortyCount();
542
543 TextPanelAPI text = dialog == null ? null : dialog.getTextPanel();
544 CustomRepImpact impact = new CustomRepImpact();
545 impact.delta = -0.5f;
546 Global.getSector().adjustPlayerReputation(
547 new RepActionEnvelope(RepActions.CUSTOM,
548 impact, null, text, true, true),
549 kanta);
550 Global.getSector().getCharacterData().getMemoryWithoutUpdate().unset(KANTA_PROTECTION);
551 if (text != null) {
552 text.setFontSmallInsignia();
553 text.addPara("Kanta's Protection lost", Misc.getNegativeHighlightColor());
554 text.setFontInsignia();
555 }
556 Global.getSoundPlayer().playUISound("ui_rep_drop", 1f, 1f);
557 }
558 }
559
560}
static SettingsAPI getSettings()
Definition Global.java:51
static SoundPlayerAPI getSoundPlayer()
Definition Global.java:43
static SectorAPI getSector()
Definition Global.java:59
static void loseProtection(InteractionDialogAPI dialog)
boolean execute(String ruleId, InteractionDialogAPI dialog, List< Token > params, Map< String, MemoryAPI > memoryMap)
ShipHullSpecAPI getHullSpec(String hullId)
IndustrySpecAPI getIndustrySpec(String industryId)
SoundAPI playUISound(String id, float pitch, float volume)