001package com.fs.starfarer.api.impl.campaign.missions.academy; 002 003import java.awt.Color; 004 005import com.fs.starfarer.api.campaign.PlanetAPI; 006import com.fs.starfarer.api.campaign.econ.MarketAPI; 007import com.fs.starfarer.api.impl.campaign.ids.Factions; 008import com.fs.starfarer.api.impl.campaign.ids.FleetTypes; 009import com.fs.starfarer.api.impl.campaign.ids.Tags; 010import com.fs.starfarer.api.impl.campaign.missions.hub.ReqMode; 011import com.fs.starfarer.api.ui.TooltipMakerAPI; 012import com.fs.starfarer.api.util.Misc; 013 014public class BasicExampleGADataFromRuins extends GABaseMission { 015 016// public static class GADataFromRuinsCreator extends BaseHubMissionCreator { 017// @Override 018// public HubMission createHubMission(MissionHub hub) { 019// return new BasicExampleGADataFromRuins(); 020// } 021// } 022 023 public static float MISSION_DAYS = 120f; 024 025 public static enum Stage { 026 GO_TO_RUINS, 027 GET_IN_COMMS_RANGE, 028 COMPLETED, 029 FAIL_TIME, 030 } 031 032 protected PlanetAPI planet; 033 protected String target; 034 035 @Override 036 protected boolean create(MarketAPI createdAt, boolean barEvent) { 037 // if this mission type was already accepted by the player, abort 038 if (!setGlobalReference("$gaData_ref")) { 039 return false; 040 } 041 042 pickDepartment(GADepartments.INDUSTRIAL, GADepartments.SOCIAL); 043 target = pickOne("library", "datavault", "archive", "laboratory"); 044 045 requireSystemTags(ReqMode.ANY, Tags.THEME_REMNANT_RESURGENT, Tags.THEME_REMNANT_SUPPRESSED, 046 Tags.THEME_DERELICT, Tags.THEME_MISC, Tags.THEME_RUINS); 047 requireSystemTags(ReqMode.NOT_ANY, Tags.THEME_REMNANT_SECONDARY); 048 //requireSystemInInnerSector(); 049 requirePlanetUnpopulated(); 050 requirePlanetWithRuins(); 051 preferPlanetNotFullySurveyed(); 052 preferPlanetUnexploredRuins(); 053 planet = pickPlanet(); 054 055 if (planet == null) { 056 return false; 057 } 058 059 setStartingStage(Stage.GO_TO_RUINS); 060 addSuccessStages(Stage.COMPLETED); 061 addFailureStages(Stage.FAIL_TIME); 062 063 connectWithGlobalFlag(Stage.GO_TO_RUINS, Stage.GET_IN_COMMS_RANGE, "$gaData_gotData"); 064 connectWithInRangeOfCommRelay(Stage.GET_IN_COMMS_RANGE, Stage.COMPLETED); 065 066 makeImportant(planet, "$gaData_targetPlanet", Stage.GO_TO_RUINS); 067 068 setTimeLimit(Stage.FAIL_TIME, MISSION_DAYS, planet.getStarSystem(), Stage.GET_IN_COMMS_RANGE); 069 //setCreditReward(30000, 60000); 070 setCreditReward(CreditReward.AVERAGE); 071 072 beginWithinHyperspaceRangeTrigger(planet, 1f, false, Stage.GO_TO_RUINS); 073 triggerCreateFleet(FleetSize.MEDIUM, FleetQuality.DEFAULT, Factions.PIRATES, FleetTypes.PATROL_MEDIUM, planet); 074 triggerSetStandardAggroPirateFlags(); 075 //triggerPickLocationAroundEntity(planet, 3000f); 076 triggerPickLocationAtInSystemJumpPoint(planet.getStarSystem()); 077 triggerSpawnFleetAtPickedLocation("$gaData_pirate", null); 078 triggerOrderFleetPatrol(planet); 079 endTrigger(); 080 081 return true; 082 } 083 084 protected void updateInteractionDataImpl() { 085 set("$gaData_department", department); 086 set("$gaData_target", target); 087 set("$gaData_planetName", planet.getName()); 088 set("$gaData_systemName", planet.getStarSystem().getNameWithNoType()); 089 set("$gaData_dist", getDistanceLY(planet)); 090 set("$gaData_reward", Misc.getWithDGS(getCreditsReward())); 091 } 092 093 @Override 094 public void addDescriptionForCurrentStage(TooltipMakerAPI info, float width, float height) { 095 float opad = 10f; 096 Color h = Misc.getHighlightColor(); 097 if (currentStage == Stage.GO_TO_RUINS) { 098 info.addPara("Go to " + planet.getName() + " and retrieve the data from the ruins.", opad); 099 } else if (currentStage == Stage.GET_IN_COMMS_RANGE) { 100 info.addPara("Get within range of a functional comm relay to complete the mission and receive " + 101 "your reward.", opad); 102 } else { 103 super.addDescriptionForCurrentStage(info, width, height); 104 } 105 } 106 107 @Override 108 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) { 109 Color h = Misc.getHighlightColor(); 110 if (currentStage == Stage.GO_TO_RUINS) { 111 info.addPara("Go to " + planet.getName() + "", tc, pad); 112 return true; 113 } else if (currentStage == Stage.GET_IN_COMMS_RANGE) { 114 info.addPara("Get within comms range to complete the mission", tc, pad); 115 return true; 116 } 117 return false; 118 } 119 120 @Override 121 public String getBaseName() { 122 return "Ruins Data Recovery"; 123 } 124 125 @Override 126 public String getBlurbText() { 127 return null; // this should be done via rules.csv 128// return "The " + department + " department has turned up records of a data cache on " + 129// planet.getName() + " in the " + planet.getStarSystem().getNameWithNoType() + " system; " + 130// "they just need someone to go find it and transmit the contents back to the Academy."; 131 } 132 133} 134 135