1package com.fs.starfarer.api.impl.campaign.missions.academy;
4import java.util.ArrayList;
5import java.util.Arrays;
9import org.lwjgl.util.vector.Vector2f;
11import com.fs.starfarer.api.Global;
12import com.fs.starfarer.api.campaign.BattleAPI;
13import com.fs.starfarer.api.campaign.CampaignEventListener.FleetDespawnReason;
14import com.fs.starfarer.api.campaign.CampaignFleetAPI;
15import com.fs.starfarer.api.campaign.CargoAPI;
16import com.fs.starfarer.api.campaign.CargoAPI.CargoItemType;
17import com.fs.starfarer.api.campaign.CargoStackAPI;
18import com.fs.starfarer.api.campaign.InteractionDialogAPI;
19import com.fs.starfarer.api.campaign.LocationAPI;
20import com.fs.starfarer.api.campaign.SectorEntityToken;
21import com.fs.starfarer.api.campaign.SpecialItemData;
22import com.fs.starfarer.api.campaign.StarSystemAPI;
23import com.fs.starfarer.api.campaign.TextPanelAPI;
24import com.fs.starfarer.api.campaign.econ.MarketAPI;
25import com.fs.starfarer.api.campaign.listeners.BaseFleetEventListener;
26import com.fs.starfarer.api.campaign.listeners.CurrentLocationChangedListener;
27import com.fs.starfarer.api.campaign.rules.MemoryAPI;
28import com.fs.starfarer.api.characters.PersonAPI;
29import com.fs.starfarer.api.impl.campaign.DerelictShipEntityPlugin.DerelictShipData;
30import com.fs.starfarer.api.impl.campaign.GateEntityPlugin;
31import com.fs.starfarer.api.impl.campaign.ids.Entities;
32import com.fs.starfarer.api.impl.campaign.ids.Factions;
33import com.fs.starfarer.api.impl.campaign.ids.FleetTypes;
34import com.fs.starfarer.api.impl.campaign.ids.Items;
35import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
36import com.fs.starfarer.api.impl.campaign.ids.People;
37import com.fs.starfarer.api.impl.campaign.ids.Ranks;
38import com.fs.starfarer.api.impl.campaign.ids.Tags;
39import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator;
40import com.fs.starfarer.api.impl.campaign.procgen.themes.SalvageSpecialAssigner.ShipRecoverySpecialCreator;
41import com.fs.starfarer.api.impl.campaign.rulecmd.AddRemoveCommodity;
42import com.fs.starfarer.api.impl.campaign.rulecmd.missions.GateCMD;
43import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.special.ShipRecoverySpecial.PerShipData;
44import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.special.ShipRecoverySpecial.ShipCondition;
45import com.fs.starfarer.api.ui.TooltipMakerAPI;
46import com.fs.starfarer.api.util.Misc;
47import com.fs.starfarer.api.util.Misc.Token;
48import com.fs.starfarer.api.util.WeightedRandomPicker;
54 public static enum Stage {
60 RETURN_WITH_DEAL_AND_SCANS,
61 FIRST_JANUS_EXPERIMENT,
117 public static enum ScanEncounterVariation {
140 if (
baird ==
null)
return false;
155 if (
daud ==
null)
return false;
158 if (
kanta ==
null)
return false;
161 if (
loke ==
null)
return false;
164 if (
cotton ==
null)
return false;
167 if (
zal ==
null)
return false;
170 if (
kazeron ==
null)
return false;
248 scanEncounterVariations =
new ArrayList<ScanEncounterVariation>(Arrays.asList(ScanEncounterVariation.values()));
301 Map<String, MemoryAPI> memoryMap) {
304 if (
"scannedGateForCoureuse".equals(action)) {
308 else if (
"setGalatiaGateScanned".equals(action))
314 else if (
"clearedHegemonyGate".equals(action)) {
318 else if (
"clearedHegemonyGateSendScans".equals(action)) {
325 else if (
"sentHegemonyScan".equals(action)) {
329 else if (
"clearedLuddicGate".equals(action)) {
333 else if (
"luddicGateFleetMoveAway".equals(action)) {
340 else if (
"luddicGateFleetMoveBack".equals(action)) {
348 else if (
"boughtTTscan".equals(action)) {
355 else if (
"clearedTTGate".equals(action)) {
359 else if (
"clearedPirateGate".equals(action)) {
364 else if (
"doZalEscape".equals(action)) {
369 else if (
"giveJanusDevice".equals(action)) {
376 else if (
"endMissionCleanup".equals(action)){
387 else if (
"zalCommHack".equals(action)){
392 text.
addParagraph(
"COMM FEED 0 INTERRUPTED \nCOMM FEED 1 INTERRUPTED", red);
397 else if (
"zalMinesHack".equals(action))
402 else if (
"giveJanusDevice".equals(action))
434 super.advance(amount);
459 info.
addPara(
"Contact Horus Yaribay to get envoy credentials so you can contact High Hegemon Daud.", opad);
465 info.
addPara(
"Set up a private meeting with High Hegemon Baikal Daud and get him to accept the deal with Provost Baird.", opad);
467 info.
addPara(
"Optional: provide Daud with encrypted Yaribay comm codes.", opad);
472 info.
addPara(
"Meet with High Hegemon Baikal Daud on a shipyard orbiting Chicomoztoc.", opad);
474 info.
addPara(
"Optional: provide Daud with encrypted Yaribay comm codes.", opad);
477 else if (
currentStage == Stage.RETURN_WITH_DEAL_AND_SCANS)
479 info.
addPara(
"You've arranged a deal between High Hegemon Daud and Provost Baird which allows "
480 +
"the Galatia Academy to resume overt research on Gate technology.",opad);
487 info.
addPara(
"Get the Gate scanning instrument from Academician Coureuse.", opad);
495 info.
addPara(
"Scan six Gates with the instruments provided by Academician Coureuse.", opad);
506 info.
addPara(
"Return to the Galatia Academy with the six completed Gate scans.", opad);
510 info.
addPara(
"Use the prototype Janus Device on a Gate in an uninhabited system outside of the "
511 +
"Core worlds.", opad);
515 info.
addPara(
"Return to the Galatia Academy to report the results of the first Janus Prototype "
516 +
"experiment.", opad);
520 info.
addPara(
"Contact Academician Scylla Coureuse about what she needs you to do.", opad);
524 info.
addPara(
"Use Gargoyle's token to arrange a meeting with Warlord Kanta in the Magec system - or find some other way to extract Zal.", opad);
528 info.
addPara(
"Find and extract the clone of Loke from the Pather kidnappers.", opad);
532 info.
addPara(
"Return Clone Loke to Warlord Kanta.", opad);
537 info.
addPara(
"Go to the Magec Gate and jump to Galatia.", opad);
541 info.
addPara(
"Return to the Galatia Academy with Elissa Zal and the working Janus Device.", opad);
550 return super.shouldSendUpdateForStage(
id);
578 info.
addPara(
"Get the Gate scanning device from Scylla Coureuse", tc, pad);
585 info.
addPara(
"Contact Horus Yaribay on Kazeron to get envoy credentials", tc, pad);
591 info.
addPara(
"Horus Yaribay has provided you with official envoy credentials to set up a private meeting with High "
592 +
"Hegemon Baikal Daud", tc, pad);
600 info.
addPara(
"Meet with the High Hegemon in Chicomoztoc orbit and secure Baird's deal", tc, pad);
603 else if (
currentStage == Stage.RETURN_WITH_DEAL_AND_SCANS)
605 info.
addPara(
"Return to Provost Baird at the Galatia Academy with news of the deal made with "
606 +
"High Hegemon Daud", tc, pad);
619 info.
addPara(
"Scan six Gates with the instruments provided by Academician Coureuse", tc, pad);
625 info.
addPara(
"Return to the Galatia Academy with the six completed Gate scans", tc, pad);
629 info.
addPara(
"Use the prototype Janus Device on a Gate in an uninhabited system outside of the "
630 +
"Core worlds", tc, pad);
634 info.
addPara(
"Return to the Galatia Academy to report the results of the first Janus Prototype "
635 +
"experiment", tc, pad);
639 info.
addPara(
"Contact Academician Scylla Coureuse about what she needs you to do", tc, pad);
643 info.
addPara(
"Use Gargoyle's token to arrange a meeting with Warlord Kanta in the Magec system - or find some other way to extract Zal", tc, pad);
647 info.
addPara(
"Find and extract the clone of Loke from the Pather kidnappers", tc, pad);
651 info.
addPara(
"Return Clone Loke to Warlord Kanta", tc, pad);
655 info.
addPara(
"Go to the Magec Gate", tc, pad);
659 info.
addPara(
"Return to the Galatia Academy with Elissa Zal and the working Janus Device", tc, pad);
667 return "At The Gates";
675 return super.getPostfixForState();
681 super.acceptImpl(dialog, memoryMap);
688 super.notifyEnding();
696 picker.
add(event, 1f);
706 return picker.
pick();
714 if (((Enum)
getCurrentStage()).ordinal() >= Stage.RETURN_WITH_DEAL_AND_SCANS.ordinal())
return;
715 if (((Enum)
getCurrentStage()).ordinal() < Stage.TALK_TO_YARIBAY.ordinal())
return;
741 if (gate ==
null)
return;
749 ScanEncounterVariation chosenEncounter =
null;
760 chosenEncounter = ScanEncounterVariation.HEGEMONY;
767 chosenEncounter = ScanEncounterVariation.TRITACHYON;
774 chosenEncounter = ScanEncounterVariation.LUDDIC;
781 chosenEncounter = ScanEncounterVariation.LUDDIC;
788 chosenEncounter = ScanEncounterVariation.PIRATE;
794 if( chosenEncounter ==
null)
799 if( chosenEncounter ==
null)
return;
820 if(chosenEncounter == ScanEncounterVariation.DERELICT)
822 DerelictShipData params =
new DerelictShipData(
new PerShipData(
"apogee_Balanced", ShipCondition.BATTERED, 0f),
false);
830 ShipRecoverySpecialCreator
creator =
new ShipRecoverySpecialCreator(
null, 0, 0,
false,
null,
null);
835 else if(chosenEncounter == ScanEncounterVariation.HEGEMONY)
873 if (fleets.isEmpty())
881 public void reportFleetDespawnedToListener(
CampaignFleetAPI fleet, FleetDespawnReason reason, Object param) {
882 if (reason == FleetDespawnReason.DESTROYED_BY_BATTLE) {
903 setFlag(gate,
"$GAATGhegemonyScanFleet",
true);
905 else if(chosenEncounter == ScanEncounterVariation.JAMMER)
907 setFlag(gate,
"$GAATGscanJammer",
true);
909 else if(chosenEncounter == ScanEncounterVariation.ALARM)
911 setFlag(gate,
"$GAATGscanAlarm",
true);
913 else if(chosenEncounter == ScanEncounterVariation.LUDDIC)
937 if (fleets.isEmpty())
944 setFlag(gate,
"$GAATGluddicScanGate",
true);
947 public void reportFleetDespawnedToListener(
CampaignFleetAPI fleet, FleetDespawnReason reason, Object param) {
948 if (reason == FleetDespawnReason.DESTROYED_BY_BATTLE) {
962 else if(chosenEncounter == ScanEncounterVariation.PATHER)
980 else if(chosenEncounter == ScanEncounterVariation.PIRATE)
1000 if (fleets.isEmpty())
1008 public void reportFleetDespawnedToListener(
CampaignFleetAPI fleet, FleetDespawnReason reason, Object param) {
1009 if (reason == FleetDespawnReason.DESTROYED_BY_BATTLE) {
1030 setFlag(gate,
"$GAATGpirateScanGate",
true);
1032 else if(chosenEncounter == ScanEncounterVariation.SCAVENGER)
1054 if (fleets.isEmpty())
return;
1056 else if(chosenEncounter == ScanEncounterVariation.TRITACHYON)
1083 if (fleets.isEmpty())
1091 public void reportFleetDespawnedToListener(
CampaignFleetAPI fleet, FleetDespawnReason reason, Object param) {
1092 if (reason == FleetDespawnReason.DESTROYED_BY_BATTLE) {
1116 setFlag(gate,
"$GAATGttScanGate",
true);
static SoundPlayerAPI getSoundPlayer()
static FactoryAPI getFactory()
static SectorAPI getSector()
static int getNumGatesScanned()
static boolean isScanned(SectorEntityToken gate)
static boolean isActive(SectorEntityToken gate)
static String GATE_SCANNED
static final String WRECK
static final String LUDDIC_PATH
static final String TRITACHYON
static final String HEGEMONY
static final String NEUTRAL
static final String LUDDIC_CHURCH
static final String PERSEAN
static final String MERCENARY
static final String PIRATES
static final String INDEPENDENT
static final String PATROL_SMALL
static final String SCAVENGER_MEDIUM
static final String TRADE_LINER
static final String PATROL_LARGE
static final String MERC_ARMADA
static final String PATROL_MEDIUM
static final String MERC_PRIVATEER
static final String JANUS
static final String MEMORY_KEY_IGNORE_PLAYER_COMMS
static final String MEMORY_KEY_AVOID_PLAYER_SLOWLY
static String HORUS_YARIBAY
static String POST_STATION_COMMANDER
void sendUpdate(Object listInfoParam, TextPanelAPI textPanel)
void unindent(TooltipMakerAPI info)
Object getListInfoParam()
void bullet(TooltipMakerAPI info)
SectorEntityToken encounterGatePirate
String getPostfixForState()
void updateInteractionDataImpl()
void advance(float amount)
boolean callAction(String action, String ruleId, InteractionDialogAPI dialog, List< Token > params, Map< String, MemoryAPI > memoryMap)
boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad)
CampaignFleetAPI encounterHegemonyFleet
void acceptImpl(InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
boolean create(MarketAPI createdAt, boolean barEvent)
ScanEncounterVariation pickGateEvent()
SectorEntityToken encounterGateTT
static float SYSTEM_NO_GATE_ENCOUNTER_CHANCE
static float COTTON_RAID_DIFFICULTY
PersonAPI kantasDenStationCommander
void spawnKantaVengeanceFleetMerc(SectorEntityToken spawnPoint)
static String SHOW_GATE_SCAN_COUNT
void reportCurrentLocationChanged(LocationAPI prev, LocationAPI currLoc)
boolean shouldSendUpdateForStage(Object id)
SectorEntityToken encounterGateHegemony
CampaignFleetAPI encounterLuddicFleet
static String CHECKED_FOR_ENCOUNTER
CampaignFleetAPI encounterTTFleet
void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height)
List< ScanEncounterVariation > scanEncounterVariations
static float FACTION_GATE_ENCOUNTER_CHANCE
SectorEntityToken encounterGateLuddic
void spawnKantaVengeanceFleetPirateArmada(SectorEntityToken spawnPoint)
static float KANTA_RAID_DIFFICULTY
void spawnKantaVengeanceFleetPirateScout(SectorEntityToken spawnPoint)
SectorEntityToken magecGate
CampaignFleetAPI encounterPirateFleet
SectorEntityToken galatiaGate
void connectWithGlobalFlag(Object from, Object to, String flag)
void addSuccessStages(Object ... ids)
boolean setGlobalReference(String key)
boolean rollProbability(float p)
int genRoundNumber(int min, int max)
void makeImportant(PersonAPI person, String flag, Enum ... stages)
PersonAPI getImportantPerson(String id)
void checkStageChangesAndTriggers(InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
PersonAPI getPersonAtMarketPost(MarketAPI market, String ... postIds)
void setStageOnGlobalFlag(Object to, String flag)
void connectWithEnteredLocation(Object from, Object to, LocationAPI location)
List< CampaignFleetAPI > runStageTriggersReturnFleets(Object stage)
static void addStandardMarketDesc(String prefix, MarketAPI market, TooltipMakerAPI info, float pad)
transient Object startingStage
void setStartingStage(Object startingStage)
HubMissionCreator creator
void setRepFactionChangesNone()
void setName(String name)
void setRepPersonChangesNone()
void setFlag(SectorEntityToken entity, String flag, boolean permanent)
void triggerSetFleetComposition(float freighterMult, float tankerMult, float transportMult, float linerMult, float utilityMult)
void triggerFleetMakeFaster(boolean navigationSkill, int numTugs, boolean allowLongPursuit)
void triggerFleetAllowLongPursuit()
void triggerFleetPatherNoDefaultTithe()
void triggerMakeFleetGoAwayAfterDefeat()
void triggerAutoAdjustFleetStrengthMajor()
void triggerMakeLowRepImpact()
void triggerSetFleetSizeFraction(float fractionOfMax)
void triggerOrderFleetPatrol(final StarSystemAPI system)
void triggerMakeHostileAndAggressive()
void triggerMakeNonStoryCritical(MemoryAPI ... memoryArray)
void triggerMakeNonHostile()
void triggerMakeFleetIgnoreOtherFleets()
void beginWithinHyperspaceRangeTrigger(SectorEntityToken entity, float rangeLY, boolean requirePlayerInHyperspace, Object ... stages)
void triggerMakeNoRepImpact()
void triggerSetGlobalMemoryValue(final String key, final Object value)
void triggerMakeFleetIgnoredByOtherFleets()
void triggerSetFleetAlwaysPursue()
void triggerSetFleetOfficers(OfficerNum num, OfficerQuality quality)
void triggerOrderFleetInterceptPlayer()
void triggerMakeFleetIgnoreOtherFleetsExceptPlayer()
void beginStageTrigger(Object ... stages)
void triggerFleetSetPatrolLeashRange(float dist)
void triggerFleetSetTravelActionText(String travelText)
void triggerFleetAddDefeatTrigger(String trigger)
void triggerFleetMakeImportant(String flag, Enum ... stages)
void triggerFleetSetName(String name)
void triggerSpawnFleetAtPickedLocation()
void triggerOrderFleetEBurn(float probabilityToEBurn)
void triggerSetFleetMissionRef(final String key)
void triggerCreateFleet(FleetSize size, FleetQuality quality, String factionId, String type, StarSystemAPI roughlyWhere)
void triggerSetFleetFaction(final String factionId)
void triggerFleetSetPatrolActionText(String patrolText)
void triggerPickLocationAroundEntity(final float dist)
static SectorEntityToken addSalvageEntity(LocationAPI location, String id, String faction)
static void addStackGainText(CargoStackAPI stack, TextPanelAPI text)
static void notifyScanned(SectorEntityToken gate)
static String getWithDGS(float num)
static Color getNegativeHighlightColor()
static boolean hasPulsar(StarSystemAPI system)
static void setSalvageSpecial(SectorEntityToken entity, Object data)
static Color getHighlightColor()
CargoStackAPI createCargoStack(CargoItemType type, Object data, CargoAPI cargo)
Vector2f getListenerPos()
SoundAPI playSound(String id, float pitch, float volume, Vector2f loc, Vector2f vel)
boolean wasFleetDefeated(CampaignFleetAPI fleet, CampaignFleetAPI primaryWinner)
void addSpecial(SpecialItemData data, float quantity)
void addEventListener(FleetEventListener listener)
TextPanelAPI getTextPanel()
List< SectorEntityToken > getJumpPoints()
boolean hasTag(String tag)
List< CustomCampaignEntityAPI > getCustomEntitiesWithTag(String tag)
MemoryAPI getMemoryWithoutUpdate()
CampaignFleetAPI getPlayerFleet()
void layInCourseFor(SectorEntityToken target)
StarSystemAPI getStarSystem(String name)
MemoryAPI getMemoryWithoutUpdate()
ListenerManagerAPI getListenerManager()
void setCircularOrbit(SectorEntityToken focus, float angle, float orbitRadius, float orbitDays)
void setDiscoverable(Boolean discoverable)
StarSystemAPI getStarSystem()
MemoryAPI getMemoryWithoutUpdate()
SectorEntityToken getHyperspaceAnchor()
LabelAPI addParagraph(String text)
MarketAPI getMarket(String id)
List< MarketAPI > getMarkets(LocationAPI loc)
MemoryAPI getMemoryWithoutUpdate()
StarSystemAPI getStarSystem()
SectorEntityToken getPrimaryEntity()
void addListener(Object listener)
void removeListener(Object listener)
boolean contains(String key)
void set(String key, Object value)
boolean getBoolean(String key)