diff --git a/src/endWeek/saServeThePublic.js b/src/endWeek/saServeThePublic.js index 84bfd46b4d1a8eee0c59836d13152a75015222c8..cea7e5200928150a9e4e366b07f0871220245082 100644 --- a/src/endWeek/saServeThePublic.js +++ b/src/endWeek/saServeThePublic.js @@ -582,26 +582,14 @@ App.SlaveAssignment.serveThePublic = (function() { * */ function publicReactions(slave) { - let sstp; - if ((slave.rules.release.masturbation === 0 && !App.Utils.hasFamilySex(slave) && slave.rules.release.slaves === 0) && slave.rules.reward !== "orgasm") { r += ` ${He}'s a better slut because public service is ${his} main sexual outlet.`; } if (totalRelatives(slave) > 0) { let children = V.slaves.filter((s) => areRelated(slave, s) && (s.assignment === slave.assignment)); - if (children.length > 2) { - r += ` Since ${his} relatives,`; - for (sstp = 0; sstp < children.length; sstp++) { - if (sstp < children.length - 1) { - r += ` ${children[sstp].slaveName},`; - } else { - r += ` and ${children[sstp].slaveName},`; - } - } - r += ` are public sluts too, ${he} earns extra attention.`; - } else if (children.length > 1) { - r += ` Since ${his} relatives, ${children[0].slaveName} and ${children[1].slaveName}, are public sluts too, ${he} earns extra attention.`; + if (children.length > 1) { + r += ` Since ${his} relatives, ${arrayToSentence(children)}, are public sluts too, ${he} earns extra attention.`; } else if (children.length > 0) { r += ` Since ${his} relative, ${children[0].slaveName}, is a public slut too, ${he} earns extra attention.`; } @@ -614,17 +602,17 @@ App.SlaveAssignment.serveThePublic = (function() { } } if (slave.relationship > 0) { - sstp = V.slaveIndices[slave.relationshipTarget]; - if (sstp !== undefined && slave.assignment === V.slaves[sstp].assignment) { - r += ` ${His} ${relationshipTerm(slave)} ${V.slaves[sstp].slaveName} is also serving the public and they work well together.`; + const partner = getSlave(slave.relationshipTarget); + if (partner && slave.assignment === partner.assignment) { + r += ` ${His} ${relationshipTerm(slave)} ${partner.slaveName} is also serving the public and they work well together.`; } } else if (slave.relationship === -1) { r += ` ${He} relies on citizens' desire to fuck ${him} for emotional support, making ${him} an excellent, if occasionally disturbing, slut.`; } if (slave.rivalry !== 0) { - sstp = V.slaveIndices[slave.rivalryTarget]; - if (sstp !== undefined && slave.assignment === V.slaves[sstp].assignment) { - r += ` ${He}'s a little less effective due to ${his} mutual dislike with ${V.slaves[sstp].slaveName}.`; + const rival = getSlave(slave.rivalryTarget); + if (rival && slave.assignment === rival.assignment) { + r += ` ${He}'s a little less effective due to ${his} mutual dislike with ${rival.slaveName}.`; } } diff --git a/src/endWeek/saWhore.js b/src/endWeek/saWhore.js index 1fb242d40dd7f636a015f3b097757549d2843057..1ddf0a5a5e3ddf6f8eddb6d2c41557abe4e7fb1c 100644 --- a/src/endWeek/saWhore.js +++ b/src/endWeek/saWhore.js @@ -653,26 +653,14 @@ App.SlaveAssignment.whore = (function() { * @param {App.Entity.SlaveState} slave */ function publicReactions(slave) { - let SWi; - if ((slave.rules.release.masturbation === 0 && !App.Utils.hasFamilySex(slave) && slave.rules.release.slaves === 0) && slave.rules.reward !== "orgasm") { r += ` ${He}'s a better whore because prostitution is ${his} main sexual outlet.`; } if (totalRelatives(slave) > 0) { let children = V.slaves.filter((s) => areRelated(slave, s) && (s.assignment === slave.assignment)); - if (children.length > 2) { - r += ` Since ${his} relatives,`; - for (SWi = 0; SWi < children.length; SWi++) { - if (SWi < children.length - 1) { - r += ` ${children[SWi].slaveName},`; - } else { - r += ` and ${children[SWi].slaveName},`; - } - } - r += ` are selling themselves too, ${he} earns extra ¤ by working with them.`; - } else if (children.length > 1) { - r += ` Since ${his} relatives, ${children[0].slaveName} and ${children[1].slaveName}, are selling themselves too, ${he} earns extra ¤ by working with them.`; + if (children.length > 1) { + r += ` Since ${his} relatives, ${arrayToSentence(children)}, are selling themselves too, ${he} earns extra ¤ by working with them.`; } else if (children.length > 0) { const relativePronouns = getPronouns(children[0]); r += ` Since ${his} relative, ${children[0].slaveName}, is selling ${relativePronouns.objectReflexive} too, ${he} earns extra ¤ by working with ${relativePronouns.object}.`; @@ -686,17 +674,17 @@ App.SlaveAssignment.whore = (function() { } } if (slave.relationship > 0) { - SWi = V.slaveIndices[slave.relationshipTarget]; - if (SWi !== undefined && slave.assignment === V.slaves[SWi].assignment) { - r += ` ${His} ${relationshipTerm(slave)} ${V.slaves[SWi].slaveName} is also whoring, so ${he} earns a bit more.`; + const partner = getSlave(slave.relationshipTarget); + if (partner && slave.assignment === partner.assignment) { + r += ` ${His} ${relationshipTerm(slave)} ${partner.slaveName} is also whoring, so ${he} earns a bit more.`; } } else if (slave.relationship === -1) { r += ` ${He} relies on citizens' desire to fuck ${him} for emotional support, making ${him} an excellent, if occasionally disturbing, whore.`; } if (slave.rivalry !== 0) { - SWi = V.slaveIndices[slave.rivalryTarget]; - if (SWi !== undefined && slave.assignment === V.slaves[SWi].assignment) { - r += ` ${He} earns a little less ¤ due to bickering with ${V.slaves[SWi].slaveName}.`; + const rival = getSlave(slave.rivalryTarget); + if (rival && slave.assignment === rival.assignment) { + r += ` ${He} earns a little less ¤ due to bickering with ${rival.slaveName}.`; } } diff --git a/src/endWeek/slaveAssignmentReport.js b/src/endWeek/slaveAssignmentReport.js index 66a3b6bba6a577debc658bf7253958df39121830..ce8b3338e49e772e01e9e3831c606266c68425e9 100644 --- a/src/endWeek/slaveAssignmentReport.js +++ b/src/endWeek/slaveAssignmentReport.js @@ -17,10 +17,9 @@ App.EndWeek.slaveAssignmentReport = function() { } /** silent pass for any reassignments before generating reports */ - for (let i = 0; i < V.slaves.length; ++i) { - if (V.slaves[i].choosesOwnAssignment === 1) { - V.i = i; - App.SlaveAssignment.choosesOwnJob(V.slaves[i]); + for (const slave of V.slaves) { + if (slave.choosesOwnAssignment === 1) { + App.SlaveAssignment.choosesOwnJob(slave); } } diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js index a43f6547e698bf41698d0d67f32345e829d658f0..e31285558d9cf46a3a70d665176be0b36e6a2663 100644 --- a/src/interaction/slaveInteract.js +++ b/src/interaction/slaveInteract.js @@ -2775,39 +2775,31 @@ App.UI.SlaveInteract.custom = (function() { )); } if (slave.relationship >= 5) { - for (let _i = 0; _i < V.slaves.length; _i++) { - if (slave.relationshipTarget === V.slaves[_i].ID) { - if (V.slaves[_i].slaveSurname) { - if (slave.slaveSurname !== V.slaves[_i].slaveSurname) { - result.append(` | `); - const wifePronouns = getPronouns(V.slaves[_i]); - result.appendChild(App.UI.DOM.link( - `Give ${him} ${his} ${wifePronouns.wife}'s surname`, - () => { - slave.slaveSurname = V.slaves[_i].slaveSurname; - updateName(slave, {oldName:oldName, oldSurname:oldSurname}); - }, - false, - )); - break; - } - } - } + const spouse = getSlave(slave.relationshipTarget); + if (spouse.slaveSurname && slave.slaveSurname !== spouse.slaveSurname) { + result.append(` | `); + const wifePronouns = getPronouns(spouse); + result.appendChild(App.UI.DOM.link( + `Give ${him} ${his} ${wifePronouns.wife}'s surname`, + () => { + slave.slaveSurname = spouse.slaveSurname; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); + }, + false, + )); } } if (slave.relationship === -3) { - if (V.PC.slaveSurname) { - if (slave.slaveSurname !== V.PC.slaveSurname) { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} your surname`, - () => { - slave.slaveSurname = V.PC.slaveSurname; - updateName(slave, {oldName:oldName, oldSurname:oldSurname}); - }, - false, - )); - } + if (V.PC.slaveSurname && slave.slaveSurname !== V.PC.slaveSurname) { + result.append(` | `); + result.appendChild(App.UI.DOM.link( + `Give ${him} your surname`, + () => { + slave.slaveSurname = V.PC.slaveSurname; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); + }, + false, + )); } } if (V.arcologies[0].FSRomanRevivalist !== "unset") {