diff --git a/devTools/types/SugarCubeExtensions.d.ts b/devTools/types/SugarCubeExtensions.d.ts index 56e7b3adb81e5d7ad8f17ad1479d97bae03ff832..2eaf3d541c9df9fec0962bfdc873f2ede89d37c8 100644 --- a/devTools/types/SugarCubeExtensions.d.ts +++ b/devTools/types/SugarCubeExtensions.d.ts @@ -57,6 +57,8 @@ declare module "twine-sugarcube" { ArcologyNamesSlaveProfessionalism: string[]; ArcologyNamesPetiteAdmiration: string[]; ArcologyNamesStatuesqueGlorification: string[]; + ArcologyNamesCummunism: string[]; + ArcologyNamesIncestFetishist: string[]; badWords: string[]; badNames: string[]; diff --git a/src/endWeek/economics/neighborsDevelopment.js b/src/endWeek/economics/neighborsDevelopment.js index f4706571669e387bb287fc45d032dcabb87856e5..f73a615fdb475700f832a2a7fe7572b53dadc75a 100644 --- a/src/endWeek/economics/neighborsDevelopment.js +++ b/src/endWeek/economics/neighborsDevelopment.js @@ -5,23 +5,10 @@ App.EndWeek.neighborsDevelopment = function() { const el = document.createElement("p"); let He, his; - let averageProsperity = 0; + const averageProsperity = _.mean(V.arcologies.map(a => a.prosperity < 10 ? 10 : a.prosperity)); + const corpBonus = V.corp.Incorporated ? Math.trunc(1000 * Math.pow(App.Corporate.value, 0.1)) : 0; let agentBonusValue = 0; - let corpBonus; - let error; - let redHanded; let desc; - for (let i = 0; i < V.arcologies.length; i++) { - if (V.arcologies[i].prosperity < 10) { - V.arcologies[i].prosperity = 10; - } - averageProsperity += V.arcologies[i].prosperity; - } - averageProsperity = averageProsperity / V.arcologies.length; - - if (V.corp.Incorporated === 1) { - corpBonus = Math.trunc(1000 * Math.pow(App.Corporate.value, 0.1)); - } if (V.useTabs === 0) { App.UI.DOM.appendNewElement("h2", el, `Arcologies in the Free City`); @@ -30,7 +17,7 @@ App.EndWeek.neighborsDevelopment = function() { for (let i = 0; i < V.arcologies.length; i++) { const arc = V.arcologies[i]; const r = []; - r.push(`<span class="bold">${arc.name}</span>, your`); + r.push(`<span class="bold">${arc.name},</span> your`); if (arc.direction === 0) { r.push(`arcology,`); } else { @@ -84,11 +71,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`is being run by <span class="mediumseagreen">your trustees.</span> The arcology`); } - if (arc.direction === 0) { - error = 5; - } else { - error = 10; - } + let error = (arc.direction === 0 ? 5 : 10); error -= Math.min(2 * V.assistant.power, error); const prosperity = (Math.trunc((0.1 * arc.prosperity * random(100 - error, 100 + error)) / 100)); let millions = ``; @@ -101,8 +84,7 @@ App.EndWeek.neighborsDevelopment = function() { } else { millions = `m`; } - millions += `,</span>`; - r.push(`has an estimated GSP of <span class="yellowgreen">${cashFormat(prosperity)}${millions}`); + r.push(`has an estimated GSP of <span class="yellowgreen">${cashFormat(prosperity)}${millions},</span>`); if (arc.rival === 1 && arc.government !== "an individual") { r.push(`but it is undergoing some internal turmoil. <span class="red">Resentment that has been quietly building among the arcology's elite turns into open rebellion!</span>`); if (arc.PCminority > 0) { @@ -221,7 +203,7 @@ App.EndWeek.neighborsDevelopment = function() { } desc = FutureSocieties.decay(i).map((fs) => FutureSocieties.displayName(fs)); if (desc.length > 2) { - r.push(`Its citizens take the opportunity to make radical social changes, <span class="cyan">purging the ${desc.reduce((res, ch, i, arr) => res + (i === arr.length - 1 ? ' and ' : ', ') + ch)}</span> favored by the old government.`); + r.push(`Its citizens take the opportunity to make radical social changes, <span class="cyan">purging the ${arrayToSentence(desc)}</span> favored by the old government.`); } else if (desc.length === 2) { r.push(`Its citizens take the opportunity to make social changes, <span class="cyan">discarding the ${desc[0]} and ${desc[1]}</span> favored by the old government.`); } else if (desc.length === 1) { @@ -345,6 +327,7 @@ App.EndWeek.neighborsDevelopment = function() { arc.prosperity -= V.arcologies[0].CyberEconomic * 2; const warSpoils = Math.ceil(10 + Math.max(((100 / weekModifier) * arc.prosperity * V.arcologies[0].CyberEconomic), 0)); arc.prosperity = Math.clamp(arc.prosperity, 1, V.AProsperityCap); + let redHanded = 0; if (random(0, 100) >= catchChance - (10 * V.arcologies[0].CyberEconomic)) { V.arcologies[0].prosperity -= V.arcologies[0].CyberEconomic * 3; redHanded = 1; @@ -391,6 +374,7 @@ App.EndWeek.neighborsDevelopment = function() { } arc.prosperity = Math.clamp(arc.prosperity, 1, 300); arc.ownership = Math.clamp(arc.ownership, 0, 100); + let redHanded = 0; if (random(0, 100) >= catchChance - (10 * V.arcologies[0].CyberReputation)) { V.arcologies[0].prosperity -= V.arcologies[0].CyberReputation * 3; redHanded = 1; @@ -412,31 +396,24 @@ App.EndWeek.neighborsDevelopment = function() { /* AI ARCOLOGY RENAMING */ - for (let j = 0; j < V.arcologies.length; j++) { - const arc2 = V.arcologies[j]; - if (arc.direction !== arc2.direction) { - if (arc.name === arc2.name) { - arc.name = "Arcology X-" + (i < 4 ? i : i + 1); - /* X-4 is reserved for player's arcology, so X-1 is available */ - r.push(`It resumes its original name, <span class="bold">${arc.name}</span>, since the arcology to the ${arc.direction} of yours is also named ${arc2.name}.`); - break; - } - } + const conflict = V.arcologies.find(a => arc.direction !== a.direction && arc.name === a.name); + if (conflict) { + arc.name = "Arcology X-" + (i < 4 ? i : i + 1); + /* X-4 is reserved for player's arcology, so X-1 is available */ + r.push(`It resumes its original name, <span class="bold">${arc.name},</span> since the arcology to the ${conflict.direction} of yours is also named ${conflict.name}.`); } } /* ECONOMIC WARFARE */ - for (let j = 0; j < V.arcologies.length; j++) { - const arc2 = V.arcologies[j]; - if (arc.direction === arc2.embargoTarget) { - arc.prosperity -= arc2.embargo * 2; - if (arc2.direction !== 0) { - arc2.prosperity -= arc2.embargo * 2; - } - arc.prosperity = Math.clamp(arc.prosperity, 1, 300); - r.push(`${arc2.name} targets ${arc.name} for <span class="red">economic warfare.</span>`); + const embargoer = V.arcologies.find(a => arc.direction === a.embargoTarget); + if (embargoer) { + arc.prosperity -= embargoer.embargo * 2; + if (embargoer.direction !== 0) { + embargoer.prosperity -= embargoer.embargo * 2; } + arc.prosperity = Math.clamp(arc.prosperity, 1, 300); + r.push(`${embargoer.name} targets ${arc.name} for <span class="red">economic warfare.</span>`); } /* FUTURE SOCIETY PROGRESS */ @@ -476,7 +453,7 @@ App.EndWeek.neighborsDevelopment = function() { } const passive = new App.Neighbor.PassiveFSInfluence(i); if (arc.FSSupremacist !== "unset") { - r.push(`${passive.output("FSSupremacist")}`); + r.push(passive.output("FSSupremacist")); if (arc.direction !== 0) { if (arc.FSSupremacist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -537,7 +514,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSSubjugationist !== "unset") { - r.push(`${passive.output("FSSubjugationist")}`); + r.push(passive.output("FSSubjugationist")); if (arc.direction !== 0) { if (arc.FSSubjugationist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -598,7 +575,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSRepopulationFocus !== "unset") { - r.push(`${passive.output("FSRepopulationFocus")}`); + r.push(passive.output("FSRepopulationFocus")); if (arc.direction !== 0) { if (arc.FSRepopulationFocus >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -629,7 +606,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSRestart !== "unset") { - r.push(`${passive.output("FSRestart")}`); + r.push(passive.output("FSRestart")); if (arc.direction !== 0) { if (arc.FSRestart >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -663,7 +640,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSGenderRadicalist !== "unset") { - r.push(`${passive.output("FSGenderRadicalist")}`); + r.push(passive.output("FSGenderRadicalist")); if (arc.direction !== 0) { if (arc.FSGenderRadicalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -701,7 +678,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSGenderFundamentalist !== "unset") { - r.push(`${passive.output("FSGenderFundamentalist")}`); + r.push(passive.output("FSGenderFundamentalist")); if (arc.direction !== 0) { if (arc.FSGenderFundamentalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -726,7 +703,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSPaternalist !== "unset") { - r.push(`${passive.output("FSPaternalist")}`); + r.push(passive.output("FSPaternalist")); if (arc.direction !== 0) { if (arc.FSPaternalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -758,7 +735,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSDegradationist !== "unset") { - r.push(`${passive.output("FSDegradationist")}`); + r.push(passive.output("FSDegradationist")); if (arc.direction !== 0) { if (arc.FSDegradationist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -792,7 +769,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSIntellectualDependency !== "unset") { - r.push(`${passive.output("FSIntellectualDependency")}`); + r.push(passive.output("FSIntellectualDependency")); if (arc.direction !== 0) { if (arc.FSIntellectualDependency >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -819,7 +796,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSSlaveProfessionalism !== "unset") { - r.push(`${passive.output("FSSlaveProfessionalism")}`); + r.push(passive.output("FSSlaveProfessionalism")); if (arc.direction !== 0) { if (arc.FSSlaveProfessionalism >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -862,7 +839,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSBodyPurist !== "unset") { - r.push(`${passive.output("FSBodyPurist")}`); + r.push(passive.output("FSBodyPurist")); if (arc.direction !== 0) { if (arc.FSBodyPurist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -886,7 +863,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSTransformationFetishist !== "unset") { - r.push(`${passive.output("FSTransformationFetishist")}`); + r.push(passive.output("FSTransformationFetishist")); if (arc.direction !== 0) { if (arc.FSTransformationFetishist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -915,7 +892,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSYouthPreferentialist !== "unset") { - r.push(`${passive.output("FSYouthPreferentialist")}`); + r.push(passive.output("FSYouthPreferentialist")); if (arc.direction !== 0) { if (arc.FSYouthPreferentialist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -923,7 +900,7 @@ App.EndWeek.neighborsDevelopment = function() { if (V.pedo_mode === 1 || V.minimumSlaveAge < 6) { arc.name = App.Neighbor.getUnusedName(setup.ArcologyNamesYouthPreferentialistLow); } else if (V.minimumSlaveAge < 14) { - arc.name = either(setup.ArcologyNamesYouthPreferentialist, setup.ArcologyNamesYouthPreferentialistLow); + arc.name = App.Neighbor.getUnusedName(either(setup.ArcologyNamesYouthPreferentialist, setup.ArcologyNamesYouthPreferentialistLow)); } else { arc.name = App.Neighbor.getUnusedName(setup.ArcologyNamesYouthPreferentialist); } @@ -945,7 +922,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSMaturityPreferentialist !== "unset") { - r.push(`${passive.output("FSMaturityPreferentialist")}`); + r.push(passive.output("FSMaturityPreferentialist")); if (arc.direction !== 0) { if (arc.FSMaturityPreferentialist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -970,7 +947,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSPetiteAdmiration !== "unset") { - r.push(`${passive.output("FSPetiteAdmiration")}`); + r.push(passive.output("FSPetiteAdmiration")); if (arc.direction !== 0) { if (arc.FSPetiteAdmiration >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -997,7 +974,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSStatuesqueGlorification !== "unset") { - r.push(`${passive.output("FSStatuesqueGlorification")}`); + r.push(passive.output("FSStatuesqueGlorification")); if (arc.direction !== 0) { if (arc.FSStatuesqueGlorification >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1026,7 +1003,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSSlimnessEnthusiast !== "unset") { - r.push(`${passive.output("FSSlimnessEnthusiast")}`); + r.push(passive.output("FSSlimnessEnthusiast")); if (arc.direction !== 0) { if (arc.FSSlimnessEnthusiast >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1052,7 +1029,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSAssetExpansionist !== "unset") { - r.push(`${passive.output("FSAssetExpansionist")}`); + r.push(passive.output("FSAssetExpansionist")); if (arc.direction !== 0) { if (arc.FSAssetExpansionist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1086,7 +1063,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSPastoralist !== "unset") { - r.push(`${passive.output("FSPastoralist")}`); + r.push(passive.output("FSPastoralist")); if (arc.direction !== 0) { if (arc.FSPastoralist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1113,7 +1090,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSCummunism !== "unset") { - r.push(`${passive.output("FSCummunism")}`); + r.push(passive.output("FSCummunism")); if (arc.direction !== 0) { if (arc.FSCummunism >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1146,7 +1123,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSPhysicalIdealist !== "unset") { - r.push(`${passive.output("FSPhysicalIdealist")}`); + r.push(passive.output("FSPhysicalIdealist")); if (arc.direction !== 0) { if (arc.FSPhysicalIdealist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1177,7 +1154,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSHedonisticDecadence !== "unset") { - r.push(`${passive.output("FSHedonisticDecadence")}`); + r.push(passive.output("FSHedonisticDecadence")); if (arc.direction !== 0) { if (arc.FSHedonisticDecadence >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1207,7 +1184,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSIncestFetishist !== "unset") { - r.push(`${passive.output("FSIncestFetishist")}`); + r.push(passive.output("FSIncestFetishist")); if (arc.direction !== 0) { if (arc.FSIncestFetishist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1232,7 +1209,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSChattelReligionist !== "unset") { - r.push(`${passive.output("FSChattelReligionist")}`); + r.push(passive.output("FSChattelReligionist")); if (arc.direction !== 0) { if (arc.FSChattelReligionist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1261,7 +1238,7 @@ App.EndWeek.neighborsDevelopment = function() { } if (arc.FSRomanRevivalist !== "unset") { - r.push(`${passive.output("FSRomanRevivalist")}`); + r.push(passive.output("FSRomanRevivalist")); if (arc.direction !== 0) { if (arc.FSRomanRevivalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1284,7 +1261,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSNeoImperialist !== "unset") { - r.push(`${passive.output("FSNeoImperialist")}`); + r.push(passive.output("FSNeoImperialist")); if (arc.direction !== 0) { if (arc.FSNeoImperialist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1307,7 +1284,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSAztecRevivalist !== "unset") { - r.push(`${passive.output("FSAztecRevivalist")}`); + r.push(passive.output("FSAztecRevivalist")); if (arc.direction !== 0) { if (arc.FSAztecRevivalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1330,7 +1307,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSEgyptianRevivalist !== "unset") { - r.push(`${passive.output("FSEgyptianRevivalist")}`); + r.push(passive.output("FSEgyptianRevivalist")); if (arc.direction !== 0) { if (arc.FSEgyptianRevivalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1353,7 +1330,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSEdoRevivalist !== "unset") { - r.push(`${passive.output("FSEdoRevivalist")}`); + r.push(passive.output("FSEdoRevivalist")); if (arc.direction !== 0) { if (arc.FSEdoRevivalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1376,7 +1353,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSArabianRevivalist !== "unset") { - r.push(`${passive.output("FSArabianRevivalist")}`); + r.push(passive.output("FSArabianRevivalist")); if (arc.direction !== 0) { if (arc.FSArabianRevivalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1403,7 +1380,7 @@ App.EndWeek.neighborsDevelopment = function() { } } } else if (arc.FSChineseRevivalist !== "unset") { - r.push(`${passive.output("FSChineseRevivalist")}`); + r.push(passive.output("FSChineseRevivalist")); if (arc.direction !== 0) { if (arc.FSChineseRevivalist >= V.FSLockinLevel) { if ((arc.name.indexOf("Arcology") !== -1) && (random(0, 2) === 0)) { @@ -1440,8 +1417,7 @@ App.EndWeek.neighborsDevelopment = function() { /* INFLUENCE RECEPTION */ - for (let j = 0; j < V.arcologies.length; j++) { - const arc2 = V.arcologies[j]; + for (const arc2 of V.arcologies) { if (arc2.direction !== arc.direction) { if (arc2.influenceTarget === arc.direction) { arc2.influenceBonus = Math.clamp(arc2.influenceBonus, 0, V.FSLockinLevel); @@ -1969,9 +1945,6 @@ App.EndWeek.neighborsDevelopment = function() { if (arc.influenceTarget === -1) { App.Neighbor.selectInfluenceTarget(i); } - } - - if (arc.direction !== 0) { arc.prosperity = Math.clamp(arc.prosperity, 1, 300); arc.ownership = Math.clamp(arc.ownership, 0, 100); arc.PCminority = Math.clamp(arc.PCminority, 0, 100); @@ -2039,7 +2012,7 @@ App.EndWeek.neighborsDevelopment = function() { return el; /** - * + * * @param {number} i */ function neighborsFSadoption(i) { @@ -2048,7 +2021,7 @@ App.EndWeek.neighborsDevelopment = function() { let r = []; const {heU, girlU} = getNonlocalPronouns(0).appendSuffix('U'); - r.push(`<span class="bold">${arc.name}</span>, your`); + r.push(`<span class="bold">${arc.name},</span> your`); if (arc.direction === 0) { r.push(`arcology,`); } else { @@ -2700,7 +2673,7 @@ App.EndWeek.neighborsDevelopment = function() { return; } if (validFSes.includes("FSIncestFetishist")) { - const lover = V.slaves.find(function(s) { return s.ID === leader.relationshipTarget && areRelated(s, leader) && s.assignment === "live with your agent"; }); + const lover = V.slaves.find(s => (s.ID === leader.relationshipTarget && areRelated(s, leader) && s.assignment === "live with your agent")); if ((leader.behavioralQuirk === "sinful" || leader.sexualQuirk === "perverted") && lover && V.seeIncest === 1) { r.push(`Your agent <span class="pink">leader.slaveName</span> successfully pushes it to <span class="yellow">adopt Incest Festishism,</span> to share the love and joy ${he} holds with ${his} ${relativeTerm(leader, lover)}.`); arc.FSIncestFetishist = 5;