From 0045e44265782630d07fa695b2672a117264eeb9 Mon Sep 17 00:00:00 2001 From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io> Date: Mon, 31 Jan 2022 00:51:13 +0000 Subject: [PATCH] Peacekeepers tweak --- devTools/types/FC/gameState.d.ts | 22 ++++++++++++------- js/003-data/gameVariableData.js | 6 +---- src/002-config/fc-version.js | 2 +- .../backwardsCompatibility.js | 15 +++++++++++++ src/descriptions/arcologyDescription.js | 10 ++++----- src/endWeek/economics/neighborsDevelopment.js | 10 +++------ src/events/nonRandom/pInvasion.js | 1 - .../peacekeepers/pPeacekeepersDeficit.js | 15 +------------ .../peacekeepers/pPeacekeepersIndependence.js | 15 ++----------- .../peacekeepers/pPeacekeepersInfluence.js | 2 +- .../peacekeepers/pPeacekeepersIntro.js | 16 ++++++-------- src/interaction/sellSlave.js | 9 +++----- src/js/storyJS.js | 4 ++++ 13 files changed, 57 insertions(+), 70 deletions(-) diff --git a/devTools/types/FC/gameState.d.ts b/devTools/types/FC/gameState.d.ts index 2b332caeef8..17edc15283b 100644 --- a/devTools/types/FC/gameState.d.ts +++ b/devTools/types/FC/gameState.d.ts @@ -12,14 +12,20 @@ declare namespace FC { say: string; } - interface PeacekeepersState { - generalName: string; - strength: number; - attitude: number; - independent: number; - undermining: number; - influenceAnnounced: number; - tastes: Zeroable<String>; + interface Peacekeepers { + /** + - 0: Gone + - 1: Not established + - 2: Intro + - 3: Independent + */ + state: number; + generalName?: string; + strength?: number; + attitude?: number; + undermining?: number; + influenceAnnounced?: number; + tastes?: string; } export type RecruiterTarget = "desperate whores" | "young migrants" | "recent divorcees" | diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index a45da513da0..12cbec34748 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -1211,11 +1211,7 @@ App.Data.resetOnNGPlus = { influence: 0, eventWeek: 0 }, - - /** @type {FC.Zeroable<FC.PeacekeepersState>} */ - peacekeepers: 0, - peacekeepersFate: 0, - peacekeepersGone: 0, + /** @type {FC.Peacekeepers} */ peacekeepers: {state: 1}, mercRomeo: 0, oralUseWeight: 5, diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js index 8081e88f01b..66ecf8e3b9f 100644 --- a/src/002-config/fc-version.js +++ b/src/002-config/fc-version.js @@ -2,5 +2,5 @@ App.Version = { base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed. pmod: "4.0.0-alpha.12", commitHash: null, - release: 1158, // When getting close to 2000, please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js. + release: 1160, // When getting close to 2000, please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js. }; diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 062f02792ab..31576225593 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -130,6 +130,21 @@ App.Update.backwardsCompatibility = function() { }; App.Update.globalVariables = function(node) { + if (typeof V.peacekeepers.state === "undefined") { + V.peacekeepers = V.peacekeepers || {}; + delete V.peacekeepers.independent; + if (V.peacekeepersGone) { + V.peacekeepers.state = 0; + } else if (!peacekeepersCanBeEstablished()) { + V.peacekeepers.state = 1; + } else if (!V.peacekeepersFate) { + V.peacekeepers.state = 2; + } else { + V.peacekeepers.state = 3; + } + V.peacekeepers.tastes = V.peacekeepers.tastes || ""; + } + if (typeof V.incubator === "number") { if (V.incubator > 0) { const storage = V.incubator; diff --git a/src/descriptions/arcologyDescription.js b/src/descriptions/arcologyDescription.js index 0287dc0caa5..eb5b11e3a49 100644 --- a/src/descriptions/arcologyDescription.js +++ b/src/descriptions/arcologyDescription.js @@ -994,21 +994,21 @@ App.Desc.playerArcology = function(lastElement) { const frag = document.createDocumentFragment(); if (V.plot) { - if (V.peacekeepers === 0) { + if (V.peacekeepers.state <= 1) { if (V.invasionVictory) { frag.append(`The area previously occupied by the little old world country whose collapse led to a failed invasion of the Free City is a lawless wilderness.`); } else if (V.week > 29) { - frag.append(`A small old world country near the arcology is in the process of collapse${V.nationHate ? ", and your opportunistic behavior towards it has caused hatred there" : ""}.`); + frag.append(` A small old world country near the arcology is in the process of collapse${V.nationHate ? ", and your opportunistic behavior towards it has caused hatred there" : ""}.`); } else { - frag.append(`There is nothing notable about the decaying old world countries ${V.terrain === "oceanic" ? "on the shoreline nearest" : "near"} the arcology.`); + frag.append(` There is nothing notable about the decaying old world countries ${V.terrain === "oceanic" ? "on the shoreline nearest" : "near"} the arcology.`); } } else { if (V.peacekeepers.strength >= 50) { frag.append(`General ${V.peacekeepers.generalName} now governs an area near the Free City as a warlord, using the men and women of his former peacekeeping forces to rule.`); if (V.peacekeepers.attitude >= 100) { - frag.append(` The area is a de facto client state of your arcology.`); + frag.append(`The area is a de facto client state of your arcology.`); } else { - frag.append(` He considers himself indebted to you, and delivers periodic tributes of menial slaves.`); + frag.append(`He considers himself indebted to you, and delivers periodic tributes of menial slaves.`); } } else { // TODO: create an actual framework for this behavior (only refreshing a specific element) diff --git a/src/endWeek/economics/neighborsDevelopment.js b/src/endWeek/economics/neighborsDevelopment.js index 1d801ee963c..6135beeb844 100644 --- a/src/endWeek/economics/neighborsDevelopment.js +++ b/src/endWeek/economics/neighborsDevelopment.js @@ -1534,9 +1534,8 @@ App.EndWeek.neighborsDevelopment = function() { App.Events.addParagraph(el, r); } - /* PEACEKEEPERS */ - - if (V.plot && V.peacekeepers !== 0) { + // PEACEKEEPERS + if (V.plot && V.peacekeepers.state >= 2) { let prisoners; let r = []; if (V.peacekeepers.strength >= 50) { @@ -1554,14 +1553,11 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`<span class="yellow">The peacekeeping force led by General ${V.peacekeepers.generalName} in the troubled area near the Free City has been withdrawn.</span>`); if (V.peacekeepers.undermining) { r.push(`Your misinformation campaign against it in the old world media was successful. Before long, everyone in the Free City is confident that you're somehow responsible, <span class="green">greatly improving your reputation.</span>`); - V.peacekeepers = 0; - V.peacekeepersGone = 1; repX(2000, "peacekeepers"); } else { r.push(`The cost was ultimately too high. The time when old world countries could afford to waste billions on military adventurism is gone. It will not return.`); - V.peacekeepers = 0; - V.peacekeepersGone = 1; } + V.peacekeepers.state = 0; } else { r.push(`There's a peacekeeping force led by General ${V.peacekeepers.generalName} in the troubled area near the Free City.`); if (V.peacekeepers.undermining) { diff --git a/src/events/nonRandom/pInvasion.js b/src/events/nonRandom/pInvasion.js index b8a1f6bec5f..0aa592ac02b 100644 --- a/src/events/nonRandom/pInvasion.js +++ b/src/events/nonRandom/pInvasion.js @@ -4,7 +4,6 @@ App.Events.PInvasion = class PInvasion extends App.Events.BaseEvent { V.nextButton = "Continue"; const newSlaves = []; V.invasionVictory = 1; - V.peacekeepers = 0; const { HeA, HisA, heA, hisA, womanA diff --git a/src/events/nonRandom/peacekeepers/pPeacekeepersDeficit.js b/src/events/nonRandom/peacekeepers/pPeacekeepersDeficit.js index e9977a333b8..521661b89cd 100644 --- a/src/events/nonRandom/peacekeepers/pPeacekeepersDeficit.js +++ b/src/events/nonRandom/peacekeepers/pPeacekeepersDeficit.js @@ -1,16 +1,12 @@ App.Events.PPeacekeepersDeficit = class PPeacekeepersDeficit extends App.Events.BaseEvent { eventPrerequisites() { return [ - () => V.peacekeepers !== 0, + () => V.peacekeepers.state === 2, () => V.peacekeepers.attitude >= 0 ]; } execute(node) { - if (V.peacekeepers === 0) { // Do not remove (exists for typing support) - return node; - } - V.nextButton = "Continue"; App.Events.addParagraph(node, [`General ${V.peacekeepers.generalName}'s peacekeeping force has stabilized the neighboring region somewhat. True to his word, the general has indeed concentrated on his peacekeeping mandate, and hasn't done anything that might be construed as a move against the Free City or its interests. There are somewhat fewer refugees available from that area, and it's a less complete refuge for bad actors, but other than that, there hasn't been much reason for you to take notice. Until today, when General ${V.peacekeepers.generalName} gives you a call.`]); @@ -33,9 +29,6 @@ App.Events.PPeacekeepersDeficit = class PPeacekeepersDeficit extends App.Events. function assist() { const frag = new DocumentFragment(); - if (V.peacekeepers === 0) { // Do not remove (exists for typing support) - return; - } App.Events.addParagraph(frag, [`Understanding that the general needs to couch the situation in a way he can justify in public, and perhaps in a way he can justify to himself, you offer to house the prisoners on a contract basis, with immediate payment to the general so he can meet his forces' immediate needs. Naturally, the prisoners will be kept busy while you keep them; menial labor seems appropriate. It's unlikely that the situation will ever stabilize to the point where they can be released, so for safety, they should all be detained indefinitely. And of course, each prisoner's individual detention will be available for resale. Just like any other slave's.`]); V.peacekeepers.attitude += 5; V.menials += 200; @@ -45,9 +38,6 @@ App.Events.PPeacekeepersDeficit = class PPeacekeepersDeficit extends App.Events. } function pharmaceutical() { - if (V.peacekeepers === 0) { // Do not remove (exists for typing support) - return; - } let r = []; if (V.cash < 100000) { r.push(`Unfortunately, you lack the funds to buy the prisoners.`); @@ -57,9 +47,6 @@ App.Events.PPeacekeepersDeficit = class PPeacekeepersDeficit extends App.Events. return r; } function decline() { - if (V.peacekeepers === 0) { // Do not remove (exists for typing support) - return; - } V.peacekeepers.attitude -= 10; repX(5000, "event"); return `You decide to use this as an object lesson in the limits of old world power projection, and tell his situation is untenable and that he should withdraw. If he doesn't have the political firepower necessary to get proper support and supply, he's better off cutting his losses. "That's not for you to say," he responds bitterly. "And that's not for me to say, either. I still go where I'm told and do what I'm told. Thank you for your time." He ends the call brusquely. Word of your verbal defense of the Free City's sphere of influence gets around, <span class="reputation inc">greatly improving your reputation.</span>`; diff --git a/src/events/nonRandom/peacekeepers/pPeacekeepersIndependence.js b/src/events/nonRandom/peacekeepers/pPeacekeepersIndependence.js index 9a1578adde0..e70cca5079b 100644 --- a/src/events/nonRandom/peacekeepers/pPeacekeepersIndependence.js +++ b/src/events/nonRandom/peacekeepers/pPeacekeepersIndependence.js @@ -2,21 +2,16 @@ App.Events.PPeacekeepersIndependence = class PPeacekeepersIndependence extends A eventPrerequisites() { return [ () => App.Events.effectiveWeek() > 75, - () => V.peacekeepers && V.peacekeepers.strength < 50, + () => V.peacekeepers.state === 2 && V.peacekeepers.strength < 50, () => V.rivalOwner === 0, - () => V.peacekeepersFate !== 1, ]; } execute(node) { let r = []; - if (!V.peacekeepers) { // for typing - return node; - } V.nextButton = "Continue"; - V.peacekeepersFate = 1; - + V.peacekeepers.state = 3; V.peacekeepers.strength = -10; @@ -65,9 +60,6 @@ App.Events.PPeacekeepersIndependence = class PPeacekeepersIndependence extends A function generous() { const frag = new DocumentFragment(); - if (!V.peacekeepers) { // for typing - return frag; - } cashX(-generousAid, "peacekeepers"); V.peacekeepers.strength = 50; V.peacekeepers.attitude += 25; @@ -79,9 +71,6 @@ App.Events.PPeacekeepersIndependence = class PPeacekeepersIndependence extends A } function decline() { - if (!V.peacekeepers) { // for typing - return ""; - } return `You inform General ${V.peacekeepers.generalName} that you will not be providing assistance. He does not falter, but he looks suddenly older, as though the prospect of a decisive strike was giving him the strength to carry on. He expresses his regrets dully, and then ends the call.`; } } diff --git a/src/events/nonRandom/peacekeepers/pPeacekeepersInfluence.js b/src/events/nonRandom/peacekeepers/pPeacekeepersInfluence.js index 107b43f2d71..e7bc4c2a855 100644 --- a/src/events/nonRandom/peacekeepers/pPeacekeepersInfluence.js +++ b/src/events/nonRandom/peacekeepers/pPeacekeepersInfluence.js @@ -1,7 +1,7 @@ App.Events.PPeacekeepersInfluence = class PPeacekeepersInfluence extends App.Events.BaseEvent { eventPrerequisites() { return [ - () => V.peacekeepers && V.peacekeepers.strength >= 50, + () => V.peacekeepers.state === 3 && V.peacekeepers.strength >= 50, () => V.peacekeepers.influenceAnnounced === 0, ]; } diff --git a/src/events/nonRandom/peacekeepers/pPeacekeepersIntro.js b/src/events/nonRandom/peacekeepers/pPeacekeepersIntro.js index 3b2df779933..afff55ab01b 100644 --- a/src/events/nonRandom/peacekeepers/pPeacekeepersIntro.js +++ b/src/events/nonRandom/peacekeepers/pPeacekeepersIntro.js @@ -1,10 +1,8 @@ App.Events.PPeacekeepersIntro = class PPeacekeepersIntro extends App.Events.BaseEvent { eventPrerequisites() { return [ - () => V.invasionVictory > 0, - () => V.peacekeepers === 0, - () => V.peacekeepersGone !== 1, - () => App.Events.effectiveWeek() > 48, + () => peacekeepersCanBeEstablished(), + () => V.peacekeepers.state === 1, ]; } @@ -13,9 +11,9 @@ App.Events.PPeacekeepersIntro = class PPeacekeepersIntro extends App.Events.Base V.nextButton = "Continue"; - V.peacekeepers = { - generalName: App.Data.misc.whiteAmericanSlaveSurnames.random(), strength: 20, attitude: 0, independent: 0, undermining: 0, influenceAnnounced: 0, tastes: 0 - }; + Object.assign(V.peacekeepers, { + generalName: App.Data.misc.whiteAmericanSlaveSurnames.random(), strength: 20, attitude: 0, undermining: 0, influenceAnnounced: 0, tastes: "", state : 2 + }); if (V.continent === "Africa" || V.continent === "Western Europe") { V.peacekeepers.generalName = App.Data.misc.frenchSlaveSurnames.random(); } else if (V.continent === "Asia" || V.continent === "Australia") { @@ -58,7 +56,7 @@ App.Events.PPeacekeepersIntro = class PPeacekeepersIntro extends App.Events.Base App.Events.addParagraph(node, [`As he spoke, you and ${V.assistant.name} surreptitiously checked out what he said. He seems to be telling the truth, and he's correct that your interests won't be immediately affected. Nevertheless, this is a concerning development. General ${V.peacekeepers.generalName} will have thousands of troops and a lot of military hardware under his able command, more or less right next door to the Free City. He might not intend to overstep the bounds of his peacekeeping mandate, but that's no guarantee that his civilian superiors back home won't decide to order him to. Worse, the politics of the Free Cities are almost unanimously hostile to old world power; there will be public resentment about this. On the other hand, General ${V.peacekeepers.generalName} has been successful in these difficult times in no small part due to his willingness to bend the rules. If he sees an opportunity to work with an ambitious arcology owner in furtherance of his goals, he'll probably take it.`]); App.Events.addResponses(node, [ new App.Events.Result(`Tell him you disapprove of old world meddling in the Free City's sphere of influence`, disapprove), - new App.Events.Result(`Respond politely, but avoid committing yourself`, noncommital), + new App.Events.Result(`Respond politely, but avoid committing yourself`, noncommittal), new App.Events.Result(`Share intelligence on that area as a basis for further cooperation`, agree) ]); @@ -68,7 +66,7 @@ App.Events.PPeacekeepersIntro = class PPeacekeepersIntro extends App.Events.Base return `You tell him that you consider that area within the Free City's area of influence now, and that you disapprove of old world meddling. "Interesting," he says, noncommittal. "It takes real power projection to maintain a real sphere of influence. It remains to be seen whether your Free City has it. In the meantime, we'll pursue our mission." He inclines his head respectfully, and ends the call. Word of your brusque defense of the Free City's growing influence gets around, <span class="reputation inc">greatly improving your reputation.</span>`; } - function noncommital() { + function noncommittal() { return `You respond politely, stating that you're always willing to listen to business proposals, and that you approach each situation without preconceptions. General ${V.peacekeepers.generalName} understands the unspoken subtext, and that you're not willing to commit yourself to anything definite as yet. He understands, and matches your show of respect before ending the call.`; } diff --git a/src/interaction/sellSlave.js b/src/interaction/sellSlave.js index 374d80d71f9..94774901fa5 100644 --- a/src/interaction/sellSlave.js +++ b/src/interaction/sellSlave.js @@ -2736,7 +2736,7 @@ App.Interact.sellSlave = function(slave) { } }], ]); - if (V.peacekeepers !== 0) { + if (V.peacekeepers.state === 3) { buyers.set("peacekeepers", { cost: V.peacekeepers.attitude < 100 ? 500 * Math.trunc((cost * 0.5) / 500) @@ -2748,17 +2748,14 @@ App.Interact.sellSlave = function(slave) { return `from the sex slave buyer for General ${V.peacekeepers.generalName}'s client state${V.peacekeepers.tastes ? `, which prefers ${V.peacekeepers.tastes}` : ``}.`; } }, - get requirements() { return (V.plot && V.peacekeepers && V.peacekeepers.strength >= 50); }, + get requirements() { return (V.plot && V.peacekeepers.strength >= 50); }, percentOdds: 100, get completeSale() { const r = []; - if (V.peacekeepers === 0) { - return r; - } r.push(`${slave.slaveName} is delivered to General ${V.peacekeepers.generalName}'s forces, to serve as a barracks whore. Several days later, the purchasing officer forwards a short shot of ${slave.slaveName}`); cost = slaveCost(slave); - if (V.peacekeepers.tastes === 0) { + if (V.peacekeepers.tastes === "") { const influential = (cost > random(10000, 50000) || V.peacekeepers.attitude > 90); if (influential && slave.belly >= 300000) { r.push(`smiling as ${his} ${bellyAdjective(slave)} belly is used as the center of a large bukkake party. You can just barely make out the figure of someone taking ${him} from behind beyond ${his} immensity. There's a note attached, stating superfluously that ${his} exotic feature makes ${him} very popular. General ${V.peacekeepers.generalName}'s buyer is going to be looking for more massive bellied ${girl}s in the future.`); diff --git a/src/js/storyJS.js b/src/js/storyJS.js index d1215b564cc..64fd9f5fc6b 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -1,6 +1,10 @@ /* config.history.tracking = false;*/ // State.expired.disable; +globalThis.peacekeepersCanBeEstablished = function() { + return V.invasionVictory > 0 && App.Events.effectiveWeek() > 48; +} + /** * @param {number} x * @param {number} minValue -- GitLab