From 9a898121fed33ace3bae01bae08d73a284b51142 Mon Sep 17 00:00:00 2001 From: Tkael Date: Mon, 3 Jul 2023 12:47:46 -0700 Subject: [PATCH] Allow remainingDays to be null - it is not always reported. --- DataDefinitions/ThargoidWar.cs | 2 +- EDDI/ChangeLog.md | 3 +++ SpeechResponder/eddi.cs.json | 2 +- SpeechResponder/eddi.de.json | 2 +- SpeechResponder/eddi.hu.json | 2 +- SpeechResponder/eddi.it.json | 2 +- SpeechResponder/eddi.ja.json | 2 +- SpeechResponder/eddi.json | 2 +- SpeechResponder/eddi.ru.json | 2 +- Tests/JournalMonitorTests.cs | 2 +- 10 files changed, 12 insertions(+), 9 deletions(-) diff --git a/DataDefinitions/ThargoidWar.cs b/DataDefinitions/ThargoidWar.cs index cb2351f29b..554749131c 100644 --- a/DataDefinitions/ThargoidWar.cs +++ b/DataDefinitions/ThargoidWar.cs @@ -10,7 +10,7 @@ public class ThargoidWar public FactionState CurrentState { get; set; } [PublicAPI( "The number of remaining days in the current phase of the Thargoid war." )] - public int remainingDays { get; set; } + public int? remainingDays { get; set; } [PublicAPI( "The next phase of the Thargoid war, if success is not achieved, as a localizable object." )] public FactionState FailureState { get; set; } diff --git a/EDDI/ChangeLog.md b/EDDI/ChangeLog.md index e0b553c484..2bc6477eb6 100644 --- a/EDDI/ChangeLog.md +++ b/EDDI/ChangeLog.md @@ -12,6 +12,9 @@ Full details of the variables available for each noted event, and VoiceAttack in * Revised speech service to make rendering even more thread-safe when transitioning between the `Play()` function and normal speech (#2549). * Revised speech service to retry using speech stripped of SSML tags when speech fails using the System.Speech synthesizer. * Worked around a journal bug when `HullHealth` is not written to the player journal `Loadout` event. (#2552) + * Speech Responder + * Changes to existing scripts + * `System state report` updated to allow thargoid war `remainingDays` to be null (since for some states it is not present in the journal output). ## 4.0.3-b3 * Core diff --git a/SpeechResponder/eddi.cs.json b/SpeechResponder/eddi.cs.json index da1fc1ec9b..b5b1ba2b6d 100644 --- a/SpeechResponder/eddi.cs.json +++ b/SpeechResponder/eddi.cs.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/SpeechResponder/eddi.de.json b/SpeechResponder/eddi.de.json index 43a2089522..0138388f60 100644 --- a/SpeechResponder/eddi.de.json +++ b/SpeechResponder/eddi.de.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/SpeechResponder/eddi.hu.json b/SpeechResponder/eddi.hu.json index 67ec035a9a..402c303ac7 100644 --- a/SpeechResponder/eddi.hu.json +++ b/SpeechResponder/eddi.hu.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/SpeechResponder/eddi.it.json b/SpeechResponder/eddi.it.json index 67ec035a9a..402c303ac7 100644 --- a/SpeechResponder/eddi.it.json +++ b/SpeechResponder/eddi.it.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/SpeechResponder/eddi.ja.json b/SpeechResponder/eddi.ja.json index 67ec035a9a..402c303ac7 100644 --- a/SpeechResponder/eddi.ja.json +++ b/SpeechResponder/eddi.ja.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index a1fa330100..58592e3904 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/SpeechResponder/eddi.ru.json b/SpeechResponder/eddi.ru.json index 67ec035a9a..402c303ac7 100644 --- a/SpeechResponder/eddi.ru.json +++ b/SpeechResponder/eddi.ru.json @@ -2449,7 +2449,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n } \r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n within the next {thargoidWar.remainingDays} days.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n within the next {thargoidWar.remainingDays} days.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", + "script": "{_ Fetch from Context, if a context is set _}\r\n{if state.eddi_context_system_name:\r\n {set reportSystem to SystemDetails(state.eddi_context_system_name)}\r\n|else:\r\n {set reportSystem to SystemDetails(system.systemname)}\r\n}\r\n\r\n{if !reportSystem.name || reportSystem.name = \"\":\r\n\r\n I'm not sure which system you are asking about.\r\n\r\n|else:\r\n\r\n {_ Report any Thargoid war details _}\r\n {if reportSystem.ThargoidWar != null && thargoidWar.CurrentState.invariantName != \"None\":\r\n {set thargoidWar to reportSystem.ThargoidWar}\r\n {if thargoidWar.CurrentState.invariantName = \"Thargoid Alert\":\r\n {if !thargoidWar.succeeded:\r\n Alert! Orthrus class Thargoid {OneOf(\"vessels\", \"interceptors\")} \r\n have been {OneOf(\"sighted\", \"spotted\", \"observed\")} \r\n {Occasionally(2, \"collecting sensors and probes\")} \r\n in this {OneOf(\"star system\", \"region\")}.\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n fall into complete Thargoid control\r\n |elif thargoidWar.FailureState.invariantName = \"Thargoid Invasion\":\r\n {OneOf(\"come under assault\", \"be invaded\", \"suffer a full scale invasion\", \"suffer a full scale assault\")}\r\n }\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Invasion\":\r\n {if !thargoidWar.succeeded:\r\n Danger! Thargoid {OneOf(\"vessels\", \"interceptors\")} are\r\n {OneOf(\"invading\", \"assaulting\", \"attempting to gain control of\")} \r\n this {OneOf(\"star system\", \"region\")}.\r\n {if thargoidWar.FailureState.invariantName = \"Thargoid Controlled\":\r\n If not repulsed, the system {OneOf(\"will\", \"shall\")} \r\n fall into complete Thargoid control\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n }\r\n {if thargoidWar.remainingPorts > 0:\r\n {if thargoidWar.remainingPorts = 1: Just }\r\n {thargoidWar.remainingPorts}\r\n {if thargoidWar.remainingPorts > 1: ports remain |else: port remains }\r\n under human control.\r\n }\r\n |else:\r\n This system is just beginning to recover after repulsing a \r\n Thargoid {OneOf(\"invasion\", \"assault\")}.\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Controlled\":\r\n {if !thargoidWar.succeeded:\r\n This {OneOf(\"star system\", \"region\")} is under \r\n {OneOf(\"complete Thargoid control\", \"Thargoid occupation\")}.\r\n Proceed with extreme caution.\r\n |else:\r\n {if thargoidWar.SuccessState.invariantName = \"Post-Thargoid Recovery\":\r\n This system is just beginning to recover after \r\n being {OneOf(\"recovered\", \"recaptured\", \"wrested\")}\r\n from Thargoid control.\r\n }\r\n }\r\n |elif thargoidWar.CurrentState.invariantName = \"Thargoid Maelstrom\":\r\n A Thargoid Maelstrom is present in this \r\n {OneOf(\"star system\", \"region\")}. Proceed with extreme caution.\r\n |elif thargoidWar.CurrentState.invariantName = \"Post-Thargoid Recovery\":\r\n {if !thargoidWar.succeeded:\r\n This system is expected to complete its recovery \r\n from Thargoid {OneOf(\"assault\", \"attack\")}\r\n {if thargoidWar.remainingDays != null:\r\n within the next {thargoidWar.remainingDays} days\r\n }.\r\n |else:\r\n This system is recovering from Thargoid {OneOf(\"assault\", \"attack\")}.\r\n }\r\n }\r\n \r\n |else:\r\n \r\n {_ Report any ongoing human conflicts _}\r\n {set conflictfactions to []}\r\n {if reportSystem.conflicts != null:\r\n {for conflict in reportSystem.conflicts:\r\n {P(conflict.faction1, \"faction\")}\r\n {if conflict.status = \"active\":\r\n are\r\n {if conflict.faction1dayswon > conflict.faction2dayswon:\r\n {if conflict.margin >= 3:\r\n dominating\r\n |elif conflict.margin = 2:\r\n winning\r\n |else:\r\n ahead in\r\n }\r\n |elif conflict.faction2dayswon > conflict.faction1dayswon:\r\n {if conflict.margin >= 2:\r\n losing\r\n |else:\r\n trailing in\r\n }\r\n |else:\r\n tied in\r\n }\r\n |elif conflict.status = \"pending\":\r\n will soon be in\r\n |else:\r\n are {OneOf(\"recovering\", \"recuperating\")} after\r\n }\r\n {if StartsWithVowel(conflict.state): an |else: a }\r\n {conflict.state}\r\n with \r\n {P(conflict.faction2, \"faction\")}\r\n {if conflict.stake:\r\n for control of {P(conflict.stake, \"station\")}\r\n }\r\n .\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction1])}\r\n {set conflictfactions to cat(conflictfactions, [conflict.faction2])}\r\n }\r\n }\r\n \r\n {_ List our non-conflict faction states _}\r\n {set otherstates to []}\r\n {for faction in reportSystem.factions:\r\n {if faction.influence > 0 && find(conflictfactions, faction.name) = -1:\r\n {for presence in faction.presences:\r\n {if presence.systemName = reportSystem.name:\r\n {if presence.FactionState.invariantName != \"None\":\r\n \r\n {_ Note our controlling faction, if present in our `otherstates` list. _}\r\n {if faction.name = reportSystem.faction:\r\n {set factions to token(factions, \"\", index, \"controlling \")}\r\n }\r\n \r\n {_ Add the faction to our list _}\r\n {if has(otherstates, presence.FactionState.invariantName):\r\n {set factions to otherstates[presence.FactionState.invariantName])}\r\n {set factions to cat(factions, \",\", P(faction.name, \"faction\"))}\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: factions])}\r\n |else:\r\n {set otherstates to union(otherstates, [presence.FactionState.invariantName: P(faction.name, \"faction\")])}\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n {_ Sort from most factions with each state to least factions with each state. _}\r\n {declare by_items(a, b) as:\r\n {return cmp(len(split(b, \",\")), len(split(a, \",\")))}\r\n }\r\n {sort(otherstates, by_items)}\r\n \r\n {_ Prepare summaries for each state _}\r\n {set statesummaries to []}\r\n {for state, factions in otherstates:\r\n \r\n {set factions to split(factions, \",\")}\r\n \r\n {set statesummary to:\r\n {if len(factions) > 1:\r\n {List(factions)} are\r\n |else:\r\n {factions[0]} are\r\n }\r\n {if state = \"Boom\":\r\n enjoying {OneOf(\"a period of commercial success\",\"an economic boom\", \"an economic upturn\")}\r\n |elif state = \"Blight\":\r\n suffering from {OneOf(\"a crop blight\", \"diseased crops\", \"crop failure\")}\r\n |elif state = \"Bust\":\r\n \tsuffering from {OneOf(\"an economic decline\",\"a recession\",\"an economic downturn\")}\r\n |elif state = \"Civil Liberty\":\r\n enjoying a period of heightened civil liberty\r\n |elif state = \"Civil Unrest\":\r\n suffering from civil unrest\r\n |elif state = \"Civil War\":\r\n in civil war\r\n |elif state = \"Drought\":\r\n suffering from {OneOf(\"water shortages\", \"drought\")}\r\n |elif state = \"Election\":\r\n electing new leaders\r\n |elif state = \"Expansion\":\r\n {OneOf(\"gearing up\", \"preparing\")} to expand to another system\r\n |elif state = \"Famine\":\r\n suffering from {OneOf(\"food shortages\", \"famine\")}\r\n |elif state = \"Investment\":\r\n investing in its infrastructure\r\n |elif state = \"Incursion\":\r\n {OneOf(\"under assault\", \"under attack\", \"being assaulted\", \"being attacked\")} by {OneOf(\"alien forces\", \"aliens\")}\r\n |elif state = \"Infrastructure Failure\":\r\n suffering from infrastructure failures\r\n |elif state = \"Lockdown\":\r\n in lockdown\r\n |elif state = \"Natural Disaster\":\r\n suffering from the effects of a natural disaster\r\n |elif state = \"Outbreak\":\r\n attempting to contain an outbreak of disease\r\n |elif state = \"Pirate Attack\":\r\n suffering from pirate attacks\r\n |elif state = \"Public Holiday\":\r\n celebrating a public holiday\r\n |elif state = \"Retreat\":\r\n in retreat\r\n |elif state = \"Terrorism\":\r\n suffering from terrorist attacks\r\n |elif state = \"War\":\r\n at war\r\n |else: {_ catch-all, worded to avoid deciding between a/an}\r\n in a state of {StateDetails(state).localizedName}\r\n }\r\n }\r\n {set statesummaries to cat(statesummaries, [statesummary])}\r\n }\r\n \r\n {_ Describe our non-conflict states _}\r\n {if len(statesummaries) > 0:\r\n {Pause(100)}\r\n {List(statesummaries)}\r\n }\r\n }\r\n}", "default": true, "name": "System state report", "description": "Report on the current state of the contextual system" diff --git a/Tests/JournalMonitorTests.cs b/Tests/JournalMonitorTests.cs index f1d454814d..031623e3f4 100644 --- a/Tests/JournalMonitorTests.cs +++ b/Tests/JournalMonitorTests.cs @@ -1070,7 +1070,7 @@ public void TestJumpedEventThargoidProbing () Assert.AreEqual( FactionState.ThargoidControlled, @event.ThargoidWar.FailureState ); Assert.IsTrue( @event.ThargoidWar.succeeded ); Assert.AreEqual( 100M, @event.ThargoidWar.progress ); - Assert.AreEqual( 0, @event.ThargoidWar.remainingDays ); + Assert.AreEqual( null, @event.ThargoidWar.remainingDays ); Assert.IsNull( @event.ThargoidWar.remainingPorts ); }