001package com.fs.starfarer.api.impl.campaign.missions.academy; 002 003import java.awt.Color; 004 005import com.fs.starfarer.api.Global; 006import com.fs.starfarer.api.campaign.FactionAPI; 007import com.fs.starfarer.api.campaign.SectorEntityToken; 008import com.fs.starfarer.api.campaign.StarSystemAPI; 009import com.fs.starfarer.api.campaign.econ.MarketAPI; 010import com.fs.starfarer.api.characters.PersonAPI; 011import com.fs.starfarer.api.impl.campaign.ids.Factions; 012import com.fs.starfarer.api.impl.campaign.ids.FleetTypes; 013import com.fs.starfarer.api.impl.campaign.ids.People; 014import com.fs.starfarer.api.impl.campaign.ids.Tags; 015import com.fs.starfarer.api.ui.TooltipMakerAPI; 016import com.fs.starfarer.api.util.Misc; 017 018public class GAKallichore extends GABaseMission { 019 020 public static enum Stage { 021 TALK_TO_ARROYO, 022 VISIT_ARROYO, 023 TALK_TO_GARGOYLE, 024 GET_HACK_HARDWARE, 025 INSTALL_HACK, 026 RETRIEVE_ARCHIVE, 027 RETURN_TO_ACADEMY, 028 COMPLETED, 029 } 030 031 protected PersonAPI baird; 032 protected PersonAPI arroyo; 033 protected PersonAPI gargoyle; 034 protected PersonAPI loke; 035 protected SectorEntityToken relay; 036 037 @Override 038 protected boolean create(MarketAPI createdAt, boolean barEvent) { 039 // if already accepted by the player, abort 040 if (!setGlobalReference("$gaKA_ref", "$gaKA_inProgress")) { 041 return false; 042 } 043 044 setName("The Kallichore Archive"); 045 046 baird = getImportantPerson(People.BAIRD); 047 arroyo = getImportantPerson(People.ARROYO); 048 gargoyle = getImportantPerson(People.GARGOYLE); 049 loke = getImportantPerson(People.CLONE_LOKE); 050 if (baird == null) return false; 051 if (arroyo == null) return false; 052 if (gargoyle == null) return false; 053 if (loke == null) return false; 054 055 // if the player destroyed Aztlan Relay before this point, uhh. Need to do something, probably. 056 relay = Global.getSector().getEntityById("aztlan_relay"); 057 if (relay == null) return false; 058 059 StarSystemAPI mayasura = gargoyle.getMarket().getStarSystem(); 060 StarSystemAPI galatia = baird.getMarket().getStarSystem(); 061 if (mayasura == null || galatia == null) return false; 062 063 MarketAPI coatl = Global.getSector().getEconomy().getMarket("coatl"); 064 if (coatl == null) return false; 065 066 setStoryMission(); 067 068 setStartingStage(Stage.TALK_TO_ARROYO); 069 addSuccessStages(Stage.COMPLETED); 070 071 makeImportant(arroyo, "$gaKA_contact", Stage.TALK_TO_ARROYO); 072 makeImportant(arroyo.getMarket(), "$gaKA_visitChalet", Stage.VISIT_ARROYO); 073 makeImportant(gargoyle, "$gaKA_contact", Stage.TALK_TO_GARGOYLE); 074 makeImportant(loke.getMarket(), "$gaKA_getHack", Stage.GET_HACK_HARDWARE); 075 makeImportant(relay, "$gaKA_installHack", Stage.INSTALL_HACK); 076 makeImportant(gargoyle, "$gaKA_contactRetrieve", Stage.RETRIEVE_ARCHIVE); 077 makeImportant(baird.getMarket(), "$gaKA_returnHere", Stage.RETURN_TO_ACADEMY); 078 079 setStageOnGlobalFlag(Stage.VISIT_ARROYO, "$gaKA_visitArroyo"); 080 setStageOnGlobalFlag(Stage.TALK_TO_GARGOYLE, "$gaKA_talkToGargoyle"); 081 setStageOnGlobalFlag(Stage.GET_HACK_HARDWARE, "$gaKA_getHackHardware"); 082 setStageOnGlobalFlag(Stage.INSTALL_HACK, "$gaKA_installHack"); 083 setStageOnGlobalFlag(Stage.RETRIEVE_ARCHIVE, "$gaKA_retrieveArchive"); 084 setStageOnGlobalFlag(Stage.RETURN_TO_ACADEMY, "$gaKA_returnToAcademy"); 085 setStageOnGlobalFlag(Stage.COMPLETED, "$gaKA_completed"); 086 087 088 beginStageTrigger(Stage.TALK_TO_ARROYO); 089 triggerUnhideCommListing(arroyo); 090 endTrigger(); 091 beginStageTrigger(Stage.TALK_TO_GARGOYLE); 092 triggerUnhideCommListing(gargoyle); 093 endTrigger(); 094 095 beginStageTrigger(Stage.RETURN_TO_ACADEMY); 096 triggerHideCommListing(gargoyle); 097 endTrigger(); 098 099 100 beginStageTrigger(Stage.RETURN_TO_ACADEMY); 101 SectorEntityToken fleetLocation = gargoyle.getMarket().getPrimaryEntity(); 102 triggerCreateFleet(FleetSize.VERY_LARGE, FleetQuality.DEFAULT, 103 Factions.HEGEMONY, FleetTypes.TASK_FORCE, fleetLocation); 104 triggerAutoAdjustFleetStrengthModerate(); 105 triggerMakeAllFleetFlagsPermanent(); 106 triggerMakeFleetIgnoreOtherFleets(); 107 triggerMakeFleetIgnoredByOtherFleets(); 108 triggerSetPatrol(); 109 triggerPickLocationAtClosestToEntityJumpPoint(mayasura, fleetLocation, 4000f); 110 triggerPickLocationTowardsEntity(null, 30f, 5000f); // towards the jump-point we just picked 111 triggerSpawnFleetAtPickedLocation(null, null); 112 triggerFleetSetPatrolActionText("standing off with Port Tse Station"); 113 triggerFleetSetPatrolLeashRange(100f); 114 triggerOrderFleetPatrol(fleetLocation); 115 triggerOrderFleetEBurn(1f); 116 triggerIncreaseMarketHostileTimeout(gargoyle.getMarket(), 90f); 117 endTrigger(); 118 119 beginWithinHyperspaceRangeTrigger(gargoyle.getMarket(), 1f, true, Stage.RETURN_TO_ACADEMY); 120 triggerCreateFleet(FleetSize.LARGE, FleetQuality.SMOD_1, 121 Factions.HEGEMONY, FleetTypes.TASK_FORCE, mayasura); 122 triggerSetFleetOfficers(OfficerNum.MORE, OfficerQuality.HIGHER); 123 triggerMakeHostileAndAggressive(); 124 //triggerMakeNoRepImpact(); // this happens in dialog instead 125 triggerFleetAllowLongPursuit(); 126 triggerSetFleetAlwaysPursue(); 127 triggerSetPatrol(); 128 triggerPickLocationTowardsEntity(galatia.getHyperspaceAnchor(), 90f, getUnits(0.5f)); 129 triggerSpawnFleetAtPickedLocation("$gaKA_patrol", null); 130 triggerOrderFleetInterceptPlayer(); 131 triggerOrderFleetEBurn(1f); 132 triggerFleetMakeImportant(null, Stage.RETURN_TO_ACADEMY); 133 endTrigger(); 134 135 triggerCreateMediumPatrol(coatl, Factions.HEGEMONY, relay, Stage.INSTALL_HACK, 0f); 136 137 beginStageTrigger(Stage.COMPLETED); 138 triggerRemoveTags(relay, Tags.STORY_CRITICAL); 139 triggerMakeNonStoryCritical(gargoyle.getMarket(), arroyo.getMarket(), loke.getMarket(), coatl); 140 triggerMovePersonToMarket(gargoyle, baird.getMarket(), true); 141 triggerUnhideCommListing(gargoyle); 142 endTrigger(); 143 144 145 // post-hack (and probably post-mission) consequences 146 float baseDelay = 90f; 147 //baseDelay = 0f; 148 beginStageTrigger(Stage.RETRIEVE_ARCHIVE); 149 triggerSetGlobalMemoryValueAfterDelay(genDelay(baseDelay), "$gaKA_triTachyonVisit", true); 150 triggerSetGlobalMemoryValueAfterDelay(genDelay(baseDelay), "$gaKA_hegemonyVisit", true); 151 endTrigger(); 152 153 beginStageTrigger(Stage.COMPLETED); 154 //triggerSetGlobalMemoryValueAfterDelay(genDelay(2f), "$gaKA_missionCompleted", true); 155 triggerSetGlobalMemoryValue("$gaKA_missionCompleted", true); 156 endTrigger(); 157 158 159// //debug trigger to unhide comm entries and set mission stage to retrieving data 160// beginStageTrigger(Stage.TALK_TO_ARROYO); 161// triggerUnhideCommListing(gargoyle); 162// triggerSetGlobalMemoryValue("$gaKA_retrieveArchive", true); 163// endTrigger(); 164// // end debug trigger 165 166 167 return true; 168 169 } 170 171 protected void updateInteractionDataImpl() { 172 set("$gaKA_stage", getCurrentStage()); 173 } 174 175 @Override 176 public void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height) { 177 float opad = 10f; 178 Color h = Misc.getHighlightColor(); 179 FactionAPI heg = Global.getSector().getFaction(Factions.HEGEMONY); 180 if (currentStage == Stage.RETURN_TO_ACADEMY) { 181 info.addPara("You've recovered the data archive of the Academy's previous Provost, Tomas Kallichore, " + 182 "which contains the results of failed gate activation experiments.", opad); 183 } else { 184 info.addPara("Recover the data archive of the Academy's previous Provost, Tomas Kallichore, " + 185 "which contains the results of failed gate activation experiments.", opad); 186 info.addPara("The archive is " + 187 "currently in the ultra-secure data vaults of the Hegemony Ministry of Technology Standards.", opad, 188 heg.getBaseUIColor(), "Hegemony"); 189 } 190 191 if (currentStage == Stage.TALK_TO_ARROYO) { 192 info.addPara(getGoTalkToPersonText(arroyo) + ". He has a relationship with Provost Baird that " 193 + "can be leveraged to compel his cooperation.", opad); 194 } else if (currentStage == Stage.VISIT_ARROYO) { 195 info.addPara("Visit " + arroyo.getNameString() + " in person, at his planetside chalet.", opad); 196 } else if (currentStage == Stage.TALK_TO_GARGOYLE) { 197 info.addPara(getGoTalkToPersonText(gargoyle) + ", a hacker, to arrange a break in to the data vaults. " + 198 "Arroyo is sure a job \"as stupid as you're proposing\" " + 199 "will prove irresistible.", opad); 200 } else if (currentStage == Stage.GET_HACK_HARDWARE) { 201 info.addPara(getGoToMarketText(loke.getMarket()) + " and pick up the hack device from a " + 202 "storage unit.", opad); 203 } else if (currentStage == Stage.INSTALL_HACK) { 204 info.addPara(getGoToSystemTextShort(relay.getStarSystem()) + " and install the hack transmitter " + 205 "on " + relay.getName() + ".", opad); 206 } else if (currentStage == Stage.RETRIEVE_ARCHIVE) { 207 info.addPara(getGoToMarketText(gargoyle.getMarket()) + 208 " and retrieve Kallichore's archive from Gargoyle.", opad); 209 } else if (currentStage == Stage.RETURN_TO_ACADEMY) { 210 info.addPara("Return to the Galatia Academy and talk to Provost Baird.", opad); 211 } 212 } 213 214 @Override 215 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) { 216 Color h = Misc.getHighlightColor(); 217 if (currentStage == Stage.TALK_TO_ARROYO) { 218 info.addPara(getGoTalkToPersonText(arroyo), tc, pad); 219 return true; 220 } else if (currentStage == Stage.VISIT_ARROYO) { 221 info.addPara("Visit " + arroyo.getNameString() + " in person, at his planetside chalet", tc, pad); 222 return true; 223 } else if (currentStage == Stage.TALK_TO_GARGOYLE) { 224 info.addPara(getGoTalkToPersonText(gargoyle), tc, pad); 225 return true; 226 } else if (currentStage == Stage.GET_HACK_HARDWARE) { 227 info.addPara(getGoToMarketText(loke.getMarket()) + " and pick up the hack device", tc, pad); 228 return true; 229 } else if (currentStage == Stage.INSTALL_HACK) { 230 info.addPara(getGoToSystemTextShort(relay.getStarSystem()) + " and install the hack transmitter " + 231 "on the " + relay.getName() + "", tc, pad); 232 return true; 233 } else if (currentStage == Stage.RETRIEVE_ARCHIVE) { 234 info.addPara(getGoToMarketText(gargoyle.getMarket()) + 235 " and retrieve Kallichore's archive", tc, pad); 236 } else if (currentStage == Stage.RETURN_TO_ACADEMY) { 237 info.addPara("Return to the Galatia Academy and talk to Provost Baird", tc, pad); 238 } 239 return false; 240 } 241 242 @Override 243 public String getPostfixForState() { 244 if (startingStage != null) { 245 return ""; 246 } 247 return super.getPostfixForState(); 248 } 249 250} 251 252 253 254 255