diff --git a/src/005-passages/eventsPassages.js b/src/005-passages/eventsPassages.js index 4a78501829554aeb42101f4aeee507cce5c62fb2..4f4e79e0f40961468baba3cf1c655717c5534018 100644 --- a/src/005-passages/eventsPassages.js +++ b/src/005-passages/eventsPassages.js @@ -57,10 +57,3 @@ new App.DomPassage("JS Random Event", return d; } ); - -new App.DomPassage("RE nickname", - () => { - V.nextButton = "Continue"; - return App.Events.RENickname(); - } -); diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js index 6df323011859ddedfa3242df8e82e3c2dd87eec9..396313bd40148ef8f8dd53cdaeeca51006255d0c 100644 --- a/src/events/randomEvent.js +++ b/src/events/randomEvent.js @@ -53,6 +53,8 @@ App.Events.getIndividualEvents = function() { new App.Events.RETSSiblingTussle(), new App.Events.RETSSimpleAssault(), new App.Events.RETSTopExhaustion(), + + new App.Events.RENickname().setType("RIE"), ]; }; @@ -70,6 +72,8 @@ App.Events.getNonindividualEvents = function() { new App.Events.RERelativeRecruiter(), new App.Events.REStaffedMorning(), new App.Events.REFullBed(), + + new App.Events.RENickname().setType("RNIE"), ]; }; diff --git a/src/events/reNickname.js b/src/events/reNickname.js index 981c44cca3b82a45cc3ef64be0890617552e4d03..bf9a106e3a6c15429228ad360ca48c59a5970ff7 100644 --- a/src/events/reNickname.js +++ b/src/events/reNickname.js @@ -1,412 +1,454 @@ -App.Events.RENickname = function() { - const el = new DocumentFragment(); - const intro = App.UI.DOM.makeElement("p"); - let seed; - let nicknameArray = []; - let nickname; - let situationDesc = ``; - let applyDesc = ``; - let notApplyDesc = ``; - if (V.seed === 1) { - V.returnTo = "RIE Eligibility Check"; - } else { - V.returnTo = "Next Week"; +App.Events.RENickname = class RENickname extends App.Events.BaseEvent { + eventPrerequisites() { + return [ + () => V.nicknamesAllowed === 1 + ]; + } + + actorPrerequisites() { + return [[ // one actor + (s) => (V.week - s.weekAcquired) >= 4, // owned for at least for weeks + (s) => s.assignment !== Job.ARCADE, // not immured in the arcade + (s) => s.fuckdoll === 0, // not in a fuckdoll suit + (s) => !s.slaveName.toLowerCase().includes("'"), // doesn't have a nickname yet + (s) => this.getQualifiedNicknames(s).length > 0 // qualifies for at least one nickname category + ]]; + } + + /** Chainable method to set the next passage to transition to, weight, and other settings depending on whether it's called as an individual or nonindividual event. + * @param {"RIE"|"RNIE"} eventType - RIE if individual, RNIE if nonindividual + */ + setType(eventType) { + this.params.type = eventType; + return this; + } + + /** Nickname event weight, ONLY when called as a nonindividual event, actually depends on the selected actor's devotion, which is SUPER WIERD. But whatever, we can totally do that... + * @returns {number} + */ + get weight() { + if (this.params.type === "RNIE") { + const [slave] = this.actors.map(a => getSlave(a)); + return (slave.devotion >= -20) ? 4 : 2; + } else { + return 1; + } } - const slave = getSlave(V.eventSlave.ID); - const { - He, His, Hers, - he, his, him, hers, himself, girl, woman - } = getPronouns(slave); - - /* NICKNAME QUALIFICATION CHECKS */ - - const _qualifiedNicknames = []; + /** @param {App.Entity.SlaveState} slave */ + getQualifiedNicknames(slave) { + const _qualifiedNicknames = []; - if (slave.nationality !== 0) { - _qualifiedNicknames.push("nationality"); - } - - if (V.seeRace === 1) { - switch (slave.race) { - case "amerindian": - _qualifiedNicknames.push("amerindian"); - break; - case "asian": - _qualifiedNicknames.push("asian"); - break; - case "black": - _qualifiedNicknames.push("black"); - break; - case "indo-aryan": - _qualifiedNicknames.push("indo-aryan"); - break; - case "latina": - _qualifiedNicknames.push("latina"); - break; - case "malay": - _qualifiedNicknames.push("malay"); - break; - case "middle eastern": - _qualifiedNicknames.push("middle eastern"); - break; - case "mixed race": - _qualifiedNicknames.push("mixed race"); - break; - case "pacific islander": - _qualifiedNicknames.push("pacific islander"); - break; - case "semitic": - _qualifiedNicknames.push("semitic"); - break; - case "southern european": - _qualifiedNicknames.push("southern european"); - break; - case "white": - _qualifiedNicknames.push("white"); - break; + if (slave.nationality) { + _qualifiedNicknames.push("nationality"); + } + if (V.seeRace === 1) { + switch (slave.race) { + case "amerindian": + _qualifiedNicknames.push("amerindian"); + break; + case "asian": + _qualifiedNicknames.push("asian"); + break; + case "black": + _qualifiedNicknames.push("black"); + break; + case "indo-aryan": + _qualifiedNicknames.push("indo-aryan"); + break; + case "latina": + _qualifiedNicknames.push("latina"); + break; + case "malay": + _qualifiedNicknames.push("malay"); + break; + case "middle eastern": + _qualifiedNicknames.push("middle eastern"); + break; + case "mixed race": + _qualifiedNicknames.push("mixed race"); + break; + case "pacific islander": + _qualifiedNicknames.push("pacific islander"); + break; + case "semitic": + _qualifiedNicknames.push("semitic"); + break; + case "southern european": + _qualifiedNicknames.push("southern european"); + break; + case "white": + _qualifiedNicknames.push("white"); + break; + } } - } - if (slave.boobs < 500 && slave.butt < 3 && slave.weight <= 10) { - _qualifiedNicknames.push("girlish"); - } - if (slave.boobs <= 300) { - _qualifiedNicknames.push("flat"); - } - if (slave.anus > 2 || slave.vagina > 2) { - _qualifiedNicknames.push("loose"); - } - if (slave.boobs < 500 && slave.butt < 3 && slave.dick > 0) { - _qualifiedNicknames.push("trap"); - } - if (slave.boobs > 500 && slave.butt > 3 && slave.dick > 0) { - _qualifiedNicknames.push("trans"); - } - if (slave.weight > 30) { - _qualifiedNicknames.push("chubby"); - } - if (slave.weight > 100) { - _qualifiedNicknames.push("fat"); - } - if (slave.muscles > 30) { - _qualifiedNicknames.push("muscles"); - } - if (slave.energy > 95) { - if (slave.anus > 1) { - _qualifiedNicknames.push("buttslut"); + if (slave.boobs < 500 && slave.butt < 3 && slave.weight <= 10) { + _qualifiedNicknames.push("girlish"); } - _qualifiedNicknames.push("cumslut"); - _qualifiedNicknames.push("humiliation"); - _qualifiedNicknames.push("submissive"); - } - if (slave.fetishKnown === 1 && slave.fetishStrength > 60) { - switch (slave.fetish) { - case "buttslut": - if (slave.anus > 0) { - _qualifiedNicknames.push("buttslut"); - } else { - _qualifiedNicknames.push("butt toy"); - } - break; - case "cumslut": - _qualifiedNicknames.push("cumslut"); - break; - case "humiliation": - _qualifiedNicknames.push("humiliation"); - break; - case "submissive": - _qualifiedNicknames.push("submissive"); + if (slave.boobs <= 300) { + _qualifiedNicknames.push("flat"); } - } - if (slave.counter.oral + slave.counter.vaginal + slave.counter.anal > 500) { - _qualifiedNicknames.push("veteran"); - } - if ((slave.boobs * slave.lactation) > 1000) { - _qualifiedNicknames.push("cow"); - } - if (slave.skill.oral <= 30 && slave.skill.anal <= 30) { - _qualifiedNicknames.push("novice"); - } - if (slave.ID === V.HeadGirlID) { - _qualifiedNicknames.push("Head Girl"); - } - if (slave.ID === V.BodyguardID) { - _qualifiedNicknames.push("Bodyguard"); - } - if (slave.ID === V.ConcubineID) { - _qualifiedNicknames.push("Concubine"); - } - if (slave.ID === V.AttendantID) { - _qualifiedNicknames.push("Attendant"); - } - if (slave.ID === V.MatronID) { - _qualifiedNicknames.push("Matron"); - } - if (slave.ID === V.MadamID) { - _qualifiedNicknames.push("Madam"); - } - if (slave.ID === V.djID) { - _qualifiedNicknames.push("DJ"); - } - if (slave.ID === V.RecruiterID) { - _qualifiedNicknames.push("Recruiter"); - } - if (slave.ID === V.WardenessID) { - _qualifiedNicknames.push("Wardeness"); - } - if (slave.ID === V.MilkmaidID) { - _qualifiedNicknames.push("Milkmaid"); - } - if (slave.ID === V.FarmerID) { - _qualifiedNicknames.push("Farmer"); - } - if (slave.ID === V.MilkmaidID && slave.dick > 5 && canPenetrate(slave) && V.cumSlaves > 3) { - _qualifiedNicknames.push("Collectrix"); - } - if (slave.ID === V.StewardessID) { - _qualifiedNicknames.push("Stewardess"); - } - if (slave.ID === V.SchoolteacherID) { - _qualifiedNicknames.push("Schoolteacher"); - } - if (slave.ID === V.NurseID) { - _qualifiedNicknames.push("Nurse"); - } - - if (slave.ID === V.LurcherID) { - _qualifiedNicknames.push("Lurcher"); - } - if (slave.assignment === "be a subordinate slave") { - _qualifiedNicknames.push("server"); - } - if (slave.nipples === "huge" || slave.nipples === "puffy") { - _qualifiedNicknames.push("nipples"); - } else if (slave.nipples === "fuckable") { - _qualifiedNicknames.push("nippleCunts"); - } - if (slave.areolae > 2) { - _qualifiedNicknames.push("areolae"); - } - if (slave.lips > 40) { - _qualifiedNicknames.push("lips"); - } - if (slave.labia > 1 && slave.vagina > -1) { - _qualifiedNicknames.push("labia"); - } - if (slave.physicalAge < 18) { - _qualifiedNicknames.push("young"); - } - if (slave.physicalAge > 35) { - _qualifiedNicknames.push("old"); - } - if (slave.physicalAge > 59) { - _qualifiedNicknames.push("reallyold"); - } - if (isAmputee(slave)) { - _qualifiedNicknames.push("amp"); - } - if ((slave.boobsImplant / slave.boobs) >= .60 || (slave.buttImplant / slave.butt) > .60) { - _qualifiedNicknames.push("implants"); - } - if ((slave.boobsImplant >= 750) && (slave.boobsImplant / slave.boobs) >= .60 && (slave.buttImplant >= 2) && (slave.buttImplant / slave.butt) > .60 && (slave.lipsImplant >= 10) && (slave.lipsImplant / slave.lips) > .30 && (slave.intelligence + slave.intelligenceImplant < -15)) { - _qualifiedNicknames.push("bimbo"); - } - if (slave.intelligence + slave.intelligenceImplant < -50) { - _qualifiedNicknames.push("stupid"); - } - if (slave.intelligence + slave.intelligenceImplant > 50) { - _qualifiedNicknames.push("smart"); - } - if (getBestVision(slave) === 0) { - _qualifiedNicknames.push("blind"); - } - if (slave.hears <= -2) { - _qualifiedNicknames.push("deaf"); - } - if (slave.voice === 0) { - _qualifiedNicknames.push("mute"); - } - if (slave.breedingMark === 1 && V.propOutcome === 1 && V.arcologies[0].FSRestart !== "unset") { - _qualifiedNicknames.push("mark"); - } - if (slave.broodmother > 1 && slave.preg >= 37) { - _qualifiedNicknames.push("hyperbroodmother"); - } - if (slave.broodmother === 1 && slave.preg >= 37) { - _qualifiedNicknames.push("broodmother"); - } - if (slave.bellyPreg >= 300000) { - _qualifiedNicknames.push("hyperpreg"); - } - if (slave.bellyPreg >= 30000 && slave.boobs >= 5000 && slave.butt > 5 && slave.hips >= 2 && slave.weight < 100) { - _qualifiedNicknames.push("fertilityGoddess"); - } - if (slave.dick > 5 && slave.balls > 5 && slave.counter.slavesKnockedUp > 4) { - _qualifiedNicknames.push("babymaker"); - } - if (slave.prostate > 2 && slave.dick === 0 && slave.vagina > -1) { - _qualifiedNicknames.push("superSquirter"); - } - if (slave.bellyPreg >= 100 && slave.pregKnown === 1) { - _qualifiedNicknames.push("preg"); - if ((slave.ovaries === 1 && slave.vagina === 0) || (slave.mpreg === 1 && slave.anus === 0)) { - _qualifiedNicknames.push("virgin preg"); + if (slave.anus > 2 || slave.vagina > 2) { + _qualifiedNicknames.push("loose"); } - } - if (slave.dick > 4) { - _qualifiedNicknames.push("hung"); - } - if (slave.dick > 0 && slave.balls === 0) { - _qualifiedNicknames.push("gelding"); - } - if (slave.dick === 1) { - _qualifiedNicknames.push("micropenis"); - } - if (slave.boobs >= 800) { - _qualifiedNicknames.push("boobs"); - } - if (slave.butt > 5) { - _qualifiedNicknames.push("butt"); - } - if (slave.vagina === 0) { - _qualifiedNicknames.push("virgin"); - } - if (slave.height >= 185) { - _qualifiedNicknames.push("tall"); - } - if (slave.height < 150) { - _qualifiedNicknames.push("short"); - } - if (slave.vagina === 1 && slave.skill.vaginal <= 10) { - _qualifiedNicknames.push("vaginalWhiner"); - } - if (slave.anus === 1 && slave.skill.anal <= 10) { - _qualifiedNicknames.push("analWhiner"); - } - if (slave.vagina === -1 && slave.dick === 0 && slave.balls === 0) { - _qualifiedNicknames.push("null"); - } - - if (_qualifiedNicknames.length === 0) { - Engine.play("RIE Eligibility Check"); - } else { - seed = _qualifiedNicknames.random(); - - data(); - - App.Events.drawEventArt(el, slave); - el.append(intro); - intro.append(introPassage()); - - const result = App.UI.DOM.appendNewElement("p", el); - - if (slave.slaveName.indexOf("'") === -1) { - App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link( - "Encourage use of the nickname", - () => { - const r = []; - const text = new DocumentFragment(); - r.push(`Whatever ${slave.slaveName}'s feelings about being called ${nickname} were, ${he} knows they're moot `); - if (!canHear(slave)) { - r.push(`when ${he} learns that you also`); + if (slave.boobs < 500 && slave.butt < 3 && slave.dick > 0) { + _qualifiedNicknames.push("trap"); + } + if (slave.boobs > 500 && slave.butt > 3 && slave.dick > 0) { + _qualifiedNicknames.push("trans"); + } + if (slave.weight > 30) { + _qualifiedNicknames.push("chubby"); + } + if (slave.weight > 100) { + _qualifiedNicknames.push("fat"); + } + if (slave.muscles > 30) { + _qualifiedNicknames.push("muscles"); + } + if (slave.energy > 95) { + if (slave.anus > 1) { + _qualifiedNicknames.push("buttslut"); + } + _qualifiedNicknames.push("cumslut"); + _qualifiedNicknames.push("humiliation"); + _qualifiedNicknames.push("submissive"); + } + if (slave.fetishKnown === 1 && slave.fetishStrength > 60) { + switch (slave.fetish) { + case "buttslut": + if (slave.anus > 0) { + _qualifiedNicknames.push("buttslut"); } else { - r.push(`the first time ${he} hears you`); + _qualifiedNicknames.push("butt toy"); } - r.push(` refer to ${him} that way. <span class="hotpink">${He} has become more submissive to you.</span> ${slave.slaveName} ${applyDesc}`); - App.Events.addNode(text, r); - jQuery(intro).empty(); - jQuery(result).empty().append(text); - slave.devotion += 4; - slave.slaveName = `'${nickname}' ${slave.slaveName}`; - } - )); - } - App.UI.DOM.appendNewElement("div", result, App.UI.DOM.passageLink("Disapprove, but encourage the other slaves to come up with a better nickname", "RE nickname")); - App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link( - "Put a stop to it", - () => { - jQuery(result).empty().append(`As soon as you make your will on the matter known, ${slave.slaveName} is referred to as ${slave.slaveName} again. ${slave.slaveName} ${notApplyDesc}`); + break; + case "cumslut": + _qualifiedNicknames.push("cumslut"); + break; + case "humiliation": + _qualifiedNicknames.push("humiliation"); + break; + case "submissive": + _qualifiedNicknames.push("submissive"); } - )); - App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link( - "No nicknames, now or ever", - () => { - jQuery(result).empty().append(`You make it known that the power to name slaves is yours and yours alone.`); - V.nicknamesAllowed = 0; + } + if (slave.counter.oral + slave.counter.vaginal + slave.counter.anal > 500) { + _qualifiedNicknames.push("veteran"); + } + if ((slave.boobs * slave.lactation) > 1000) { + _qualifiedNicknames.push("cow"); + } + if (slave.skill.oral <= 30 && slave.skill.anal <= 30) { + _qualifiedNicknames.push("novice"); + } + if (slave.ID === V.HeadGirlID) { + _qualifiedNicknames.push("Head Girl"); + } + if (slave.ID === V.BodyguardID) { + _qualifiedNicknames.push("Bodyguard"); + } + if (slave.ID === V.ConcubineID) { + _qualifiedNicknames.push("Concubine"); + } + if (slave.ID === V.AttendantID) { + _qualifiedNicknames.push("Attendant"); + } + if (slave.ID === V.MatronID) { + _qualifiedNicknames.push("Matron"); + } + if (slave.ID === V.MadamID) { + _qualifiedNicknames.push("Madam"); + } + if (slave.ID === V.djID) { + _qualifiedNicknames.push("DJ"); + } + if (slave.ID === V.RecruiterID) { + _qualifiedNicknames.push("Recruiter"); + } + if (slave.ID === V.WardenessID) { + _qualifiedNicknames.push("Wardeness"); + } + if (slave.ID === V.MilkmaidID) { + _qualifiedNicknames.push("Milkmaid"); + } + if (slave.ID === V.FarmerID) { + _qualifiedNicknames.push("Farmer"); + } + if (slave.ID === V.MilkmaidID && slave.dick > 5 && canPenetrate(slave) && V.cumSlaves > 3) { + _qualifiedNicknames.push("Collectrix"); + } + if (slave.ID === V.StewardessID) { + _qualifiedNicknames.push("Stewardess"); + } + if (slave.ID === V.SchoolteacherID) { + _qualifiedNicknames.push("Schoolteacher"); + } + if (slave.ID === V.NurseID) { + _qualifiedNicknames.push("Nurse"); + } + if (slave.ID === V.LurcherID) { + _qualifiedNicknames.push("Lurcher"); + } + if (slave.assignment === "be a subordinate slave") { + _qualifiedNicknames.push("server"); + } + if (slave.nipples === "huge" || slave.nipples === "puffy") { + _qualifiedNicknames.push("nipples"); + } else if (slave.nipples === "fuckable") { + _qualifiedNicknames.push("nippleCunts"); + } + if (slave.areolae > 2) { + _qualifiedNicknames.push("areolae"); + } + if (slave.lips > 40) { + _qualifiedNicknames.push("lips"); + } + if (slave.labia > 1 && slave.vagina > -1) { + _qualifiedNicknames.push("labia"); + } + if (slave.physicalAge < 18) { + _qualifiedNicknames.push("young"); + } + if (slave.physicalAge > 35) { + _qualifiedNicknames.push("old"); + } + if (slave.physicalAge > 59) { + _qualifiedNicknames.push("reallyold"); + } + if (isAmputee(slave)) { + _qualifiedNicknames.push("amp"); + } + if ((slave.boobsImplant / slave.boobs) >= .60 || (slave.buttImplant / slave.butt) > .60) { + _qualifiedNicknames.push("implants"); + } + if ((slave.boobsImplant >= 750) && (slave.boobsImplant / slave.boobs) >= .60 && (slave.buttImplant >= 2) && (slave.buttImplant / slave.butt) > .60 && (slave.lipsImplant >= 10) && (slave.lipsImplant / slave.lips) > .30 && (slave.intelligence + slave.intelligenceImplant < -15)) { + _qualifiedNicknames.push("bimbo"); + } + if (slave.intelligence + slave.intelligenceImplant < -50) { + _qualifiedNicknames.push("stupid"); + } + if (slave.intelligence + slave.intelligenceImplant > 50) { + _qualifiedNicknames.push("smart"); + } + if (getBestVision(slave) === 0) { + _qualifiedNicknames.push("blind"); + } + if (slave.hears <= -2) { + _qualifiedNicknames.push("deaf"); + } + if (slave.voice === 0) { + _qualifiedNicknames.push("mute"); + } + if (slave.breedingMark === 1 && V.propOutcome === 1 && V.arcologies[0].FSRestart !== "unset") { + _qualifiedNicknames.push("mark"); + } + if (slave.broodmother > 1 && slave.preg >= 37) { + _qualifiedNicknames.push("hyperbroodmother"); + } + if (slave.broodmother === 1 && slave.preg >= 37) { + _qualifiedNicknames.push("broodmother"); + } + if (slave.bellyPreg >= 300000) { + _qualifiedNicknames.push("hyperpreg"); + } + if (slave.bellyPreg >= 30000 && slave.boobs >= 5000 && slave.butt > 5 && slave.hips >= 2 && slave.weight < 100) { + _qualifiedNicknames.push("fertilityGoddess"); + } + if (slave.dick > 5 && slave.balls > 5 && slave.counter.slavesKnockedUp > 4) { + _qualifiedNicknames.push("babymaker"); + } + if (slave.prostate > 2 && slave.dick === 0 && slave.vagina > -1) { + _qualifiedNicknames.push("superSquirter"); + } + if (slave.bellyPreg >= 100 && slave.pregKnown === 1) { + _qualifiedNicknames.push("preg"); + if ((slave.ovaries === 1 && slave.vagina === 0) || (slave.mpreg === 1 && slave.anus === 0)) { + _qualifiedNicknames.push("virgin preg"); } - )); + } + if (slave.dick > 4) { + _qualifiedNicknames.push("hung"); + } + if (slave.dick > 0 && slave.balls === 0) { + _qualifiedNicknames.push("gelding"); + } + if (slave.dick === 1) { + _qualifiedNicknames.push("micropenis"); + } + if (slave.boobs >= 800) { + _qualifiedNicknames.push("boobs"); + } + if (slave.butt > 5) { + _qualifiedNicknames.push("butt"); + } + if (slave.vagina === 0) { + _qualifiedNicknames.push("virgin"); + } + if (slave.height >= 185) { + _qualifiedNicknames.push("tall"); + } + if (slave.height < 150) { + _qualifiedNicknames.push("short"); + } + if (slave.vagina === 1 && slave.skill.vaginal <= 10) { + _qualifiedNicknames.push("vaginalWhiner"); + } + if (slave.anus === 1 && slave.skill.anal <= 10) { + _qualifiedNicknames.push("analWhiner"); + } + if (slave.vagina === -1 && slave.dick === 0 && slave.balls === 0) { + _qualifiedNicknames.push("null"); + } + return _qualifiedNicknames; } - return el; - - function introPassage() { - const el = new DocumentFragment(); - const r = []; - nickname = either(...nicknameArray); - if (V.cheatMode) { - r.push(App.UI.DOM.makeElement("div", selectCategory())); - } - r.push(App.UI.DOM.slaveDescriptionDialog(slave)); - r.push(`${situationDesc} You begin to overhear your other slaves refer to ${him} as `); - if (V.cheatMode) { - r.push(App.UI.DOM.makeElement("span", selectNickname(), "pink")); - r.push(App.UI.DOM.makeElement("span", `${slave.slaveName}.`, "pink")); + + execute(node) { + const [slave] = this.actors.map(a => getSlave(a)); + const {He, he, him} = getPronouns(slave); + const _this = this; // fuck javascript's half-assed classes + + if (this.params.type === "RIE") { + V.nextLink = "Next Week"; + } else if (this.params.type === "RNIE") { + V.nextLink = "RIE Eligibility Check"; } else { - r.push(App.UI.DOM.makeElement("span", `${nickname} ${slave.slaveName}.`, "pink")); + throw "Bad event type"; } - App.Events.addParagraph(el, r); - return el; - function selectCategory() { + const qualifiedNicknames = this.getQualifiedNicknames(slave); + let seed = qualifiedNicknames.random(); + let regen = 0; + + App.Events.drawEventArt(node, slave); + const intro = App.UI.DOM.makeElement("div"); + node.append(intro); + intro.append(introPassage()); + + function introPassage() { const el = new DocumentFragment(); - const choice = App.UI.DOM.appendNewElement("span", el, `Select a category of nicknames `); - const select = App.UI.DOM.appendNewElement("select", choice); - let matchFound = false; - for (const category of _qualifiedNicknames) { - const option = App.UI.DOM.appendNewElement("option", select, category); - option.value = category; - if (option.value === seed) { - option.selected = true; - matchFound = true; - } + const r = []; + const {nicknameArray, situationDesc, applyDesc, notApplyDesc} = _this.data(slave, seed); + let nickname = either(...nicknameArray); + const catEl = App.UI.DOM.makeElement("div", selectCategory(V.cheatMode)); + r.push(catEl); + r.push(App.UI.DOM.slaveDescriptionDialog(slave), situationDesc); + const nickEl = App.UI.DOM.makeElement("span", selectNickname(V.cheatMode)); + r.push(`You begin to overhear your other slaves refer to ${him} as`, nickEl); + + App.Events.addParagraph(el, r); + + App.Events.addResponses(el, [ + new App.Events.Result("Encourage use of the nickname", encourage), + new App.Events.Result("Disapprove, but encourage the other slaves to come up with a better nickname", () => { + regen++; + seed = qualifiedNicknames.random(); + jQuery(intro).empty().append(introPassage()); + return ``; + }), + new App.Events.Result("Put a stop to it", () => { + disableCheats(); + return `As soon as you make your will on the matter known, ${slave.slaveName} is referred to as ${slave.slaveName} again. ${slave.slaveName} ${notApplyDesc}`; + }), + new App.Events.Result("No nicknames, now or ever", () => { + disableCheats(); + V.nicknamesAllowed = 0; + return `You make it known that the power to name slaves is yours and yours alone.`; + }) + ], `result-${regen}`); + return el; + + function disableCheats() { + $(catEl).empty().append(selectCategory(false)); + $(nickEl).empty().append(selectNickname(false)); } - if (!matchFound) { - select.selectedIndex = -1; + + function selectCategory(cheat) { + const el = new DocumentFragment(); + if (cheat) { + const choice = App.UI.DOM.appendNewElement("span", el, `Select a category of nicknames `); + const select = App.UI.DOM.appendNewElement("select", choice); + let matchFound = false; + for (const category of qualifiedNicknames) { + const option = App.UI.DOM.appendNewElement("option", select, category); + option.value = category; + if (option.value === seed) { + option.selected = true; + matchFound = true; + } + } + if (!matchFound) { + select.selectedIndex = -1; + } + select.onchange = () => { + const O = select.options[select.selectedIndex]; + seed = O.value; + jQuery(intro).empty().append(introPassage()); + }; + } + return el; } - select.onchange = () => { - const O = select.options[select.selectedIndex]; - seed = O.value; - data(); - jQuery(intro).empty().append(introPassage()); - }; - return el; - } - function selectNickname() { - const el = new DocumentFragment(); - const select = App.UI.DOM.appendNewElement("select", el); - let matchFound = false; - for (const category of nicknameArray) { - const option = App.UI.DOM.appendNewElement("option", select, `'${category}'`); - option.value = category; - if (option.value === nickname) { - option.selected = true; - matchFound = true; + function selectNickname(cheat) { + const el = new DocumentFragment(); + if (cheat) { + const select = App.UI.DOM.appendNewElement("select", el); + let matchFound = false; + for (const category of nicknameArray) { + const option = App.UI.DOM.appendNewElement("option", select, `'${category}'`); + option.value = category; + if (option.value === nickname) { + option.selected = true; + matchFound = true; + } + } + if (!matchFound) { + select.selectedIndex = -1; + } + select.onchange = () => { + const O = select.options[select.selectedIndex]; + nickname = O.value; + }; + } else { + App.UI.DOM.appendNewElement("span", el, `${nickname} `, "pink"); } + App.UI.DOM.appendNewElement("span", el, `${slave.slaveName}.`, "pink"); + return el; } - if (!matchFound) { - select.selectedIndex = -1; + + function encourage() { + disableCheats(); + const r = []; + r.push(`Whatever ${slave.slaveName}'s feelings about being called ${nickname} were, ${he} knows they're moot `); + if (!canHear(slave)) { + r.push(`when ${he} learns that you also`); + } else { + r.push(`the first time ${he} hears you`); + } + r.push(`refer to ${him} that way. <span class="hotpink">${He} has become more submissive to you.</span> ${slave.slaveName} ${applyDesc}`); + slave.devotion += 4; + slave.slaveName = `'${nickname}' ${slave.slaveName}`; + return r; } - select.onchange = () => { - const O = select.options[select.selectedIndex]; - nickname = O.value; - }; - return el; } } - function data() { - switch (seed) { + /** Fetch nickname data for a particular category and slave + * @param {App.Entity.SlaveState} slave + * @param {string} category + */ + data(slave, category) { + let nicknameArray = []; + let situationDesc = ``; + let applyDesc = ``; + let notApplyDesc = ``; + const { + He, he, His, his, him, + Hers, hers, himself, girl, woman + } = getPronouns(slave); + + switch (category) { case "nationality": switch (slave.nationality) { case "Afghan": @@ -1705,5 +1747,8 @@ App.Events.RENickname = function() { applyDesc = `finds some perverse pride in ${his} genital makeup, which defies traditional notions of gender.`; notApplyDesc = `will try ${his} best to keep up with what's demanded of a sex slave, despite the annoyance of lacking genitals.`; } + return { + nicknameArray, situationDesc, applyDesc, notApplyDesc + }; } }; diff --git a/src/js/eventSelectionJS.js b/src/js/eventSelectionJS.js index ab0beed8df675fb4d978f2a73e9a016cdc22de2c..bb35f0e41c706de9ccd6fb50633e29942cc92399 100644 --- a/src/js/eventSelectionJS.js +++ b/src/js/eventSelectionJS.js @@ -1446,18 +1446,6 @@ if(eventSlave.drugs === "breast injections") { V.events.push("RE snatch and grab followup"); } } - - /* NICKNAME EVENTS */ - - if (V.nicknamesAllowed === 1) { - let toSearch = eventSlave.slaveName.toLowerCase(); - if (!toSearch.includes("'")) { - if (V.week - eventSlave.weekAcquired >= 4) { - V.events.push("RE nickname"); - V.seed = 0; - } - } /* closes nickname check */ - } /* closes no nicknames option */ } /* closes mindbreak exempt */ if (eventSlave.fetish === "mindbroken") { diff --git a/src/uncategorized/randomNonindividualEvent.tw b/src/uncategorized/randomNonindividualEvent.tw index d26b4c7e3e194899ea7d3f3977efe8389a61610b..25e31b0674c0b9039836f74c104dd7f980996c3d 100644 --- a/src/uncategorized/randomNonindividualEvent.tw +++ b/src/uncategorized/randomNonindividualEvent.tw @@ -23,32 +23,6 @@ /* initialize event lists as arrays [], not objects {} */ <<set $events = [], $RecETSevent = [], $REFIevent = [], $PESSevent = [], $PETSevent = [], $REFSevent = [], $activeSlave = 0, _recruitEvents = []>> - <<set $seed = 0>> - - <<if $eventSlave.fuckdoll == 0>> - - <<if $nicknamesAllowed == 1>> - <<if $eventSlave.assignment != "be confined in the arcade">> - <<if ($eventSlave.slaveName.indexOf("'") == -1)>> - <<if ($week-$eventSlave.weekAcquired >= 4)>> - <<if ($eventSlave.devotion >= -20)>> - <<set $events.push("RE nickname")>> - <<set $events.push("RE nickname")>> - <<set $events.push("RE nickname")>> - <<set $events.push("RE nickname")>> - <<set $seed = 1>> /* tells RE nickname to set nextLink to RIE Eligibility Check */ - <<else>> - <<set $events.push("RE nickname")>> - <<set $events.push("RE nickname")>> - <<set $seed = 1>> /* tells RE nickname to set nextLink to RIE Eligibility Check */ - <</if>> - <</if>> - <</if>> /* closes nickname check */ - <</if>> - <</if>> /* closes no nicknames option */ - - <</if>> /* CLOSES FUCKDOLL CHECK */ - <<if $week >= 10>> <<set $events.push("P associates public slut")>> <</if>>