diff --git a/src/endWeek/reports/childrenReport.js b/src/endWeek/reports/childrenReport.js index 5809409271abaacbc181f44b9e3da3fd560c8e76..12a7f881484db2fb9324717b8a2fb6aae6ab4b58 100644 --- a/src/endWeek/reports/childrenReport.js +++ b/src/endWeek/reports/childrenReport.js @@ -6,13 +6,15 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { const frag = new DocumentFragment(), - Matron = V.Matron, + Matron = S.Matron, nannies = App.Utils.sortedEmployees(App.Entity.facilities.nursery), NL = App.Entity.facilities.nursery.employeesIDs().size, CL = V.cribs.length, medianNannyIntelligence = NL ? findMedianNannyIntelligence() : null, - medianNannyIntelligenceImplant = NL ? findMedianNannyIntelligenceImplant() : null; + medianNannyIntelligenceImplant = NL ? findMedianNannyIntelligenceImplant() : null, + + randomNanny = NL > 1 ? jsRandom(0, nannies.length - 1) : 0; for (const child of V.cribs) { const childDiv = App.UI.DOM.appendNewElement("div", frag); @@ -21,18 +23,26 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { if (child.actualAge >= 3) { if (Matron) { - childDiv.append(matronFetishEffects(child)); + if (Matron.fetish !== "none") { + childDiv.append(matronFetishEffects(child)); + } + childDiv.append(matronEducationEffects(child)); // childDiv.append(matronFitnessEffects(child)); } - if (nannies) { - childDiv.append(nannyFetishEffects(child)); + if (NL > 0) { + let nanny = nannies[randomNanny]; + + if (nanny.fetish !== "none") { + childDiv.append(nannyFetishEffects(child, nanny)); + } + childDiv.append(nannyEducationEffects(child)); // childDiv.append(nannyFitnessEffects(child)); } - if (CL > 1 && V.cribs.splice(V.cribs.indexOf(child), 1).some(c => c.actualAge >= 3)) { // checks that at least one other child is at least 3 years of age + if (multipleChildrenOverTargetAge(V.cribs.findIndex(c => c.ID === child.ID))) { childDiv.append(childFriendshipRivalries(child)); } @@ -55,18 +65,16 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { { He } = getPronouns(child), chance = jsRandom(1, 100); - if (Matron.fetish !== "none") { - if (chance > 90) { - if (child.fetish === "none") { - child.fetish = Matron.fetish; + if (chance > 90) { + if (child.fetish === "none") { + child.fetish = Matron.fetish; - return `${child.slaveName} has taken a few cues from ${Matron.slaveName}, and ${newChildFetish(child.fetish)}.`; - } else { - if (chance > 95) { - child.fetish = Matron.fetish; + return `${child.slaveName} has taken a few cues from ${Matron.slaveName}, and ${newChildFetish(child.fetish)}. `; + } else { + if (chance > 95) { + child.fetish = Matron.fetish; - return `${Matron.slaveName} has rubbed off on ${child.slaveName}, in more ways than one. ${He} ${newChildFetish(child.fetish)}.`; - } + return `${Matron.slaveName} has rubbed off on ${child.slaveName}, in more ways than one. ${He} ${newChildFetish(child.fetish)}. `; } } } @@ -107,24 +115,21 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { // MARK: Nanny Effects - function nannyFetishEffects(child) { + function nannyFetishEffects(child, slave) { const { he } = getPronouns(child), - randomNanny = NL > 1 ? jsRandom(0, nannies.length - 1) : 0, - slave = nannies[randomNanny]; + chance = jsRandom(1, 100); - if (slave.fetish !== "none") { - if (chance > 85) { - if (child.fetish === "none") { - child.fetish = slave.fetish; + if (chance > 85) { + if (child.fetish === "none") { + child.fetish = slave.fetish; - return `${slave.slaveName} has left quite an impression on ${child.slaveName}, and ${he} ${newChildFetish(child.fetish)}.`; - } else { - if (chance > 90) { - child.fetish = slave.fetish; + return `${slave.slaveName} has left quite an impression on ${child.slaveName}, and ${he} ${newChildFetish(child.fetish)}. `; + } else { + if (chance > 90) { + child.fetish = slave.fetish; - return `${child.slaveName} seems to have taken to ${slave.slaveName}'s example, and ${newChildFetish(child.fetish)}.`; - } + return `${child.slaveName} seems to have taken to ${slave.slaveName}'s example, and ${newChildFetish(child.fetish)}. `; } } } @@ -169,7 +174,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { // TODO: redo this entire section // TODO: double check these classes, make sure they make sense const - div = document.createElement("div"), + span = document.createElement("span"), { he, He, His } = getPronouns(child); if (V.nurseryWeight) { @@ -184,24 +189,24 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { child.weight += 5; } - div.append(`${He} is being fed an excessive amount of food, causing`, weightSpan); + span.append(`${He} is being fed an excessive amount of food, causing`, weightSpan); } else if (V.nurseryWeightSetting === 2) { - const weightSpan = App.UI.DOM.makeElement("span", `decreases the amount of food ${he} eats.`, "improvement"); + const weightSpan = App.UI.DOM.makeElement("span", `decreases the amount of food ${he} eats. `, "improvement"); if (child.weight > 10) { child.weight--; - div.append(`${caretaker} notices ${he} is overweight and `, weightSpan); + span.append(`${caretaker} notices ${he} is overweight and `, weightSpan); } else if (child.weight <= -10) { - const weightSpan = App.UI.DOM.makeElement("span", `increases the amount of food ${he} eats.`, "improvement"); + const weightSpan = App.UI.DOM.makeElement("span", `increases the amount of food ${he} eats. `, "improvement"); child.weight++; - div.append(`${caretaker} notices ${he} is underweight and `, weightSpan); + span.append(`${caretaker} notices ${he} is underweight and `, weightSpan); } else { const weightSpan = App.UI.DOM.makeElement("span", 'currently a healthy weight;', ["change", "positive"]); - div.append(`${He} is `, weightSpan, ` efforts will be made to maintain it. `); + span.append(`${He} is `, weightSpan, ` efforts will be made to maintain it. `); } } else if (V.nurseryWeightSetting === 0) { if (child.weight > -20) { @@ -209,20 +214,20 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { child.weight -= 40; - div.append(`${His} developing body `, weightSpan); + span.append(`${His} developing body `, weightSpan); } } } else { if (child.weight > -20) { - const weightSpan = App.UI.DOM.makeElement("span", 'quickly sheds its gained weight.', ["health", "dec"]); + const weightSpan = App.UI.DOM.makeElement("span", 'quickly sheds its gained weight. ', ["health", "dec"]); child.weight -= 40; - div.append(`${His} developing body `, weightSpan); + span.append(`${His} developing body `, weightSpan); } } - return div; + return span; } function musclesRulesEffects(child) { @@ -240,7 +245,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { div.append(`${He} is being worked out as often as possible, resulting in `, muscleSpan); if (V.nurseryMusclesSetting === 2) { - const muscleSpan = App.UI.DOM.makeElement("span", `decreases the amount of exercise ${he} receives.`, "improvement"); + const muscleSpan = App.UI.DOM.makeElement("span", `decreases the amount of exercise ${he} receives. `, "improvement"); if (child.muscles > 100) { child.muscles -= 5; @@ -249,7 +254,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { div.append(`${caretaker} notices ${he} is overly muscular and `, muscleSpan); } else if (V.nurseryMusclesSetting === 1) { if (child.muscles < -10) { - const muscleSpan = App.UI.DOM.makeElement("span", `increases the amount of exercise ${he} receives.`, "improvement"); + const muscleSpan = App.UI.DOM.makeElement("span", `increases the amount of exercise ${he} receives. `, "improvement"); child.muscles--; @@ -259,7 +264,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { child.muscles++; - div.append(`${He} has `, muscleSpan, ` efforts will be made to maintain it.`); + div.append(`${He} has `, muscleSpan, ` efforts will be made to maintain it. `); } else { const muscleSpan = App.UI.DOM.makeElement("span", 'quickly loses its gained muscle.', ["health", "dec"]); @@ -283,12 +288,18 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { // MARK: Miscellaneous Functions function childFriendshipRivalries(child) { - const - becomeFriends = () => `${child.slaveName} and ${target.slaveName} have realized that they have more in common that they originally thought, and have become friends.`, - becomeRivals = () => `${child.slaveName} and ${target.slaveName} have more differences between them than they could put aside and have become rivals.`; + const cribsCopy = Array.from(V.cribs); - for (const target of V.cribs) { + cribsCopy.splice(V.cribs.findIndex(c => c.ID === child.ID)); + + for (const target of cribsCopy) { const + becomeFriends = () => `${child.slaveName} and ${target.slaveName} have realized that they have more in common that they originally thought, and have become friends. `, + becomeRivals = () => `${child.slaveName} and ${target.slaveName} have more differences between them than they could put aside and have become rivals. `, + haveSameFetish = () => child.fetish === target.fetish && child.fetish !== "none", + haveSameBehavioralQuirk = () => child.behavioralQuirk === target.behavioralQuirk && child.behavioralQuirk !== "none", + haveSameSexualQuirk = () => child.sexualQuirk === target.sexualQuirk && child.sexualQuirk !== "none", + div = document.createElement("div"), { his } = getPronouns(target), @@ -299,48 +310,52 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { rival = 0; if (target.actualAge >= 3) { - if (target.fetish === child.fetish) { - div.append(`${sameFetish(child, target)}, a fact over which they bond.`); + if (haveSameFetish()) { + div.append(`${sameFetish(child, target)}, a fact over which they bond. `); friend++; } - if (target.sexualQuirk === child.sexualQuirk || target.behavioralQuirk === child.behavioralQuirk) { - div.append(`Since ${child.slaveName} and ${target.slaveName} both ${target.sexualQuirk === child.sexualQuirk ? - target.sexualQuirk : - target.behavioralQuirk}, they learn to get along a bit better.`); + if (haveSameBehavioralQuirk()) { // TODO: + div.append(`Since ${sameBehavioralQuirk(child, target)}, they learn to get along a bit better. `); + + friend++; + } + + if (haveSameSexualQuirk()) { + div.append(`Because ${sameSexualQuirk(child, target)}, the two grow a bit closer. `); friend++; } if (target.fetish === "sadist" || target.fetish === "dom") { - div.append(`${target.slaveName} is a ${target.fetish}, and ${child.slaveName} is often ${his} target, which ${child.slaveName} doesn't particularly like.`); + div.append(`${target.slaveName} is a ${target.fetish}, and ${child.slaveName} is often ${his} target, which ${child.slaveName} doesn't particularly like. `); rival++; } else if (child.fetish === "sadist" || child.fetish === "dom") { - div.append(`${child.slaveName} is a ${child.fetish}, and ${target.slaveName} is often ${his} target, which ${target.slaveName} doesn't particularly like.`); + div.append(`${child.slaveName} is a ${child.fetish}, and ${target.slaveName} is often ${his} target, which ${target.slaveName} doesn't particularly like. `); rival++; } - if (areRelated(slave, target) || areCousins(slave, target)) { - if (areRelated(slave, target)) { + if (areRelated(child, target) || areCousins(child, target)) { + if (areRelated(child, target)) { if (rival) { - div.append(`${child.slaveName} and ${target.slaveName} are siblings, and find it difficult to really stay mad at each other, and they make up their differences somewhat.`); + div.append(`${child.slaveName} and ${target.slaveName} are siblings, and find it difficult to really stay mad at each other, and they make up their differences somewhat. `); friend += 2; } else { - div.append(`${child.slaveName} and ${target.slaveName} are siblings, a fact that draws them closer together.`); + div.append(`${child.slaveName} and ${target.slaveName} are siblings, a fact that draws them closer together. `); friend += 2; } } else { if (rival) { - div.append(`${child.slaveName} and ${target.slaveName} are cousins, and find it difficult to really stay mad at each other, and they make up their differences somewhat.`); + div.append(`${child.slaveName} and ${target.slaveName} are cousins, and find it difficult to really stay mad at each other, and they make up their differences somewhat. `); friend++; } else { - div.append(`${child.slaveName} and ${target.slaveName} are cousins, a fact that draws them closer together.`); + div.append(`${child.slaveName} and ${target.slaveName} are cousins, a fact that draws them closer together. `); friend++; } @@ -387,6 +402,8 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { } } } + + return div; } function sameFetish(child, target) { @@ -409,6 +426,59 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { return `Both ${child.slaveName} and ${target.slaveName} are sexually dominant`; case "pregnancy": return `The idea of pregnancy titillates both ${child.slaveName} and ${target.slaveName}`; + default: + throw `Unexpected value ${child.fetish} in sameFetish(). Please report this.`; + } + } + + function sameBehavioralQuirk(child, target) { + switch (child.behavioralQuirk) { + case "confident": + return `${child.slaveName} and ${target.slaveName} are both naturally confident`; + case "cutting": + return `both ${child.slaveName} and ${target.slaveName} have a cutting wit about them`; + case "funny": + return `${child.slaveName} and ${target.slaveName} can both make the other laugh`; + case "fitness": + return `${child.slaveName} and ${target.slaveName} both love to try to stay in shape`; + case "adores women": + return `${child.slaveName} and ${target.slaveName} both adore women`; + case "adores men": + return `both ${child.slaveName} are ${target.slaveName} adore men`; + case "insecure": + return `${child.slaveName} and ${target.slaveName} are both equally insecure`; + case "sinful": + return `both ${child.slaveName} and ${target.slaveName} love breaking cultural and religious mores`; + case "advocate": + return `${child.slaveName} and ${target.slaveName} can both make a strong case for slavery`; + default: + throw `Unexpected value ${child.behavioralQuirk} in sameBehavioralQuirk(). Please report this.`; + } + } + + // TODO: incorporate minimumSlaveAge + function sameSexualQuirk(child, target) { + switch (child.sexualQuirk) { + case "gagfuck queen": + return `${haveSameBehavioralQuirk() ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} love having their little throats fucked`; + case "painal queen": + return `${haveSameBehavioralQuirk() ? `neither` : `neither ${child.slaveName} nor ${target.slaveName}`} can get enough painal`; + case "strugglefuck queen": + return `${haveSameBehavioralQuirk() ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} love to put up a struggle during sex`; + case "tease": + return `${haveSameBehavioralQuirk() ? `the two are also both teases` : `${child.slaveName} and ${target.slaveName} are both teases`}`; + case "romantic": + return `${haveSameBehavioralQuirk() ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} see the world under from a romantic lense`; + case "perverted": + return `${haveSameBehavioralQuirk() ? `the two are also` : `${child.slaveName} and ${target.slaveName} are both`} big-time perverts`; + case "caring": + return `${haveSameBehavioralQuirk() ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} care about their partners`; + case "unflinching": + return `${haveSameBehavioralQuirk() ? `the two can also` : `${child.slaveName} and ${target.slaveName} both can`} take whatever their partner might throw at them `; + case "size queen": + return `${haveSameBehavioralQuirk() ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} have a love for huge cock`; + default: + throw `Unexpected value ${child.fetish} in sameSexualQuirk(). Please report this.`; } } } @@ -439,13 +509,20 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { } function childGrowTime(child) { - const { He } = getPronouns(child); + const + nameSpan = App.UI.DOM.makeElement("span", child.slaveName, "pink"), + limeSpan = App.UI.DOM.makeElement("span", 'ready for release.', "lime"), + mainSpan = document.createElement("span"), + + { He } = getPronouns(child); if (child.growTime > 0) { - return `<span class="pink">${child.slaveName}</span> is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}.`; + mainSpan.append(nameSpan, ` is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}. `); } else { - return `<span class="pink">${child.slaveName}</span> is <span class="lime">ready for release.</span> ${He} will be removed from ${V.nurseryName} upon your approach.`; + mainSpan.append(nameSpan, ' is ', limeSpan, ` ${He} will be removed from ${V.nurseryName} upon your approach. `); } + + return mainSpan; } function findMedianNannyIntelligence() { @@ -468,5 +545,17 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { return median(intelligenceImplantValues); } + /** + * Checks if there are more than one children over the target age in the Nursery + * @param {number} index + */ + function multipleChildrenOverTargetAge(index, age = 3) { + const cribsCopy = Array.from(V.cribs); + + cribsCopy.splice(index, 1); + + return V.cribs.length > 1 && cribsCopy.some(c => c.actualAge >= age); + } + return frag; }; diff --git a/src/npc/children/childrenReport.tw b/src/npc/children/childrenReport.tw index 3f3d82eda13e217e7175946439fc6e3b9a4f4e88..25e61aba4a5364839ca02d639891c2e218bf7350 100644 --- a/src/npc/children/childrenReport.tw +++ b/src/npc/children/childrenReport.tw @@ -1,3 +1,3 @@ :: Children Report [nobr] -<<print App.Facilities.Nursery.childrenReport()>> \ No newline at end of file +<<includeDOM App.Facilities.Nursery.childrenReport()>>