1package com.fs.starfarer.api.impl.campaign;
3import java.util.ArrayList;
4import java.util.HashMap;
7import java.util.Random;
11import org.lwjgl.input.Keyboard;
13import com.fs.starfarer.api.Global;
14import com.fs.starfarer.api.campaign.BattleAPI;
15import com.fs.starfarer.api.campaign.BattleAPI.BattleSide;
16import com.fs.starfarer.api.campaign.CampaignFleetAPI;
17import com.fs.starfarer.api.campaign.CargoAPI;
18import com.fs.starfarer.api.campaign.CoreInteractionListener;
19import com.fs.starfarer.api.campaign.EngagementResultForFleetAPI;
20import com.fs.starfarer.api.campaign.FactionAPI;
21import com.fs.starfarer.api.campaign.FleetEncounterContextPlugin.DataForEncounterSide;
22import com.fs.starfarer.api.campaign.FleetEncounterContextPlugin.DisengageHarryAvailability;
23import com.fs.starfarer.api.campaign.FleetEncounterContextPlugin.EngagementOutcome;
24import com.fs.starfarer.api.campaign.FleetEncounterContextPlugin.PursueAvailability;
25import com.fs.starfarer.api.campaign.FleetEncounterContextPlugin.Status;
26import com.fs.starfarer.api.campaign.FleetMemberPickerListener;
27import com.fs.starfarer.api.campaign.InteractionDialogAPI;
28import com.fs.starfarer.api.campaign.InteractionDialogPlugin;
29import com.fs.starfarer.api.campaign.OptionPanelAPI;
30import com.fs.starfarer.api.campaign.RuleBasedDialog;
31import com.fs.starfarer.api.campaign.SectorEntityToken;
32import com.fs.starfarer.api.campaign.SectorEntityToken.VisibilityLevel;
33import com.fs.starfarer.api.campaign.TextPanelAPI;
34import com.fs.starfarer.api.campaign.VisualPanelAPI;
35import com.fs.starfarer.api.campaign.ai.CampaignFleetAIAPI;
36import com.fs.starfarer.api.campaign.ai.CampaignFleetAIAPI.EncounterOption;
37import com.fs.starfarer.api.campaign.ai.CampaignFleetAIAPI.InitialBoardingResponse;
38import com.fs.starfarer.api.campaign.ai.CampaignFleetAIAPI.PursuitOption;
39import com.fs.starfarer.api.campaign.events.CampaignEventPlugin;
40import com.fs.starfarer.api.campaign.listeners.ListenerUtil;
41import com.fs.starfarer.api.campaign.rules.MemKeys;
42import com.fs.starfarer.api.campaign.rules.MemoryAPI;
43import com.fs.starfarer.api.campaign.rules.RuleAPI;
44import com.fs.starfarer.api.campaign.rules.RulesAPI;
45import com.fs.starfarer.api.characters.PersonAPI;
46import com.fs.starfarer.api.combat.BattleCreationContext;
47import com.fs.starfarer.api.combat.CombatReadinessPlugin;
48import com.fs.starfarer.api.combat.EngagementResultAPI;
49import com.fs.starfarer.api.fleet.CrewCompositionAPI;
50import com.fs.starfarer.api.fleet.FleetGoal;
51import com.fs.starfarer.api.fleet.FleetMemberAPI;
52import com.fs.starfarer.api.impl.campaign.FleetEncounterContext.BoardingResult;
53import com.fs.starfarer.api.impl.campaign.FleetEncounterContext.EngageBoardableOutcome;
54import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
55import com.fs.starfarer.api.impl.campaign.ids.Sounds;
56import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
57import com.fs.starfarer.api.impl.campaign.rulecmd.DumpMemory;
58import com.fs.starfarer.api.impl.campaign.rulecmd.FireBest;
59import com.fs.starfarer.api.impl.campaign.rulecmd.SetStoryOption;
60import com.fs.starfarer.api.impl.campaign.rulecmd.SetStoryOption.BaseOptionStoryPointActionDelegate;
61import com.fs.starfarer.api.impl.campaign.rulecmd.SetStoryOption.StoryOptionParams;
62import com.fs.starfarer.api.impl.campaign.skills.BaseSkillEffectDescription;
63import com.fs.starfarer.api.impl.combat.CRPluginImpl;
64import com.fs.starfarer.api.ui.LabelAPI;
65import com.fs.starfarer.api.ui.TooltipMakerAPI;
66import com.fs.starfarer.api.util.Misc;
67import com.fs.starfarer.api.util.Pair;
75 public static interface FIDConfigGen {
76 FIDConfig createConfig();
79 public static class FIDConfig {
80 public boolean showCommLinkOption =
true;
81 public boolean leaveAlwaysAvailable =
false;
82 public boolean showWarningDialogWhenNotHostile =
true;
83 public boolean showTransponderStatus =
true;
84 public boolean showFleetAttitude =
true;
85 public boolean showEngageText =
true;
86 public boolean alwaysAttackVsAttack =
false;
87 public boolean alwaysPursue =
false;
88 public boolean alwaysHarry =
false;
89 public boolean alwaysLetGo =
false;
90 public boolean dismissOnLeave =
true;
91 public boolean withSalvage =
true;
92 public boolean lootCredits =
true;
94 public boolean showCrRecoveryText =
true;
96 public boolean showVictoryText =
true;
100 public boolean impactsEnemyReputation =
true;
101 public boolean impactsAllyReputation =
true;
103 public boolean pullInAllies =
true;
104 public boolean pullInEnemies =
true;
105 public boolean pullInStations =
true;
108 public String noSalvageLeaveOptionText =
null;
109 public String firstTimeEngageOptionText =
null;
110 public String afterFirstTimeEngageOptionText =
null;
112 public FIDDelegate delegate =
null;
113 public boolean printXPToDialog =
false;
115 public boolean justShowFleets =
false;
116 public boolean showPullInText =
true;
118 public boolean straightToEngage =
false;
119 public boolean playerAttackingStation =
false;
120 public boolean playerDefendingStation =
false;
130 public boolean noLeaveOptionOnFirstEngagement =
false;
133 public Random salvageRandom =
null;
136 public static interface FIDDelegate {
142 public static class BaseFIDDelegate
implements FIDDelegate {
143 public void battleContextCreated(InteractionDialogAPI
dialog, BattleCreationContext bcc) {}
144 public void notifyLeave(InteractionDialogAPI
dialog) {}
145 public void postPlayerSalvageGeneration(InteractionDialogAPI
dialog, FleetEncounterContext
context, CargoAPI salvage) {}
151 protected static enum VisualType {
157 public static enum OptionId {
159 PRINT_ONGOING_BATTLE_INFO,
160 BEGIN_FLEET_ENCOUNTER_2,
165 ATTEMPT_TO_DISENGAGE,
181 CONTINUE_FROM_VICTORY_TRIGGERS,
183 CONTINUE_INTO_BATTLE,
185 CONTINUE_INTO_BOARDING,
190 ABORT_BOARDING_ACTION,
192 LAUNCH_ASSAULT_TEAMS,
202 CONTINUE_ONGOING_BATTLE,
253 this.config = params;
270 private boolean skipAttitudeOnInit =
false;
271 public void reinit(
boolean withContinueOnRuleFound) {
274 if (rule ==
null || !withContinueOnRuleFound) {
314 if (this.config ==
null) {
322 this.config =
new FIDConfig();
365 fleet.inflateIfNeeded();
370 if (!
config.straightToEngage) {
374 if (b.
getSideOne().size() > 1) titleOne +=
", with allies";
376 if (b.
getSideTwo().size() > 1) titleTwo +=
", with allies";
392 if (!
config.justShowFleets) {
419 if (
config.straightToEngage) {
438 protected List<CampaignFleetAPI>
pulledIn =
new ArrayList<CampaignFleetAPI>();
465 closestEntity = p.
one;
469 if (closest !=
null) {
470 BattleSide joiningSide = b.
pickSide(closest,
true);
471 boolean canJoin = joiningSide != BattleSide.NO_JOIN;
472 if (!
config.pullInAllies && joiningSide == playerSide) {
475 if (!
config.pullInEnemies && joiningSide != playerSide) {
486 if (closestEntity !=
null) {
492 if (!
config.straightToEngage &&
config.showPullInText) {
511 if (b == fleet.getBattle())
continue;
512 if (fleet.getBattle() !=
null)
continue;
514 if (fleet.isStationMode())
continue;
518 dist -= fleet.getRadius();
523 if (fleet.getFleetData().getNumMembers() <= 0)
continue;
526 boolean visible = fleet.isVisibleToPlayerFleet();
527 VisibilityLevel level = fleet.getVisibilityLevelToPlayerFleet();
533 if (fleet.getFaction().isPlayerFaction() && !fleet.isStationMode()) {
536 if (dist < joinRange &&
537 (dist < baseSensorRange || (visible && level != VisibilityLevel.SENSOR_CONTACT)) &&
538 ((fleet.getAI() !=
null && fleet.getAI().wantsToJoin(b,
true)) || fleet.isStationMode())) {
540 boolean ignore = fleet.getMemoryWithoutUpdate() !=
null &&
542 if (ignore)
continue;
544 BattleSide joiningSide = b.
pickSide(fleet,
true);
545 if (!
config.pullInAllies && joiningSide == playerSide)
continue;
546 if (!
config.pullInEnemies && joiningSide != playerSide)
continue;
551 if (!
config.straightToEngage &&
config.showPullInText) {
569 curr.inflateIfNeeded();
580 if (!
config.straightToEngage) {
617 boolean startedWithAllies =
false;
637 if (captain !=
null && !captain.
isPlayer()) {
656 if ((
int)crewLosses.
getCrewInt() + (
int)crewLosses.
getMarines() > 0 && !totalDefeat && !mutualDestruction) {
660 int crewLost = (int) (data.getCrewLossesDuringLastEngagement().
getCrewInt());
661 int marinesLost = (int) (data.getCrewLossesDuringLastEngagement().
getMarines());
663 if (crewLostStr.equals(
"no")) crewLostStr =
"";
664 if (crewLostStr.indexOf(
" ") >= 0) {
665 crewLostStr = crewLostStr.substring(crewLostStr.indexOf(
" ") + 1);
668 if (marinesLostStr.equals(
"no")) marinesLostStr =
"";
669 if (marinesLostStr.indexOf(
" ") >= 0) {
670 marinesLostStr = marinesLostStr.substring(marinesLostStr.indexOf(
" ") + 1);
678 case PURSUIT_PLAYER_OUT_FIRST_WIN:
682 case PURSUIT_PLAYER_OUT_FIRST_LOSS:
686 case BATTLE_PLAYER_OUT_FIRST_WIN:
690 case BATTLE_PLAYER_OUT_FIRST_LOSS:
694 case ESCAPE_PLAYER_OUT_FIRST_WIN:
698 case ESCAPE_PLAYER_OUT_FIRST_LOSS:
702 case BATTLE_ENEMY_WIN:
707 case BATTLE_ENEMY_WIN_TOTAL:
711 case BATTLE_PLAYER_WIN:
712 if (
config.showVictoryText) {
717 case BATTLE_PLAYER_WIN_TOTAL:
718 if (
config.showVictoryText) {
723 case ESCAPE_ENEMY_LOSS_TOTAL:
724 if (
config.showVictoryText) {
729 case ESCAPE_ENEMY_SUCCESS:
737 case ESCAPE_ENEMY_WIN:
741 case ESCAPE_ENEMY_WIN_TOTAL:
745 case ESCAPE_PLAYER_LOSS_TOTAL:
749 case ESCAPE_PLAYER_SUCCESS:
753 case ESCAPE_PLAYER_WIN:
757 case ESCAPE_PLAYER_WIN_TOTAL:
761 case MUTUAL_DESTRUCTION:
766 if (mutualDestruction) {
769 otherData.addEnemy(member, Status.DISABLED);
775 if (last == EngagementOutcome.BATTLE_PLAYER_OUT_FIRST_LOSS ||
776 last == EngagementOutcome.BATTLE_PLAYER_OUT_FIRST_WIN) {
778 if (recoveryFraction > 0) {
779 if (
config.showCrRecoveryText) {
785 if (recoveryFraction > 0) {
786 if (
config.showCrRecoveryText) {
804 if (
config.straightToEngage) {
825 if (!
config.showFleetAttitude)
return;
830 if (!otherWantsToRun) {
863 List<FleetMemberAPI> members =
new ArrayList<FleetMemberAPI>();
865 if (member.isAlly())
continue;
866 if (member.isCivilian())
continue;
873 if (optionData ==
null)
return;
894 if (optionData instanceof String) {
900 OptionId option = (OptionId) optionData;
912 case PRINT_ONGOING_BATTLE_INFO:
921 if (!
config.straightToEngage) {
922 if (side == sideAssumingTransponderOn && side == BattleSide.NO_JOIN) {
924 }
else if (side != sideAssumingTransponderOn && side == BattleSide.NO_JOIN) {
941 if (!
config.straightToEngage) {
942 if (side == sideAssumingTransponderOn && side == BattleSide.NO_JOIN) {
944 }
else if (side != sideAssumingTransponderOn && side == BattleSide.NO_JOIN) {
958 if (!skipAttitudeOnInit) {
963 if (
config.showFleetAttitude) {
964 boolean hasStation =
false;
965 boolean allStation =
true;
967 allStation &= curr.isStationMode();
968 hasStation |= curr.isStationMode();
1027 case REINIT_CONTINUE:
1030 case INITIATE_BATTLE:
1065 case JOIN_ONGOING_BATTLE:
1069 fleet.inflateIfNeeded();
1112 addText(
"Failed to join battle; shouldn't happen.");
1116 case CONTINUE_ONGOING_BATTLE:
1120 if (
config.showEngageText) {
1125 boolean forceEngage = option == OptionId.FORCE_ENGAGE;
1129 if (
config.showEngageText) {
1135 if (
config.showEngageText) {
1141 case CONTINUE_INTO_BATTLE:
1152 if (
config.alwaysAttackVsAttack){
1161 boolean regen =
false;
1187 bcc.objectivesAllowed =
false;
1189 if (
config.delegate !=
null) {
1208 if (
config.delegate !=
null) {
1230 case CLEAN_DISENGAGE:
1236 po = PursuitOption.LET_THEM_GO;
1264 case ATTEMPT_TO_DISENGAGE:
1265 boolean letGo =
true;
1269 if (pursuitOption == PursuitOption.PURSUE) {
1275 }
else if (pursuitOption == PursuitOption.HARRY) {
1292 if (dha == DisengageHarryAvailability.AVAILABLE || pa == PursueAvailability.AVAILABLE) {
1315 case BEGIN_FLEET_ENCOUNTER_2:
1333 if (otherWantsToRun) {
1334 mem.
unset(
"$weakerThanPlayerButHolding");
1338 addText(
"You try to establish a comm link, but only get static.");
1369 case AUTORESOLVE_PURSUE:
1378 4, 8, 58f,
false,
true, members,
1380 public void pickedFleetMembers(List<FleetMemberAPI> members) {
1381 if (members !=
null && !members.isEmpty()) {
1391 if (!curr.isPlayerFleet() && !curr.getFleetData().getMembersListCopy().isEmpty() &&
1392 !curr.isStationMode()) {
1393 if (ally ==
null) ally = curr;
1397 float playerFP = 0f;
1399 playerFP += member.getFleetPointCost();
1403 damage += member.getFleetPointCost();
1406 damage += member.getFleetPointCost();
1408 float total = playerFP + alliedFP;
1409 if (total < 1) total = 1;
1411 if (ally !=
null && alliedFP > 0) {
1419 public void cancelledFleetMemberPicking() {
1424 case CRASH_MOTHBALL:
1427 3, 7, 58f,
false,
true, choices,
1429 public void pickedFleetMembers(List<FleetMemberAPI> members) {
1431 member.getRepairTracker().setCrashMothballed(
false);
1433 if (members !=
null && !members.isEmpty()) {
1435 member.getRepairTracker().setCrashMothballed(
true);
1439 if (members.size() == 1) {
1446 public void cancelledFleetMemberPicking() {
1453 case GO_TO_PRE_BATTLE:
1457 if (
config.straightToEngage) {
1474 if (b.
getSideOne().size() > 1) titleOne +=
", with allies";
1476 if (b.
getSideTwo().size() > 1) titleTwo +=
", with allies";
1502 case DEV_MODE_ESCAPE:
1509 case LOOT_THEN_LEAVE:
1514 case CONTINUE_LEAVE:
1515 if (option != OptionId.CONTINUE_LEAVE) {
1517 config.impactsAllyReputation,
config.impactsEnemyReputation)) {
1520 if (!
config.straightToEngage) {
1521 options.
setShortcut(OptionId.CONTINUE_LEAVE, Keyboard.KEY_ESCAPE,
false,
false,
false,
true);
1546 if (
config.printXPToDialog) {
1564 if (
config.dismissOnLeave) {
1571 if (
config.delegate !=
null) {
1591 case RECOVERY_CONTINUE:
1594 case RECOVERY_SELECT:
1595 if (!recoverableShips.isEmpty() || !storyRecoverableShips.isEmpty()) {
1597 recoverableShips, storyRecoverableShips,
1599 public void pickedFleetMembers(List<FleetMemberAPI> members) {
1600 if (members !=
null && !members.isEmpty()) {
1601 recoveredShips.clear();
1602 recoveredShips.addAll(members);
1616 public void cancelledFleetMemberPicking() {
1621 case CONTINUE_FROM_VICTORY_TRIGGERS:
1632 public void coreUIDismissed() {
1633 if (
config.printXPToDialog) {
1644 if (
config.dismissOnLeave) {
1655 if (
config.delegate !=
null) {
1664 case CONTINUE_INTO_BOARDING:
1667 case BOARDING_ACTION:
1674 case SELECT_FLAGSHIP:
1675 members =
new ArrayList<FleetMemberAPI>();
1680 members.add(member);
1682 if (!members.isEmpty()) {
1684 3, 7, 58f,
false,
false, members,
1686 public void pickedFleetMembers(List<FleetMemberAPI> members) {
1687 if (members !=
null && !members.isEmpty()) {
1697 if (!members.get(0).isFlagship()) {
1710 public void cancelledFleetMemberPicking() {
1716 case ENGAGE_BOARDABLE:
1767 MemoryAPI mem = other.getMemoryWithoutUpdate();
1778 if (captain !=
null) {
1779 member.setCaptain(captain);
1794 if (enemyData !=
null && playerData !=
null && enemyData.disengaged() && !playerData.disengaged()) {
1813 boolean finished =
false;
1814 if (last == EngagementOutcome.BATTLE_PLAYER_WIN_TOTAL) {
1815 List<CampaignFleetAPI> other = b.
getSide(otherSide);
1816 if (other !=
null && other.size() == 1) {
1825 if (last == EngagementOutcome.ESCAPE_ENEMY_SUCCESS ||
1826 last == EngagementOutcome.ESCAPE_PLAYER_SUCCESS ||
1864 protected Map<FleetMemberAPI, PersonAPI>
origCaptains =
new HashMap<FleetMemberAPI, PersonAPI>();
1879 (
config.straightToEngage &&
1914 if (mutualDestruction) {
1926 if (!otherHasReadyShips) {
1966 if (!mutualDestruction) {
1987 if (
config.salvageRandom !=
null) {
1993 String leave =
"Leave";
1994 if (
config.straightToEngage) {
1998 if (!
config.straightToEngage) {
2022 boolean firedAnyTriggers =
false;
2029 MemoryAPI mem = other.getMemoryWithoutUpdate();
2031 List<FleetMemberAPI> remaining = other.getFleetData().getMembersListCopy();
2035 int fpRemaining = 0;
2037 fpLost += curr.getFleetPointCost();
2038 fpTotal += curr.getFleetPointCost();
2041 fpRemaining += curr.getFleetPointCost();
2042 fpTotal += curr.getFleetPointCost();
2045 mem.
set(
"$someShipsDestroyed", !losses.isEmpty(), 0);
2046 mem.
set(
"$fpLost", fpLost, 0);
2047 mem.
set(
"$fpRemaining", fpRemaining, 0);
2048 mem.
set(
"$fpLostFraction", (
float) fpLost / Math.max(1, fpTotal), 0);
2049 mem.
set(
"$battle", battle, 0);
2052 if (triggers !=
null) {
2054 for (String trigger :
new ArrayList<String>(triggers)) {
2057 triggers.remove(trigger);
2058 firedAnyTriggers =
true;
2069 if (firedAnyTriggers) {
2070 options.
addOption(
"Continue", OptionId.CONTINUE_FROM_VICTORY_TRIGGERS,
null);
2077 if ((
int)playerData.getRecoverableCrewLosses().
getCrewInt() + (
int)playerData.getRecoverableCrewLosses().
getMarines() > 0) {
2080 int crewRecovered = (int) data.getRecoverableCrewLosses().
getCrew();
2081 int marinesRecovered = (int) data.getRecoverableCrewLosses().
getMarines();
2082 String crewRecStr =
"" + crewRecovered;
2083 if (crewRecovered <= 0) {
2086 String marinesRecStr =
"" + marinesRecovered;
2087 if (marinesRecovered <= 0) {
2113 if (recoverableShips ==
null) recoverableShips =
new ArrayList<FleetMemberAPI>();
2114 if (storyRecoverableShips ==
null) storyRecoverableShips =
new ArrayList<FleetMemberAPI>();
2116 if (!recoverableShips.isEmpty() || !storyRecoverableShips.isEmpty()) {
2120 int num = recoverableShips.size() + storyRecoverableShips.size();
2121 String numString =
"several ships disabled or destroyed";
2122 if (num == 1) numString =
"a ship disabled";
2123 String pre =
"The salvage chief reports that " + numString +
" during the battle " +
2124 "can be restored to basic functionalty. Recovering ships instead of breaking " +
2125 "them for salvage will greatly reduce the salvage gained from these ships.";
2137 boolean playerShipsRecoverable =
false;
2139 if (member.getOwner() == 0 && !member.isAlly()) {
2140 playerShipsRecoverable =
true;
2145 if (member.getOwner() == 0 && !member.isAlly()) {
2146 playerShipsRecoverable =
true;
2151 boolean onlyDifficultRecovery = recoverableShips.isEmpty() && !storyRecoverableShips.isEmpty();
2152 if (playerShipsRecoverable) {
2157 "Disabled ships from your fleet are available for recovery.");
2160 if (onlyDifficultRecovery) {
2163 options.
addOption(
"Consider ship recovery", OptionId.RECOVERY_SELECT, color,
null);
2167 if (playerShipsRecoverable) {
2169 "Disabled ships from your fleet are available for recovery.\n\nIf you proceed without recovering them, "
2170 +
"they will be lost permanently.",
"Proceed",
"Cancel");
2180 config.impactsAllyReputation,
config.impactsEnemyReputation);
2188 boolean hasAllies =
false;
2189 boolean startedWithAllies =
false;
2190 if (battle !=
null) {
2196 Random resetSalvageRandomTo =
null;
2198 if (
config.salvageRandom !=
null) {
2205 if (resetSalvageRandomTo !=
null) {
2206 config.salvageRandom = resetSalvageRandomTo;
2208 if (
config.delegate !=
null) {
2217 if (startedWithAllies) {
2223 if (startedWithAllies) {
2232 if (credits > 0 && validFleet) {
2243 options.
addOption(
"Pick through the wreckage", OptionId.CONTINUE_LOOT,
null);
2248 String leave =
"Leave";
2249 boolean withEscape =
true;
2251 leave =
config.noSalvageLeaveOptionText;
2262 List<FleetMemberAPI> result =
new ArrayList<FleetMemberAPI>();
2265 if (member.isAlly())
continue;
2266 if (!member.isFighterWing() && member.getRepairTracker().getCR() < crPlugin.
getMalfunctionThreshold(member.getStats())) {
2282 if (optionData instanceof String)
return;
2284 if (optionData ==
null) {
2292 OptionId option = (OptionId) optionData;
2300 String titleOne =
"Your forces";
2302 titleOne +=
", with allies";
2305 titleOne =
"Allied forces";
2307 String titleTwo =
null;
2325 protected void addText(String text, Color color) {
2328 protected void addText(String text, String hl, Color hlColor) {
2357 String percent =
"+" + (int) Math.round((diff - 1f) * 100f) +
"%";
2369 boolean canTransfer =
false;
2372 if (member.isFlagship())
continue;
2378 String tooltipText =
getString(
"tooltipPursueAutoresolve");
2379 options.
addOption(
"Order your second-in-command to handle it", OptionId.AUTORESOLVE_PURSUE, tooltipText);
2380 options.
addOption(
"Transfer command for this engagement", OptionId.SELECT_FLAGSHIP,
getString(
"tooltipSelectFlagship"));
2385 options.
addOption(
"Take command of the action", OptionId.CONTINUE_INTO_BATTLE,
null);
2387 options.
addOption(
"Transfer command for this engagement", OptionId.SELECT_FLAGSHIP,
getString(
"tooltipSelectFlagship"));
2395 options.
addOption(
"Crash-mothball some of your ships to prevent malfunctions", OptionId.CRASH_MOTHBALL,
null);
2396 if (choices.isEmpty()) {
2403 if (
config.straightToEngage) {
2404 options.
addOption(
"Continue into battle", OptionId.CONTINUE_INTO_BATTLE,
null);
2413 options.
setShortcut(OptionId.GO_TO_MAIN, Keyboard.KEY_ESCAPE,
false,
false,
false,
true);
2436 boolean last = members.indexOf(member) == members.size() - 1;
2437 boolean secondToLast = members.indexOf(member) == members.size() - 2;
2438 boolean fighter = member.isFighterWing();
2443 if (last && fighters == 0 && ships > 1) {
2444 if (members.size() > 2) {
2445 str +=
", and the " + member.getShipName();
2447 str +=
" and the " + member.getShipName();
2450 str +=
"the " + member.getShipName();
2453 if (!last && !secondToLast && !fighter) {
2457 if (last && fighters > 0) {
2458 if (fighters == 1) {
2460 str +=
"a fighter wing";
2463 str +=
", and a fighter wing";
2465 str +=
" and a fighter wing";
2470 str +=
"several fighter wings";
2473 str +=
", and several fighter wings";
2475 str +=
" and several fighter wings";
2494 boolean playerHasReadyShips =
false;
2496 if (!member.isAlly()) {
2497 playerHasReadyShips =
true;
2505 List<CampaignFleetAPI> otherSide = battle.
getOtherSide(side);
2506 if (otherSide !=
null) {
2508 boolean lowImpact =
false;
2510 if (otherPrimary !=
null) {
2516 config.showWarningDialogWhenNotHostile) {
2522 if (!playerHasReadyShips) {
2533 if (
config.showCommLinkOption) {
2559 private List<FleetMemberAPI> recoverableShips;
2560 private List<FleetMemberAPI> storyRecoverableShips;
2561 private List<FleetMemberAPI> recoveredShips =
new ArrayList<FleetMemberAPI>();
2576 if (
config.showCommLinkOption) {
2593 boolean playerHasReadyShips =
false;
2594 boolean allyHasReadyShips =
false;
2596 if (member.isAlly() && !member.isStation()) {
2597 allyHasReadyShips =
true;
2599 playerHasReadyShips =
true;
2618 }
else if (otherWantsToRun) {
2619 String pursueTooltip =
"tooltipPursue";
2620 String harassTooltip =
"tooltipHarassRetreat";
2621 String letThemGoTooltip =
"tooltipLetThemGo";
2623 letThemGoTooltip =
"tooltipLetThemGoNoPenalty";
2626 boolean canPursue =
false;
2627 boolean canHasass =
false;
2639 case LOST_LAST_ENGAGEMENT:
2640 pursueTooltip =
"tooltipPursueLostLast";
2642 case NO_READY_SHIPS:
2643 pursueTooltip =
"tooltipNoReadyShips";
2645 case TOOK_SERIOUS_LOSSES:
2651 pursueTooltip =
"tooltipPursueSeriousLosses";
2654 pursueTooltip =
"tooltipPursueTooSlow";
2662 case NO_READY_SHIPS:
2663 harassTooltip =
"tooltipNoReadyShips";
2668 boolean station =
false;
2671 if (member.isStation()) {
2679 boolean letGo = (!canPursue && !canHasass) || !allyHasReadyShips;
2682 alliedWantsToFight =
true;
2687 po = PursuitOption.PURSUE;
2688 if (alliedWantsToRun || alliedHolding || !alliedWantsToFight || letGo) {
2689 po = PursuitOption.LET_THEM_GO;
2691 if (!canPursue && canHasass) {
2692 po = PursuitOption.HARRY;
2702 if (!canPursue || !playerHasReadyShips) {
2738 options.
addOption(
"Perform a salvage operation, then leave", OptionId.LOOT_THEN_LEAVE,
null);
2739 options.
setShortcut(OptionId.LOOT_THEN_LEAVE, Keyboard.KEY_ESCAPE,
false,
false,
false,
true);
2747 boolean hostile =
false;
2754 if (playerHasReadyShips) {
2755 options.
addOption(
"Maneuver to force a pitched battle", OptionId.FORCE_ENGAGE,
"Outmaneuver the opposing fleet, forcing them to fight you head on.");
2762 config.showWarningDialogWhenNotHostile) {
2779 config.showWarningDialogWhenNotHostile) {
2792 if (!canPursue || !playerHasReadyShips) {
2795 if (!canHasass || !playerHasReadyShips) {
2801 if (alliedWantsToRun) {
2805 options.
addOption(
"Join the disengage attempt", OptionId.CONTINUE_ONGOING_BATTLE,
null);
2807 boolean station =
false;
2810 if (member.isStation()) {
2817 if (withText && !
config.straightToEngage) {
2827 if (playerHasReadyShips) {
2828 options.
addOption(
"Join the engagement", OptionId.CONTINUE_ONGOING_BATTLE,
null);
2838 String engageText =
"Move in to engage";
2840 engageText =
config.firstTimeEngageOptionText;
2843 engageText =
config.afterFirstTimeEngageOptionText;
2845 if (playerHasReadyShips) {
2853 config.showWarningDialogWhenNotHostile) {
2861 boolean hostile =
false;
2868 if (!
config.leaveAlwaysAvailable &&
2881 boolean addSPDisengage =
true;
2885 addSPDisengage =
true;
2888 boolean hasStation =
false;
2889 boolean allStation =
true;
2891 allStation &= curr.isStationMode();
2892 hasStation |= curr.isStationMode();
2901 addSPDisengage =
false;
2913 if (addSPDisengage) {
2915 options.
addOption(
"Disengage by executing a series of special maneuvers", OptionId.CLEAN_DISENGAGE,
2916 "Allows your fleet to disengage without being pursued.");
2963 final List<FleetMemberAPI> members =
new ArrayList<FleetMemberAPI>();
2966 final float hullThreshold = 0.4f;
2967 final float bonusRepairAmount = 0.1f;
2973 members.add(flagship);
2978 if (curr == flagship)
continue;
2979 if (curr.isMothballed())
continue;
2980 if (!curr.getCaptain().isDefault()) {
2981 if (curr.getStatus().getHullFraction() < hullThreshold ||
2982 curr.getRepairTracker().getBaseCR() < crThreshold) {
2986 if (members.size() > 12)
break;
3001 if (members.isEmpty())
return;
3003 options.
addOption(
"Perform limited emergency repairs", OptionId.EMERGENCY_REPAIRS,
3004 "Brings your flagship and a few officer-controlled ships back up to reasonable " +
3005 "combat readiness and repairs some hull damage.");
3006 StoryOptionParams params =
new StoryOptionParams(OptionId.EMERGENCY_REPAIRS,
3011 new BaseOptionStoryPointActionDelegate(
dialog, params) {
3013 public void confirm() {
3017 float shipDP = member.getDeploymentPointsCost();
3020 float fraction = dpRemaining / shipDP;
3021 if (fraction >= 0.99f) fraction = 1f;
3023 float baseRepairCRLevel = crThreshold + bonusRepairAmount * (float) Math.random();
3024 float baseRepairHullLevel = hullThreshold + bonusRepairAmount * (float) Math.random();
3026 float cr = member.getRepairTracker().getBaseCR();
3027 float repairedCR = cr + (baseRepairCRLevel - cr) * fraction;
3028 if (cr < repairedCR) {
3030 member.getRepairTracker().applyCREvent(repairedCR - cr,
"Emergency repairs");
3032 float hull = member.getStatus().getHullFraction();
3033 float repairedHull = hull + (baseRepairHullLevel - hull) * fraction;
3034 if (hull < repairedHull) {
3035 member.getStatus().setHullFraction(repairedHull);
3044 if (fraction < 1f) {
3056 super.createDescription(info);
3060 info.
addPara(
"Will bring up to %s deployment points worth of ships up " +
3061 "to approximately %s combat readiness and %s hull integrity. Starts with the " +
3062 "flagship and then goes on to officer-controlled ships, in the " +
3063 "order they are placed in the fleet. " +
3064 "Does not affect other ships.",
3067 "" + (
int) Math.round((crThreshold + bonusRepairAmount) * 100f) +
"%",
3068 "" + (
int) Math.round((hullThreshold + bonusRepairAmount) * 100f) +
"%"
3071 info.
addPara(
"The repairs will affect:", opad);
3073 float initPad = 10f;
3078 float shipDP = member.getDeploymentPointsCost();
3083 float fraction = dpRemaining / shipDP;
3084 if (fraction >= 0.99f) fraction = 1f;
3088 String post =
" (full effect)";
3089 if (fraction < 1) post =
" (partial effect)";
3091 info.
addPara(str + post, initPad);
3107 if (fleet.
getAI() ==
null)
return PursuitOption.LET_THEM_GO;
3109 if (
config.alwaysPursue) {
3110 return PursuitOption.PURSUE;
3112 if (
config.alwaysHarry) {
3113 return PursuitOption.HARRY;
3115 if (
config.alwaysLetGo) {
3116 return PursuitOption.LET_THEM_GO;
3119 boolean allStation =
false;
3120 boolean hasStation =
false;
3127 allStation &= curr.isStationMode();
3128 hasStation |= curr.isStationMode();
3134 if (hasStation && option == PursuitOption.HARRY) {
3136 return PursuitOption.LET_THEM_GO;
3156 if (otherSide !=
null) {
3158 if (!player.
isHostileTo(other.getFaction()) && other.getFleetPoints() > max) {
3164 return result ==
null ? null : result.
getFaction();
3169 if (last == EngagementOutcome.BATTLE_PLAYER_OUT_FIRST_WIN ||
3170 last == EngagementOutcome.BATTLE_PLAYER_OUT_FIRST_LOSS ||
3171 last == EngagementOutcome.PURSUIT_PLAYER_OUT_FIRST_WIN ||
3172 last == EngagementOutcome.PURSUIT_PLAYER_OUT_FIRST_LOSS ||
3173 last == EngagementOutcome.ESCAPE_PLAYER_OUT_FIRST_WIN ||
3174 last == EngagementOutcome.ESCAPE_PLAYER_OUT_FIRST_LOSS
3185 if (member.canBeDeployedForCombat()) {
3186 total += member.getDeploymentPointsCost();
3203 if (member.canBeDeployedForCombat()) {
3204 total += member.getDeploymentPointsCost();
3213 return Math.min(abs, fraction);
3218 return data.isDidEnoughToDisengage();
3224 if (data.isWonLastEngagement())
return true;
3226 if (data.isDidEnoughToDisengage())
return true;
3230 if (member.isStation())
return true;
3236 (last == EngagementOutcome.BATTLE_PLAYER_OUT_FIRST_WIN ||
3237 last == EngagementOutcome.BATTLE_PLAYER_OUT_FIRST_LOSS ||
3238 last == EngagementOutcome.PURSUIT_PLAYER_OUT_FIRST_WIN ||
3239 last == EngagementOutcome.PURSUIT_PLAYER_OUT_FIRST_LOSS ||
3240 last == EngagementOutcome.ESCAPE_PLAYER_OUT_FIRST_WIN ||
3241 last == EngagementOutcome.ESCAPE_PLAYER_OUT_FIRST_LOSS)) {
3251 return pa != PursueAvailability.AVAILABLE;
3258 if (pa == PursueAvailability.TOO_SLOW && fleet ==
playerFleet) {
3259 pa = PursueAvailability.AVAILABLE;
3268 if (faction ==
null || faction.isEmpty()) {
3273 faction =
"opposing";
3279 String fleetOrShip =
"fleet";
3281 fleetOrShip =
"ship";
3283 fleetOrShip =
"fighter wing";
3286 String playerFleetOrShip =
"fleet";
3288 playerFleetOrShip =
"ship";
3290 playerFleetOrShip =
"fighter wing";
3296 int crewLost = (int) (data.getCrewLossesDuringLastEngagement().
getCrewInt());
3299 int marinesLost = (int) (data.getCrewLossesDuringLastEngagement().
getMarines());
3302 int crewRecovered = (int) data.getRecoverableCrewLosses().
getCrewInt();
3303 int marinesRecovered = (int) data.getRecoverableCrewLosses().
getMarines();
3305 String crewRecStr =
"" + crewRecovered;
3306 if (crewRecovered <= 0) {
3309 String marinesRecStr =
"" + marinesRecovered;
3310 if (marinesRecovered <= 0) {
3311 marinesRecStr =
"no";
3314 str = str.replaceAll(
"\\$crewLost", crewLostStr);
3315 str = str.replaceAll(
"\\$marinesLost", marinesLostStr);
3316 str = str.replaceAll(
"\\$crewLost", crewLostStr);
3317 str = str.replaceAll(
"\\$crewRecovered", crewRecStr);
3318 str = str.replaceAll(
"\\$marinesRecovered", marinesRecStr);
3323 str = str.replaceAll(
"\\$numLifeSigns",
getApproximate(numLifeSigns));
3328 str = str.replaceAll(
"\\$faction", faction);
3329 str = str.replaceAll(
"\\$fleetName", fleetName);
3330 str = str.replaceAll(
"\\$firstName", firstName);
3331 str = str.replaceAll(
"\\$lastName", lastName);
3332 str = str.replaceAll(
"\\$fleetOrShip", fleetOrShip);
3333 str = str.replaceAll(
"\\$playerFleetOrShip", playerFleetOrShip);
3350 str = str.replaceAll(
"\\$marines",
"" + marines);
3369 if (playerSide != BattleSide.NO_JOIN) {
3374 if (sideOnePrimary !=
null) {
3376 if (strOne.startsWith(
" ")) {
3383 if (fleet.getFaction() != sideOnePrimary.
getFaction()) {
3384 if (fleet.isPlayerFleet())
continue;
3385 strOne +=
" and their allies";
3389 str = str.replaceAll(
"\\$alliedFactionAndTheirAllies", strOne);
3391 if (sideTwoPrimary !=
null) {
3393 if (strTwo.startsWith(
" ")) {
3400 if (fleet.getFaction() != sideTwoPrimary.
getFaction()) {
3401 if (fleet.isPlayerFleet())
continue;
3402 strTwo +=
" and their allies";
3406 str = str.replaceAll(
"\\$enemyFactionAndTheirAllies", strTwo);
3410 String yourForcesWere =
"Your forces were";
3412 yourForcesWere =
"Your side was";
3414 str = str.replaceAll(
"\\$yourForcesWereOrYourSideWas", yourForcesWere);
3428 return "" + (int) value;
3432 int v = (int) value;
3433 String str =
"multiple";
3436 }
else if (v < 10) {
3438 }
else if (v < 100) {
3439 v = (int) Math.round((
float) v/10f) * 10;
3440 str =
"approximately " + v;
3441 }
else if (v < 1000) {
3442 v = (int) Math.round((
float) v/10f) * 10;
3443 str =
"approximately " + v;
3445 v = (int) Math.round((
float) v/100f) * 100;
3452 int v = (int) value;
3456 }
else if (v < 10) {
3458 }
else if (v < 100) {
3459 v = (int) Math.round((
float) v/10f) * 10;
3461 }
else if (v < 1000) {
3462 v = (int) Math.round((
float) v/10f) * 10;
3465 v = (int) Math.round((
float) v/100f) * 100;
3493 if (
config.alwaysAttackVsAttack)
return true;
3495 boolean hasNonCivReserves =
false;
3497 if (!member.isCivilian()) {
3498 hasNonCivReserves =
true;
3504 !hasNonCivReserves) {
3509 if (ai ==
null)
return false;
3519 (option == EncounterOption.ENGAGE || (option == EncounterOption.HOLD &&
ongoingBattle));
3535 if (ai ==
null)
return false;
3537 if (!hostile)
return false;
3552 if (
config.alwaysAttackVsAttack)
return false;
3554 boolean hasNonCivReserves =
false;
3556 if (!member.isCivilian()) {
3557 hasNonCivReserves =
true;
3563 !hasNonCivReserves) {
3568 if (ai ==
null)
return false;
3589 if (mission ==
null) {
3593 if (memory !=
null) {
static SettingsAPI getSettings()
static FactoryAPI getFactory()
static SectorAPI getSector()
static void reportShipsRecovered(List< FleetMemberAPI > ships, InteractionDialogAPI dialog)
static final String MISSION
static final String LOCAL
void setInitialStepSize(float initialStepSize)
void setInitialNumSteps(float initialNumSteps)
void setPlayerCommandPoints(int playerCommandPoints)
EngagementResultAPI getResult()
void resolvePlayerPursuit(FleetEncounterContext context, List< FleetMemberAPI > playerShipsToDeploy)
List< FleetMemberAPI > getRecoverableShips(BattleAPI battle, CampaignFleetAPI winningFleet, CampaignFleetAPI otherFleet)
void generateLoot(List< FleetMemberAPI > recoveredShips, boolean withCredits)
boolean didPlayerWinMostRecentBattleOfEncounter()
void setNoHarryBecauseOfStation(boolean noHarryBecauseOfStation)
void setAllyFPHullDamageToEnemies(float allyFPHullDamageToEnemies)
void setSalvageRandom(Random salvageRandom)
void setTextPanelForXPGain(TextPanelAPI textPanelForXPGain)
boolean adjustPlayerReputation(InteractionDialogAPI dialog, String ffText)
boolean wasLastEngagementEscape()
void applyPursuitOption(CampaignFleetAPI pursuingFleet, CampaignFleetAPI otherFleet, PursuitOption pursuitOption)
void applyAfterBattleEffectsIfThereWasABattle()
float getAllyFPHullDamageToEnemies()
boolean isOtherFleetHarriedPlayer()
float performPostEngagementRecoveryBoth(EngagementResultAPI result)
BoardingResult boardShip(FleetMemberAPI member, CampaignFleetAPI attacker, CampaignFleetAPI defender)
void setOtherFleetHarriedPlayer(boolean otherFleetHarriedPlayer)
List< FleetMemberAPI > getStoryRecoverableShips()
void recoverCrew(CampaignFleetAPI fleet)
float computeBattleDifficulty()
DataForEncounterSide getDataFor(CampaignFleetAPI participantOrCombined)
static void recoverShips(List< FleetMemberAPI > ships, FleetEncounterContext context, CampaignFleetAPI winningFleet, CampaignFleetAPI otherFleet)
PursueAvailability getPursuitAvailability(CampaignFleetAPI fleet, CampaignFleetAPI otherFleet)
float performPostVictoryRecovery(EngagementResultAPI result)
boolean hasWinnerAndLoser()
boolean isEngagedInHostilities()
EngageBoardableOutcome engageBoardableShip(FleetMemberAPI toBoard, CampaignFleetAPI fleetItBelongsTo, CampaignFleetAPI attackingFleet)
boolean isComputedDifficulty()
void setPlayerFPHullDamageToEnemies(float playerFPHullDamageToEnemies)
EngagementOutcome getLastEngagementOutcome()
DisengageHarryAvailability getDisengageHarryAvailability(CampaignFleetAPI fleet, CampaignFleetAPI otherFleet)
float getPlayerFPHullDamageToEnemies()
void setBattle(BattleAPI battle)
boolean didPlayerWinLastEngagement()
void processEngagementResults(EngagementResultAPI result)
void letBoardableGo(FleetMemberAPI toBoard, CampaignFleetAPI fleetItBelongsTo, CampaignFleetAPI attackingFleet)
void setEngagedInHostilities(boolean engagedInHostilities)
String getIntOrNo(float value)
static boolean canDisengage()
boolean didEnoughToDisengage(CampaignFleetAPI fleet)
void optionMousedOver(String optionText, Object optionData)
boolean pickedMemberToBoard
FleetMemberAPI origFlagship
CampaignFleetAPI playerFleet
void init(InteractionDialogAPI dialog)
static boolean inConversation
void restoreOrigCaptains()
FleetMemberAPI selectedFlagship
boolean alliedFleetHoldingVsStrongerEnemy()
RuleBasedInteractionDialogPluginImpl conversationDelegate
void updateMainState(boolean withText)
CrewCompositionAPI boardingParty
boolean canDisengageWithoutPursuit(CampaignFleetAPI fleet)
boolean alliedFleetWantsToDisengage()
static float EMERGENCY_REPAIRS_MAX_DP
void appendText(String text)
String getString(String id)
void addEmergencyRepairsOption()
void updateEngagementChoice(boolean withText)
FactionAPI getNonHostileOtherFaction()
void advance(float amount)
static final Color ENEMY_COLOR
InteractionDialogAPI dialog
static final Color HIGHLIGHT_COLOR
BoardingResult boardingResult
List< FleetMemberAPI > getCrashMothballable(List< FleetMemberAPI > all)
void optionSelected(String text, Object optionData)
boolean otherCanDisengage()
boolean alliedFleetWantsToFight()
FactionAPI getNonHostileOtherFaction(List< CampaignFleetAPI > otherSide)
CrewCompositionAPI maxBoardingParty
boolean alliedCanDisengage()
VisualType currVisualType
void goToEncounterEndPath()
boolean fleetCanDisengage(CampaignFleetAPI fleet)
static boolean directToComms
boolean otherFleetHoldingVsStrongerEnemy()
void addText(String text)
boolean allyEngagementChoiceNoBattle
void backFromEngagement(EngagementResultAPI result)
void reinit(boolean withContinueOnRuleFound)
void setPlayerFleet(CampaignFleetAPI playerFleet)
boolean fleetHoldingVsStrongerEnemy(CampaignFleetAPI fleet, CampaignFleetAPI other)
void addPostBattleAttitudeText()
List< CampaignFleetAPI > pulledIn
FleetEncounterContext context
boolean canDisengageCleanly(CampaignFleetAPI fleet)
void addText(String text, Color color)
void reinitPostContinue()
void setActiveMission(CampaignEventPlugin mission)
CampaignFleetAPI otherFleet
static String DO_NOT_AUTO_SHOW_FC_PORTRAIT
float boardingPercentSuccess
boolean fleetWantsToFight(CampaignFleetAPI fleet, CampaignFleetAPI other)
List< FleetMemberAPI > membersInOrderPreEncounter
FleetInteractionDialogPluginImpl()
FleetInteractionDialogPluginImpl(FIDConfig params)
void notifyActivePersonChanged()
void printOngoingBattleInfo()
boolean playerOutBeforeAllies()
List< FleetMemberAPI > getPursuitCapablePlayerShips()
void addText(String text, String hl, Color hlColor)
Map< String, MemoryAPI > getMemoryMap()
boolean fleetWantsToFight(CampaignFleetAPI fleet, CampaignFleetAPI other, boolean assumeHostile)
boolean otherFleetWantsToFight()
static float getDisengageSize()
void pullInNearbyFleets()
static final Color FRIEND_COLOR
String getApproximate(float value)
PursueAvailability getPursuitAvailability(CampaignFleetAPI fleet)
OptionId lastOptionMousedOver
InitialBoardingResponse aiBoardingResponse
EngagementResultAPI lastResult
String getApproximateNumOnly(float value)
boolean otherFleetWantsToDisengage()
String createShipNameListString(List< FleetMemberAPI > members)
boolean shownTooLargeToRetreatMessage
Map< FleetMemberAPI, PersonAPI > origCaptains
boolean isValidTransferCommandTarget(FleetMemberAPI member)
boolean otherFleetWantsToFight(boolean assumeHostile)
boolean firedVictoryTriggers
PursuitOption pickPursuitOption(CampaignFleetAPI fleet, CampaignFleetAPI other, FleetEncounterContext context)
boolean fleetWantsToDisengage(CampaignFleetAPI fleet, CampaignFleetAPI other)
Map< String, MemoryAPI > getMemoryMap()
void setEmbeddedMode(boolean embeddedMode)
void optionMousedOver(String optionText, Object optionData)
void optionSelected(String text, Object optionData)
boolean fireBest(String trigger)
void init(InteractionDialogAPI dialog)
void notifyActivePersonChanged()
static final String MEMORY_KEY_MAKE_PREVENT_DISENGAGE
static final String FLEET_INTERACTION_DIALOG_CONFIG_OVERRIDE_GEN
static final String MEMORY_KEY_SMUGGLER
static final String MEMORY_KEY_MAKE_ALLOW_DISENGAGE
static final String MEMORY_KEY_IGNORE_PLAYER_COMMS
static final String FLEET_IGNORES_OTHER_FLEETS
static final String MEMORY_KEY_LOW_REP_IMPACT
static final String MEMORY_KEY_NO_REP_IMPACT
static final String MEMORY_KEY_SKIP_TRANSPONDER_STATUS_INFO
static final String MEMORY_KEY_RECENTLY_DEFEATED_BY_PLAYER
static String STORY_POINT_SPEND_COMBAT
static final String INDENT
boolean execute(String ruleId, InteractionDialogAPI dialog, List< Token > params, Map< String, MemoryAPI > memoryMap)
static final String OPTION_ID
static boolean fire(String ruleId, InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap, String params)
static boolean set(String ruleId, InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap, String params)
static String getValueLabelForMember(FleetMemberAPI member)
static float MALFUNCTION_START
static Color getStoryOptionColor()
static String getWithDGS(float num)
static Color getButtonTextColor()
static List< String > getDefeatTriggers(CampaignFleetAPI fleet, boolean createIfNecessary)
static List< FleetMemberAPI > getSnapshotMembersLost(CampaignFleetAPI fleet)
static String ucFirst(String str)
static Color getNegativeHighlightColor()
static Random getRandom(long seed, int level)
static boolean isAutomated(MutableShipStatsAPI stats)
static Pair< SectorEntityToken, CampaignFleetAPI > getNearestStationInSupportRange(CampaignFleetAPI from)
static Color getGrayColor()
static void clearDefeatTriggersIfNeeded(CampaignFleetAPI fleet)
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static Color getHighlightedOptionColor()
static Color getHighlightColor()
static boolean isUnremovable(PersonAPI person)
static float getBattleJoinRange()
static Color getPositiveHighlightColor()
BattleAPI createBattle(CampaignFleetAPI one, CampaignFleetAPI two)
CombatReadinessPlugin getCRPlugin()
String getString(String category, String id)
float getFloat(String key)
Color getColor(String id)
List< CampaignFleetAPI > getPlayerSideSnapshot()
List< CampaignFleetAPI > getSideOne()
CampaignFleetAPI getPrimary(List< CampaignFleetAPI > side)
CampaignFleetAPI getNonPlayerCombined()
List< CampaignFleetAPI > getSideFor(CampaignFleetAPI participantOrCombined)
boolean join(CampaignFleetAPI fleet)
List< CampaignFleetAPI > getOtherSide(BattleSide side)
List< CampaignFleetAPI > getSideTwo()
boolean isStationInvolvedOnPlayerSide()
List< CampaignFleetAPI > getSide(BattleSide side)
void leave(CampaignFleetAPI fleet, boolean engagedInHostilities)
boolean isStationInvolved()
BattleSide pickSide(CampaignFleetAPI fleet)
CampaignFleetAPI getOtherSideCombined(BattleSide side)
boolean canJoin(CampaignFleetAPI fleet)
CampaignFleetAPI getSourceFleet(FleetMemberAPI member)
List< CampaignFleetAPI > getNonPlayerSideSnapshot()
CampaignFleetAPI getPlayerCombined()
boolean knowsWhoPlayerIs(List< CampaignFleetAPI > side)
boolean isPlayerInvolved()
List< CampaignFleetAPI > getBothSides()
void finish(BattleSide winner)
void applyVisibilityMod(CampaignFleetAPI fleet)
List< CampaignFleetAPI > getNonPlayerSide()
CampaignFleetAPI getCombined(BattleSide side)
List< CampaignFleetAPI > getPlayerSide()
LocationAPI getContainingLocation()
String getNameWithFactionKeepCase()
CampaignFleetAIAPI getAI()
float getBaseSensorRangeToDetect(float sensorProfile)
FleetMemberAPI getFlagship()
boolean hasShipsWithUniqueSig()
FleetDataAPI getFleetData()
MutableCharacterStatsAPI getCommanderStats()
boolean isValidPlayerFleet()
MutableValue getCredits()
void setGoal(FleetGoal goal)
List< FleetMemberAPI > getDestroyed()
List< FleetMemberAPI > getDeployed()
List< FleetMemberAPI > getDisabled()
String getEntityNamePrefix()
boolean isHostileTo(FactionAPI other)
String getDisplayNameIsOrAre()
boolean isNeutralFaction()
boolean isPlayerFaction()
String getDisplayNameLong()
void setFlagship(FleetMemberAPI flagship)
void sortToMatchOrder(List< FleetMemberAPI > originalOrder)
List< FleetMemberAPI > getCombatReadyMembersListCopy()
List< FleetMemberAPI > getMembersListCopy()
void setInteractionTarget(SectorEntityToken interactionTarget)
void setPlugin(InteractionDialogPlugin plugin)
TextPanelAPI getTextPanel()
VisualPanelAPI getVisualPanel()
void startBattle(BattleCreationContext context)
void flickerStatic(float in, float out)
void setOptionOnConfirm(String text, Object optionId)
SectorEntityToken getInteractionTarget()
void showFleetMemberRecoveryDialog(String title, List< FleetMemberAPI > pool, FleetMemberPickerListener listener)
void addOptionSelectedText(Object optionId)
void setPromptText(String promptText)
void showFleetMemberPickerDialog(String title, String okText, String cancelText, int rows, int cols, float iconSize, boolean canPickNotReady, boolean canPickMultiple, List< FleetMemberAPI > pool, FleetMemberPickerListener listener)
void setOptionOnEscape(String text, Object optionId)
OptionPanelAPI getOptionPanel()
List< CampaignFleetAPI > getFleets()
void setTooltip(Object data, String tooltipText)
void addOptionConfirmation(Object optionId, String text, String yes, String no)
void addOption(String text, Object data)
boolean hasOption(Object data)
void setEnabled(Object data, boolean enabled)
void setShortcut(Object data, int code, boolean ctrl, boolean alt, boolean shift, boolean putLast)
CampaignFleetAPI getPlayerFleet()
void reportEncounterLootGenerated(FleetEncounterContextPlugin plugin, CargoAPI loot)
FactionAPI getPlayerFaction()
void setActivePerson(PersonAPI activePerson)
MemoryAPI getMemoryWithoutUpdate()
boolean isTransponderOn()
LabelAPI addPara(String text)
void highlightFirstInLastPara(String text, Color color)
void setFontSmallInsignia()
LabelAPI addParagraph(String text)
void appendToLastParagraph(String text)
void highlightInLastPara(Color color, String ...strings)
void highlightLastInLastPara(String text, Color color)
void setVisualFade(float in, float out)
boolean isShowingPersonInfo(PersonAPI person)
void showLoot(String title, CargoAPI otherCargo, boolean generatePods, CoreInteractionListener listener)
CustomPanelAPI showCustomPanel(float width, float height, CustomUIPanelPlugin plugin)
void showFleetMemberInfo(FleetMemberAPI member)
void showPersonInfo(PersonAPI person)
void showPreBattleJoinInfo(String playerTitle, CampaignFleetAPI playerFleet, String titleOne, String titleTwo, FleetEncounterContextPlugin context)
void showFleetInfo(String titleOne, CampaignFleetAPI one, String titleTwo, CampaignFleetAPI two)
EncounterOption pickEncounterOption(FleetEncounterContextPlugin context, CampaignFleetAPI otherFleet)
InitialBoardingResponse pickBoardingResponse(FleetEncounterContextPlugin context, FleetMemberAPI toBoard, CampaignFleetAPI otherFleet)
PursuitOption pickPursuitOption(FleetEncounterContextPlugin context, CampaignFleetAPI otherFleet)
boolean isHostileTo(CampaignFleetAPI other)
void performCrashMothballingPriorToEscape(FleetEncounterContextPlugin context, CampaignFleetAPI playerFleet)
boolean contains(String key)
void set(String key, Object value)
boolean is(String key, Object value)
boolean getBoolean(String key)
RuleAPI getBestMatching(String currentRule, String trigger, InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
MutableStat getCommandPoints()
float getMalfunctionThreshold(MutableShipStatsAPI stats)
EngagementResultForFleetAPI getLoserResult()
EngagementResultForFleetAPI getWinnerResult()
void setBattle(BattleAPI battle)
void setCaptain(PersonAPI commander)
CrewCompositionAPI getCrewComposition()
FleetMemberStatusAPI getStatus()
RepairTrackerAPI getRepairTracker()
void setHighlight(int start, int end)
void setHighlightColor(Color color)
void setHighlightColors(Color ... colors)