1package com.fs.starfarer.api.impl.campaign.intel.events;
3import java.util.Random;
7import org.lwjgl.util.vector.Vector2f;
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.CampaignFleetAPI;
11import com.fs.starfarer.api.campaign.CargoAPI;
12import com.fs.starfarer.api.campaign.FactionAPI;
13import com.fs.starfarer.api.campaign.InteractionDialogAPI;
14import com.fs.starfarer.api.campaign.StarSystemAPI;
15import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin.ListInfoMode;
16import com.fs.starfarer.api.campaign.econ.Industry;
17import com.fs.starfarer.api.campaign.econ.MarketAPI;
18import com.fs.starfarer.api.campaign.listeners.ColonyPlayerHostileActListener;
19import com.fs.starfarer.api.impl.campaign.NPCHassler;
20import com.fs.starfarer.api.impl.campaign.ids.Conditions;
21import com.fs.starfarer.api.impl.campaign.ids.Factions;
22import com.fs.starfarer.api.impl.campaign.ids.FleetTypes;
23import com.fs.starfarer.api.impl.campaign.ids.Industries;
24import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
25import com.fs.starfarer.api.impl.campaign.ids.Stats;
26import com.fs.starfarer.api.impl.campaign.intel.PerseanLeagueMembership;
27import com.fs.starfarer.api.impl.campaign.intel.events.BaseEventIntel.EventStageData;
28import com.fs.starfarer.api.impl.campaign.intel.events.HostileActivityEventIntel.HAERandomEventData;
29import com.fs.starfarer.api.impl.campaign.intel.events.HostileActivityEventIntel.Stage;
30import com.fs.starfarer.api.impl.campaign.intel.group.FGBlockadeAction.FGBlockadeParams;
31import com.fs.starfarer.api.impl.campaign.intel.group.FleetGroupIntel;
32import com.fs.starfarer.api.impl.campaign.intel.group.FleetGroupIntel.FGIEventListener;
33import com.fs.starfarer.api.impl.campaign.intel.group.GenericRaidFGI.GenericRaidParams;
34import com.fs.starfarer.api.impl.campaign.intel.group.PerseanLeagueBlockade;
35import com.fs.starfarer.api.impl.campaign.intel.group.PerseanLeaguePunitiveExpedition;
36import com.fs.starfarer.api.impl.campaign.missions.FleetCreatorMission;
37import com.fs.starfarer.api.impl.campaign.missions.FleetCreatorMission.FleetStyle;
38import com.fs.starfarer.api.impl.campaign.procgen.StarSystemGenerator;
39import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD.TempData;
40import com.fs.starfarer.api.ui.LabelAPI;
41import com.fs.starfarer.api.ui.TooltipMakerAPI;
42import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipCreator;
43import com.fs.starfarer.api.util.Misc;
69 return super.getProgress(
intel);
73 return "Persean League";
77 return "Persean League";
90 public void createTooltip(
TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
92 tooltip.
addPara(
"A large independent polity is a tantalizing prize for the Persean League, and "
93 +
"they will go quite far in exerting pressure for you to join them. League "
94 +
"\"enforcer\" fleets prowl your systems, ostensibly to protect the League's "
95 +
"interests in \"unclaimed territory\".", 0f);
136 int difficulty = 0 + (int) Math.max(1f, Math.round(f * 4f));
137 difficulty += random.nextInt(6);
170 ListInfoMode mode,
boolean isUpdate, Color tc,
float initPad) {
173 info.
addPara(
"Impending Persean League blockade", initPad, tc, c,
"Persean League");
177 ListInfoMode mode,
boolean isUpdate, Color tc,
float initPad) {
178 info.
addPara(
"Persean League blockade averted", tc, initPad);
187 info.
addPara(
"You've received intel that the Persean League is planning a lengthy blockade of one of your systems. "
188 +
"Colonies in that system will suffer a major accessibility penalty for as long as the blockade lasts.",
201 LabelAPI label = info.
addPara(
"If the blockading force is defeated, your colonies will be viewed as "
202 +
"a more stable trading partner, resulting in increased accessibility, "
203 +
"and the Persean League will likely abandon "
204 +
"further efforts to strong-arm you and be more open to negotiation.",
206 label.
setHighlight(
"increased accessibility",
"Persean League");
211 stage.beginResetReqList(info,
true,
"crisis", opad);
212 info.
addPara(
"You go to %s and make an agreement about joining the League", 0f, c,
"Kazeron");
213 info.
addPara(
"%s is tactically bombarded", 0f, c,
"Kazeron");
215 stage.endResetReqList(info,
false,
"crisis", -1, -1);
226 if (stage.id == Stage.HA_EVENT) {
234 if (stage.id == Stage.HA_EVENT) {
248 if (target !=
null && source !=
null) {
257 HAERandomEventData data =
new HAERandomEventData(
this, stage);
258 stage.rollData = data;
265 if (source ==
null || target ==
null) {
269 stage.rollData =
null;
297 if (requireMilitaryBase) {
309 if (faction !=
null) {
317 GenericRaidParams params =
new GenericRaidParams(
new Random(random.nextLong()),
true);
319 params.source = source;
321 params.prepDays = 7f + random.nextFloat() * 14f;
322 params.payloadDays = 365f;
324 params.makeFleetsHostile =
false;
326 FGBlockadeParams bParams =
new FGBlockadeParams();
327 bParams.where = target;
331 params.style = FleetStyle.STANDARD;
339 float totalDifficulty = fleetSizeMult * 50f * (0.5f + 0.5f * f);
340 if (totalDifficulty < 30) {
343 if (totalDifficulty > 100) {
344 totalDifficulty = 100;
348 totalDifficulty -= 10;
349 totalDifficulty -= 5;
350 totalDifficulty -= 4;
351 totalDifficulty -= 1;
352 totalDifficulty -= 1;
353 params.fleetSizes.add(10);
354 params.fleetSizes.add(5);
355 params.fleetSizes.add(4);
356 params.fleetSizes.add(1);
357 params.fleetSizes.add(1);
362 while (totalDifficulty > 0) {
366 if (r.nextFloat() > 0.3f) {
367 min = (int) Math.min(totalDifficulty, 10f);
368 max = (int) Math.min(totalDifficulty, 10f);
374 params.fleetSizes.add(diff);
375 totalDifficulty -= diff;
405 TempData actionData,
CargoAPI cargo) {
415 if (market !=
null && market == kazeron) {
418 boolean thisEvent = stage.rollData instanceof HAERandomEventData &&
419 ((HAERandomEventData)stage.rollData).factor ==
this;
443 super.advance(amount);
450 if (stage !=
null && stage.rollData instanceof HAERandomEventData &&
451 ((HAERandomEventData)stage.rollData).factor ==
this) {
static SettingsAPI getSettings()
static SectorAPI getSector()
float computeEffective(float baseValue)
static final String DECIVILIZED
static final String PERSEAN
static final String PLAYER
static final String LEAGUE_ENFORCER
static final String HIGHCOMMAND
static final String MILITARYBASE
static final String FACTION_SATURATION_BOMBARED_BY_PLAYER
static final String COMBAT_FLEET_SIZE_MULT
void sendUpdateIfPlayerHasIntel(Object listInfoParam, TextPanelAPI textPanel)
static void setDefeatedBlockade(boolean value)
void addBorder(TooltipMakerAPI info, Color c)
EventStageData getDataFor(Object stageId)
static boolean checkFactionExists(String factionId, boolean requireMilitary)
Random getRandomizedStageRandom()
TooltipCreator getDefaultEventTooltip(final String title, final HostileActivityEventIntel intel, final EventStageData stage)
HostileActivityEventIntel intel
void addFactor(EventFactor factor)
float getMarketPresenceFactor(StarSystemAPI system)
boolean fireEvent(HostileActivityEventIntel intel, EventStageData stage)
void reportSaturationBombardmentFinished(InteractionDialogAPI dialog, MarketAPI market, TempData actionData)
void reportFGIAborted(FleetGroupIntel intel)
void reportTacticalBombardmentFinished(InteractionDialogAPI dialog, MarketAPI market, TempData actionData)
TooltipCreator getMainRowTooltip(BaseEventIntel intel)
CampaignFleetAPI createFleet(StarSystemAPI system, Random random)
MarketAPI getBlockadeSource(HostileActivityEventIntel intel, EventStageData stage, final StarSystemAPI target)
void reportRaidForValuablesFinishedBeforeCargoShown(InteractionDialogAPI dialog, MarketAPI market, TempData actionData, CargoAPI cargo)
void addStageDescriptionForEvent(HostileActivityEventIntel intel, EventStageData stage, TooltipMakerAPI info)
static boolean wasPLEverSatBombardedByPlayer()
int getMaxNumFleets(StarSystemAPI system)
void advance(float amount)
TooltipCreator getStageTooltipImpl(final HostileActivityEventIntel intel, final EventStageData stage)
int getProgress(BaseEventIntel intel)
String getDesc(BaseEventIntel intel)
String getEventStageIcon(HostileActivityEventIntel intel, EventStageData stage)
String getNameForThreatList(boolean first)
Color getDescColor(BaseEventIntel intel)
static StarSystemAPI findBlockadeTarget(HostileActivityEventIntel intel, EventStageData stage)
void addBulletPointForEvent(HostileActivityEventIntel intel, EventStageData stage, TooltipMakerAPI info, ListInfoMode mode, boolean isUpdate, Color tc, float initPad)
float getSpawnInHyperProbability(StarSystemAPI system)
String getProgressStr(BaseEventIntel intel)
static MarketAPI getKazeron(boolean requireMilitaryBase)
float getEventFrequency(HostileActivityEventIntel intel, EventStageData stage)
void rollEvent(HostileActivityEventIntel intel, EventStageData stage)
void reportRaidToDisruptFinished(InteractionDialogAPI dialog, MarketAPI market, TempData actionData, Industry industry)
boolean startBlockade(MarketAPI source, StarSystemAPI target, EventStageData stage, Random random)
Color getNameColor(float mag)
boolean shouldShow(BaseEventIntel intel)
static final String HASSLE_REASON
void notifyFactorRemoved()
PerseanLeagueHostileActivityFactor(HostileActivityEventIntel intel)
void addBulletPointForEventReset(HostileActivityEventIntel intel, EventStageData stage, TooltipMakerAPI info, ListInfoMode mode, boolean isUpdate, Color tc, float initPad)
void setListener(FGIEventListener listener)
static PerseanLeagueBlockade get()
static PerseanLeaguePunitiveExpedition get()
CampaignFleetAPI createFleet()
void createStandardFleet(int difficulty, String factionId, Vector2f locInHyper)
void triggerFleetAllowLongPursuit()
void triggerMakeLowRepImpact()
void triggerSetFleetType(String fleetType)
void triggerSetFleetFlag(String flag)
void triggerSetFleetHasslePlayer(String hassleType)
static float getNormalRandom(float min, float max)
static Color getNegativeHighlightColor()
static List< StarSystemAPI > getPlayerSystems(boolean includeNonPlayerFaction)
static Color getGrayColor()
static Color getPositiveHighlightColor()
MemoryAPI getMemoryWithoutUpdate()
IntelManagerAPI getIntelManager()
FactionAPI getFaction(String factionId)
ListenerManagerAPI getListenerManager()
void addScript(EveryFrameScript script)
void addIntel(IntelInfoPlugin plugin)
MarketAPI getMarket(String id)
MutableMarketStatsAPI getStats()
Industry getIndustry(String id)
boolean hasCondition(String id)
void addListener(Object listener)
void removeListener(Object listener)
DynamicStatsAPI getDynamic()
void setHighlight(int start, int end)
void setHighlightColors(Color ... colors)
StatBonus getMod(String id)