From 776d5b10d62638e89e95ac52b5ef28b5590b5e77 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Mon, 9 Nov 2020 15:56:43 -0800 Subject: [PATCH] Spa/cellblock cleanup --- src/endWeek/reports/cellblockReport.js | 8 +--- src/endWeek/reports/spaReport.js | 51 ++++++++++++-------------- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/src/endWeek/reports/cellblockReport.js b/src/endWeek/reports/cellblockReport.js index f9eba9aef65..44116007738 100644 --- a/src/endWeek/reports/cellblockReport.js +++ b/src/endWeek/reports/cellblockReport.js @@ -6,13 +6,9 @@ App.EndWeek.cellblockReport = function() { let r; const slaves = App.Utils.sortedEmployees(App.Entity.facilities.cellblock); - let brokenSlaves = 0, idleBonus = 0, softenedQuirks = 0, trustMalus = 0, FLsFetish = 0, devBonus; + let brokenSlaves = 0, idleBonus = 0, softenedQuirks = 0, trustMalus = 0, FLsFetish = 0; + let devBonus = (V.cellblockDecoration !== "standard") ? 1 : 0; - if (V.cellblockDecoration !== "standard") { - devBonus = 1; - } else { - devBonus = 0; - } const cellblockNameCaps = capFirstChar(V.cellblockName); V.flSex = App.EndWeek.getFLSex(App.Entity.facilities.cellblock);/* FIXME: should be local, passed as a parameter to saRules */ diff --git a/src/endWeek/reports/spaReport.js b/src/endWeek/reports/spaReport.js index f2057ae4246..0e003ee9be5 100644 --- a/src/endWeek/reports/spaReport.js +++ b/src/endWeek/reports/spaReport.js @@ -6,18 +6,17 @@ App.EndWeek.spaReport = function() { let r; const slaves = App.Utils.sortedEmployees(App.Entity.facilities.spa); - let DL = slaves.length; - let bonusToggle = 0, healthBonus = 0, idleBonus = 0, restedSlaves = 0, restedSlave, devBonus; + let healthBonus = 0, restedSlaves = 0, restedSlave; + let devBonus = (V.spaDecoration !== "standard") ? 1 : 0; - if (V.spaDecoration !== "standard") { - devBonus = 1; - } else { - devBonus = 0; - } V.flSex = App.EndWeek.getFLSex(App.Entity.facilities.spa); /* FIXME: should be local, passed as a parameter to saRules */ - if (V.AttendantID !== 0) { + function attendantText() { + let idleBonus = 0; + let bonusToggle = 0; + let FLsFetish = 0; r = []; + if (S.Attendant.health.condition < 100) { improveCondition(S.Attendant, normalRandInt(20)); } @@ -30,7 +29,6 @@ App.EndWeek.spaReport = function() { if (S.Attendant.rules.living !== "luxurious") { S.Attendant.rules.living = "luxurious"; } - let FLsFetish = 0; if (S.Attendant.fetishStrength <= 95) { if (S.Attendant.fetish !== "submissive") { if (fetishChangeChance(S.Attendant) > random(0, 100)) { @@ -101,13 +99,14 @@ App.EndWeek.spaReport = function() { idleBonus++; healthBonus++; } - let attendantUsedCure = 0; + let attendantUsedCure = false; App.Events.addNode(el, r, "div", "indent"); + const softenFlawBonus = bonusToggle ? 10 : 0; for (const slave of slaves) { const {he2, his2, him2} = getPronouns(slave).appendSuffix("2"); r = []; - if (slave.fetish === "mindbroken" && slave.health.condition > 20 && attendantUsedCure === 0 && V.spaFix !== 2) { - attendantUsedCure = 1; + if (slave.fetish === "mindbroken" && slave.health.condition > 20 && !attendantUsedCure && V.spaFix !== 2) { + attendantUsedCure = true; if (random(1, 100) > 90 - S.Attendant.devotion) { const curedSlave = App.UI.DOM.makeElement("div", null, "indent"); const curedArray = [`<span class="green">Something almost miraculous has happened.</span> ${S.Attendant.slaveName} has always refused to believe that ${slave.slaveName} could not be reached, and has lavished patient tenderness on ${him2} in ${V.spaName}. ${slave.slaveName} has begun to respond, and is stirring from ${his2} mental torpor.`]; @@ -129,7 +128,6 @@ App.EndWeek.spaReport = function() { r.push(curedSlave); } } - const seed = bonusToggle * 10; if (bonusToggle === 1 && slave.trust < 60) { slave.trust++; } @@ -231,20 +229,20 @@ App.EndWeek.spaReport = function() { } } if ( + !attendantUsedCure && (S.Attendant.intelligence + S.Attendant.intelligenceImplant > 15) && - (attendantUsedCure === 0) && - (S.Attendant.intelligence + S.Attendant.intelligenceImplant + seed) > random(1, 200) && + (S.Attendant.intelligence + S.Attendant.intelligenceImplant + softenFlawBonus) > random(1, 200) && (V.spaFix === 0) ) { if (slave.behavioralFlaw !== "none") { SoftenBehavioralFlaw(slave); - attendantUsedCure += 1; + attendantUsedCure = true; r.push(`${S.Attendant.slaveName} works carefully with ${slave.slaveName}, and successfully`); r.push(App.UI.DOM.makeElement("span", `softens ${his2} behavioral flaw`, "green")); r.push(`into an appealing quirk.`); } else if (slave.sexualFlaw !== "none") { SoftenSexualFlaw(slave); - attendantUsedCure += 1; + attendantUsedCure = true; r.push(`${S.Attendant.slaveName} works carefully with ${slave.slaveName}, and successfully`); r.push(App.UI.DOM.makeElement("span", `softens ${his2} sexual flaw`, "green")); r.push(`into an appealing quirk.`); @@ -259,12 +257,12 @@ App.EndWeek.spaReport = function() { App.Events.addNode(el, r, "div", "indent"); } - if (DL < V.spa) { - const seed = random(1, 10) + ((V.spa - DL) * (random(150, 170) + (idleBonus * 10))); + if (slaves.length < V.spa) { + const seed = random(1, 10) + ((V.spa - slaves.length) * (random(150, 170) + (idleBonus * 10))); cashX(seed, "spa", S.Attendant); r = []; r.push(`Since ${he} doesn't have enough slaves to occupy all ${his} time, the spa takes in citizens' slaves on a contract basis and ${he} helps them too, earning <span class="yellowgreen"> ${cashFormat(seed)}.</span>`); - if (V.arcologies[0].FSHedonisticDecadence > 0 && DL === 0) { + if (V.arcologies[0].FSHedonisticDecadence > 0 && slaves.length === 0) { r.push(`Society <span class="green">loves</span> being allowed to lounge in your spa, greatly advancing your laid back culture.`); FutureSocieties.Change("Hedonistic", 2); } @@ -272,18 +270,16 @@ App.EndWeek.spaReport = function() { } } - if (DL > 0) { + attendantText(); + + if (slaves.length > 0) { r = []; - if (DL > 1) { - r.push(`There are ${DL} slaves`); + if (slaves.length > 1) { + r.push(`There are ${slaves.length} slaves`); } else { r.push(`There is one slave`); } r.push(`resting and recuperating in the spa.`); - if (V.arcologies[0].FSHedonisticDecadence > 0 && DL === 0) { - r.push(`Society <span class="green">approves</span> of your slaves being pampered this way, greatly advancing your laid back culture.`); - FutureSocieties.Change("Hedonistic", 1); - } App.Events.addNode(el, r, "p", ["indent", "bold"]); } @@ -374,7 +370,6 @@ App.EndWeek.spaReport = function() { el.append(slaveFixed); restedSlaves++; restedSlave = slave; - DL--; continue; } -- GitLab