diff --git a/src/cheats/mod_EditSlaveCheat.tw b/src/cheats/mod_EditSlaveCheat.tw index 3ece6b32dae265ec7fbb3d01c04316340cab7bc0..0b39e745e74003940fcdae98070a18c0ff4e0a59 100644 --- a/src/cheats/mod_EditSlaveCheat.tw +++ b/src/cheats/mod_EditSlaveCheat.tw @@ -2,7 +2,6 @@ <<set $nextButton = "Continue">> <<set $nextLink = "MOD_Edit Slave Cheat Datatype Cleanup">> -<<set $oldName = $activeSlave.slaveName, $oldSurname = $activeSlave.slaveSurname>> <<set $tempSlave = clone($activeSlave)>> <<setLocalPronouns $tempSlave>> diff --git a/src/facilities/nursery/customizeChild.tw b/src/facilities/nursery/customizeChild.tw index e8d5fbab17fc1e5e417497f681ed109c78dacf68..243dec682954c23a60aad9dc166508eff67a68c3 100644 --- a/src/facilities/nursery/customizeChild.tw +++ b/src/facilities/nursery/customizeChild.tw @@ -1,7 +1,9 @@ :: Customize Child [nobr] -<<set $nextButton = "Continue", $nextLink = "Rename Child">> -<<set $oldName = $activeChild.slaveName, $oldSurname = $activeChild.slaveSurname>> +<<set $nextButton = "Continue">> +<<set _oldName = $activeChild.slaveName, _oldSurname = $activeChild.slaveSurname>> + +<p id="rename"></p> You may enter custom descriptors for the child's hair color, hair style, tattoos, or anything else here. After typing, press enter to commit your change. These custom descriptors will appear in descriptions of the child, but will have no gameplay effect. Changing them is free. <br><br> @@ -62,35 +64,61 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos <<if ((($activeChild.devotion >= -50) || ($activeChild.trust < -20)) && ($activeChild.birthName != $activeChild.slaveName)) || (($activeChild.devotion > 20) || ($activeChild.trust < -20))>> Change $his given name<<if $activeChild.birthName != $activeChild.slaveName>> ($his birth name was $activeChild.birthName)<</if>>: - <<textbox "$activeChild.slaveName" $activeChild.slaveName "Rename Child">> - <<link "Restore $his birth name" "Rename Child">> + <<includeDom App.UI.DOM.makeTextBox( + $activeChild.slaveName, + v => { + $activeChild.slaveName = v; + App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname}); + }, + false + )>> + <<link "Restore $his birth name">> <<set $activeChild.slaveName = $activeChild.birthName>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <<if $arcologies[0].FSPastoralist != "unset">> <<if $activeChild.lactation > 0>> - | <<link "Give $him a random cow given name" "Rename Child">> + | <<link "Give $him a random cow given name">> <<set $activeChild.slaveName = setup.cowSlaveNames.random()>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <</if>> <</if>> <<if $arcologies[0].FSChattelReligionist != "unset">> - | <<link "Give $him a random devotional given name" "Rename Child">> + | <<link "Give $him a random devotional given name">> <<set $activeChild.slaveName = setup.chattelReligionistSlaveNames.random()>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <</if>> <br><br> Change $his surname<<if $activeChild.birthSurname != $activeChild.slaveSurname>> ($his birth surname was $activeChild.birthSurname)<</if>>: <<if $activeChild.slaveSurname>> - <<textbox "$activeChild.slaveSurname" $activeChild.slaveSurname "Rename Child">> + <<includeDom App.UI.DOM.makeTextBox( + $activeChild.slaveSurname, + v => { + $activeChild.slaveSurname = v; + App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname}); + }, + false + )>> <<else>> - <<textbox "$activeChild.slaveSurname" "" "Rename Child">> + <<includeDom App.UI.DOM.makeTextBox( + "", + v => { + $activeChild.slaveSurname = v; + App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname}); + }, + false + )>> <</if>> - <<link "Restore $his birth surname" "Rename Child">> + <<link "Restore $his birth surname">> <<set $activeChild.slaveSurname = $activeChild.birthSurname>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <<if $activeChild.slaveSurname>> - | <<link "Take $his surname away" "Rename Child">> + | <<link "Take $his surname away">> <<set $activeChild.slaveSurname = 0>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <</if>> <<if $activeChild.relationship >= 5>> @@ -98,8 +126,9 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos <<if $activeChild.relationshipTarget == $slaves[_i].ID>> <<if $slaves[_i].slaveSurname>> <<if $activeChild.slaveSurname != $slaves[_i].slaveSurname>> - | <<link "Give $him $his wife's surname" "Rename Child">> + | <<link "Give $him $his wife's surname">> <<set $activeChild.slaveSurname = $slaves[_i].slaveSurname>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <<break>> <</if>> @@ -110,33 +139,43 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos <<if $activeChild.relationship == -3>> <<if $PC.slaveSurname>> <<if $activeChild.slaveSurname != $PC.slaveSurname>> - | <<link "Give $him your surname" "Rename Child">> + | <<link "Give $him your surname">> <<set $activeChild.slaveSurname = $PC.slaveSurname>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <</if>> <</if>> <</if>> <<if $arcologies[0].FSRomanRevivalist != "unset">> - | <<link "Give $him a random full Roman name" "Rename Child">> - <<set $activeChild.slaveName = setup.romanSlaveNames.random(), $activeChild.slaveSurname = setup.romanSlaveSurnames.random()>> + | <<link "Give $him a random full Roman name">> + <<set $activeChild.slaveName = setup.romanSlaveNames.random()>> + <<set $activeChild.slaveSurname = setup.romanSlaveSurnames.random()>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <<elseif $arcologies[0].FSAztecRevivalist != "unset">> - | <<link "Give $him a random full Aztec name" "Rename Child">> - <<set $activeChild.slaveName = setup.aztecSlaveNames.random(), $activeChild.slaveSurname = 0>> + | <<link "Give $him a random full Aztec name">> + <<set $activeChild.slaveName = setup.aztecSlaveNames.random()>> + <<set $activeChild.slaveSurname = 0>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <<elseif $arcologies[0].FSEgyptianRevivalist != "unset">> - | <<link "Give $him a random full ancient Egyptian name" "Rename Child">> - <<set $activeChild.slaveName = setup.ancientEgyptianSlaveNames.random(), $activeChild.slaveSurname = 0>> + | <<link "Give $him a random full ancient Egyptian name">> + <<set $activeChild.slaveName = setup.ancientEgyptianSlaveNames.random()>> + <<set $activeChild.slaveSurname = 0>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <<elseif $arcologies[0].FSEdoRevivalist != "unset">> - | <<link "Give $him a random full feudal Japanese name" "Rename Child">> - <<set $activeChild.slaveName = setup.edoSlaveNames.random(), $activeChild.slaveSurname = setup.edoSlaveSurnames.random()>> + | <<link "Give $him a random full feudal Japanese name">> + <<set $activeChild.slaveName = setup.edoSlaveNames.random()>> + <<set $activeChild.slaveSurname = setup.edoSlaveSurnames.random()>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> <</link>> <</if>> <<if $arcologies[0].FSDegradationist > -1>> - | <<link "Give $him a degrading full name" "Rename Child">> - <<run DegradingName($activeChild)>> - <</link>> + | <<link "Give $him a degrading full name">> + <<run DegradingName($activeChild)>> + <<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>> + <</link>> <</if>> <<else>> //You must break $his will further before you can successfully force a new name on $him.// diff --git a/src/facilities/nursery/customizeInfant.tw b/src/facilities/nursery/customizeInfant.tw index 6969f6b8aedc0cf7b049b779f3c582cbb31dd857..c4687bfe6128d2180f0281bb1080c60d895896df 100644 --- a/src/facilities/nursery/customizeInfant.tw +++ b/src/facilities/nursery/customizeInfant.tw @@ -1,7 +1,6 @@ :: Customize Infant [nobr] -<<set $nextButton = "Continue", $nextLink = "Rename Child">> -<<set $oldName = $activeChild.slaveName, $oldSurname = $activeChild.slaveSurname>> +<<set $nextButton = "Continue">> /* TODO: all of this */ You may enter custom descriptors for your child's hair color, hair style, tattoos, or anything else here. After typing, press enter to commit your change. These custom descriptors will appear in descriptions of your child, but will have no gameplay effect. Changing them is free. diff --git a/src/facilities/nursery/renameChild.tw b/src/facilities/nursery/renameChild.tw deleted file mode 100644 index f3536031727f4f4a8749dab19f4fe407e98a4454..0000000000000000000000000000000000000000 --- a/src/facilities/nursery/renameChild.tw +++ /dev/null @@ -1,142 +0,0 @@ -:: Rename Child [nobr] - -<<set $nextButton = "Back", $nextLink = "Slave Interact">> - -<<if $activeChild.slaveName === $oldName && $activeChild.slaveSurname === $oldSurname>> - <<goto "Slave Interact">> -<<else>> -/* First time renaming reaction */ -<<if $activeChild.slaveName === "" || ndef $activeChild.slaveName>> - $oldName needs to be called something on the records, so $oldName $he stays. - <<set $activeChild.slaveName = $oldName>> -<<elseif $activeChild.fetish == "mindbroken">> - $activeChild.slaveName doesn't even recognize that $he's been renamed. It simply does not register. -<<elseif ($oldName != $activeChild.birthName && $oldSurname != $activeChild.birthSurname) && ($activeChild.slaveName == $activeChild.birthName || $activeChild.slaveSurname == $activeChild.birthSurname)>> - $activeChild.slaveName - <<if $activeChild.devotion > 50>> - cheerfully accepts $his old name back. - <<elseif $activeChild.devotion >= -20>> - obediently accepts $his old name back. - <<elseif $activeChild.devotion >= -50>> - happily accepts $his original name. - <<elseif $activeChild.trust > 20>> - scoffs at the notion that $he was ever anything other than <<= SlaveFullBirthName($activeChild)>>, @@.orangered;weakening your control over $him.@@ - <<set $activeChild.trust += 5>> - <<else>> - cautiously accepts the return of $his name. - <</if>> -<<elseif $oldName == $activeChild.birthName || $oldSurname == $activeChild.birthSurname>> - $activeChild.slaveName - <<if $activeChild.devotion > 50>> - accepts $his new name cheerfully. This attachment to you @@.hotpink; increases $his devotion.@@ - <<set $activeChild.devotion += 4>> - <<elseif $activeChild.devotion >= -20>> - obediently accepts $his new name. This surrender to you @@.hotpink; increases $his obedience.@@ - <<set $activeChild.devotion += 4>> - <<elseif $activeChild.devotion >= -50>> - reluctantly accepts $his new name. - <<else>> - angrily tries to resist $his new name, insisting that $his name is <<= SlaveFullBirthName($activeChild)>>. This resistance @@.mediumorchid; increases $his rebelliousness.@@ - <<set $activeChild.devotion -= 5>> - <</if>> -<<else>> - Since $activeChild.slaveName has already had a new name <<if $activeChild.devotion > 20>>given to<<else>>forced on<</if>> $him before, the mere fact of having it changed again doesn't really affect $him. -<</if>> - -<<set _insultingName = 0>> -<<if $oldName != $activeChild.slaveName && typeof $activeChild.slaveName == "string">> - <<set _toSearch = $activeChild.slaveName.toLowerCase()>> - <<for $i = 0; $i < setup.badWords.length; $i++>> - <<if _toSearch.indexOf(setup.badWords[$i]) != -1>> - <<set _insultingName = 1>> - <<break>> - <</if>> - <</for>> -<</if>> -<<if !_insultingName>> - <<if $oldSurname != $activeChild.slaveSurname && typeof $activeChild.slaveSurname == "string">> - <<set _toSearch = $activeChild.slaveSurname.toLowerCase()>> - <<for $i = 0; $i < setup.badWords.length; $i++>> - <<if _toSearch.indexOf(setup.badWords[$i]) != -1>> - <<set _insultingName = 1>> - <<break>> - <</if>> - <</for>> - <</if>> -<</if>> -<<if _insultingName == 1>> - <<if $activeChild.fetish == "mindbroken">> - $His new name would be insulting to a normal $girl, but $he dully accepts that it is an accurate description and goes about $his duties. - <<elseif $activeChild.devotion < -50>> - Being given such a degrading name @@.mediumorchid;further increases $his hatred@@ of you. - <<set $activeChild.devotion -= 5>> - <<elseif $activeChild.devotion <= 50>> - Being given such a degrading name @@.gold;terrifies $him,@@ since $he thinks it's fair warning for what $he'll suffer in the future. - <<set $activeChild.trust -= 5>> - <</if>> -<</if>> - -/* Wife's surname reaction */ -<<if $oldSurname != $activeChild.slaveSurname>> - <<if $activeChild.relationship >= 5>> - <<set _i = $slaveIndices[$activeChild.relationshipTarget]>> - <<if ndef _i>>@@.red;Error, relationshipTarget not found.@@<</if>> - <<if $slaves[_i].slaveSurname>> - <<if $activeChild.slaveSurname == $slaves[_i].slaveSurname>> - $He's touched that $he now shares a surname with $his wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.mediumaquamarine;more confident than ever@@ that you intend to keep them together in marital bliss. - <<set $activeChild.trust += 5>> - <<elseif $oldSurname == $slaves[_i].slaveSurname>> - $He's concerned that $he no longer shares a surname with $his wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.gold;very worried@@ that you might be considering splitting them up. - <<set $activeChild.trust -= 5>> - <</if>> - <</if>> - <</if>> -<</if>> - -/* PC's surname reaction */ -<<if $oldSurname != $activeChild.slaveSurname>> - <<if $activeChild.relationship == -3>> - <<if $PC.slaveSurname>> - <<if $activeChild.fetish == "mindbroken">> - Names are meaningless to $him and it is unlikely $he'll remember it. - <<elseif $activeChild.devotion+$activeChild.trust >= 175>> - <<if $activeChild.slaveSurname == $PC.slaveSurname>> - <<if hasAnyArms($activeChild)>> - When you tell $him that $he's to be known as $activeChild.slaveName $activeChild.slaveSurname now, $he starts to cry. $He tries to get $himself under control and thank you as best $he can, wiping at the tears running down $his $activeChild.skin cheeks, but $he can't seem to stop weeping as $he thanks you over and over. $He's a sex slave, your property, and it's understandable that some doubts about the permanence of $his place as your slave wife. This has @@.mediumaquamarine;helped reassure $him,@@ and explains the strength of $his emotional reaction. The next time you make love to $him, $he @@.hotpink;presses $himself as close to you as $he can,@@ eager to drink in as much of your presence as $he can get. - <<else>> - $He's @@.hotpink;deeply touched@@ that $he now shares a surname with you, and has @@.mediumaquamarine;an additional source of confidence@@ that $he'll remain your amputee slave wife. - <</if>> - <<set $activeChild.devotion += 5, $activeChild.trust += 5>> - <<elseif $oldSurname == $PC.slaveSurname>> - $He's devastated that you'd rename $him something other than your name. $He's @@.gold;terrified@@ that you intend to discard $him as your slave wife, and @@.mediumorchid;saddened@@ that you would take away something that was precious to $him. - <<set $activeChild.devotion -= 5, $activeChild.trust -= 5>> - <</if>> - <<elseif $activeChild.devotion < -20 && $activeChild.trust > 20>> - <<if $activeChild.slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as $activeChild.slaveName $activeChild.slaveSurname now, $he shows no reaction. You already took everything from $him, what's a name at this point? - <<elseif $oldSurname == $PC.slaveSurname>> - $He doesn't care about losing your surname at first, but it quickly sets in that $he may have @@.gold;pushed $his position too far.@@ - <<set $activeChild.trust -= 20>> - <</if>> - <<elseif $activeChild.devotion < -20>> - <<if $activeChild.slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as $activeChild.slaveName $activeChild.slaveSurname now, $he pleads with you not to steal $his name. It matters little to you, and $he is forced to @@.hotpink;accept your will.@@ - <<set $activeChild.devotion += 5>> - <<elseif $oldSurname == $PC.slaveSurname>> - $He's @@.mediumorchid;happy@@ to no longer have to share a name with $his tormentor, but the bliss doesn't last long as @@.gold;dread@@ quickly sets in about what this may mean. - <<set $activeChild.devotion += 5, $activeChild.trust -= 10>> - <</if>> - <<else>> - <<if $activeChild.slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as $activeChild.slaveName $activeChild.slaveSurname now, $he nods with approval feeling @@.mediumaquamarine;that $he may hold at least some value in your eyes.@@ - <<set $activeChild.trust += 5>> - <<elseif $oldSurname == $PC.slaveSurname>> - $He accepts that you'd rename $him something other than your name. $He's @@.gold;a little scared@@ that you intend to discard $him as your slave wife, or worse, but realizes this was not only a possibility, but likely. - <<set $activeChild.trust -= 5>> - <</if>> - <</if>> - <</if>> - <</if>> -<</if>> - -<</if>> /* close new name check */ diff --git a/src/interaction/rename.js b/src/interaction/rename.js new file mode 100644 index 0000000000000000000000000000000000000000..6ab4159094f9abf46a2b9b1626eb4897e71e27be --- /dev/null +++ b/src/interaction/rename.js @@ -0,0 +1,152 @@ +/** + * @param {App.Entity.SlaveState} slave + * @param {*} params + * @param {string} [params.oldName] Their name before you renamed them by calling this function + * @param {string} [params.oldSurname] Their surname before you renamed them by calling this function + */ +App.UI.SlaveInteract.rename = function(slave, {oldName = "", oldSurname = ""} = {}) { + const r = []; + const {He, he, His, his, him, girl} = getPronouns(slave); + if (slave.slaveName === oldName && slave.slaveSurname === oldSurname) { + return; + } else { + /* First time renaming reaction */ + if (slave.slaveName === "" || !(slave.hasOwnProperty("slaveName"))) { + r.push(`${oldName} needs to be called something on the records, so ${oldName} ${he} stays.`); + slave.slaveName = oldName; + } else if (slave.fetish === "mindbroken") { + r.push(`${slave.slaveName} doesn't even recognize that ${he}'s been renamed. It simply does not register.`); + } else if ((oldName !== slave.birthName && slave.slaveName === slave.birthName) || (oldSurname !== slave.birthSurname && slave.slaveSurname === slave.birthSurname)) { + r.push(`${slave.slaveName}`); + if (slave.devotion > 50) { + r.push(`cheerfully accepts ${his} old name back.`); + } else if (slave.devotion >= -20) { + r.push(`obediently accepts ${his} old name back.`); + } else if (slave.devotion >= -50) { + r.push(`happily accepts ${his} original name.`); + } else if (slave.trust > 20) { + r.push(`scoffs at the notion that ${he} was ever anything other than ${SlaveFullBirthName(slave)}, <span class="orangered">weakening your control over ${him}.</span>`); + slave.trust += 5; + } else { + r.push(`cautiously accepts the return of ${his} name.`); + } + } else if ((oldName === slave.birthName && slave.slaveName !== slave.birthName) || (oldSurname === slave.birthSurname && slave.slaveSurname !== slave.birthSurname)) { + r.push(`${slave.slaveName}`); + if (slave.devotion > 50) { + r.push(`accepts ${his} new name cheerfully. This attachment to you <span class="devotion inc"> increases ${his} devotion.</span>`); + slave.devotion += 4; + } else if (slave.devotion >= -20) { + r.push(`obediently accepts ${his} new name. This surrender to you <span class="devotion inc"> increases ${his} obedience.</span>`); + slave.devotion += 4; + } else if (slave.devotion >= -50) { + r.push(`reluctantly accepts ${his} new name.`); + } else { + r.push(`angrily tries to resist ${his} new name, insisting that ${his} name is ${SlaveFullBirthName(slave)}. This resistance <span class="devotion dec"> increases ${his} rebelliousness.</span>`); + slave.devotion -= 5; + } + } else { + r.push(`Since ${slave.slaveName} has already had a new name`); + if (slave.devotion > 20) { + r.push(`given to`); + } else { + r.push(`forced on`); + } + r.push(`${him} before, the mere fact of having it changed again doesn't really affect ${him}.`); + } + + let insultingName = false; + let toSearch; + if (oldName !== slave.slaveName && typeof slave.slaveName === "string") { + toSearch = slave.slaveName.toLowerCase(); + insultingName = setup.badWords.some((s) => toSearch.includes(s)); + } + if (!insultingName) { + if (oldSurname !== slave.slaveSurname && typeof slave.slaveSurname === "string") { + toSearch = slave.slaveSurname.toLowerCase(); + insultingName = setup.badWords.some((s) => toSearch.includes(s)); + } + } + if (insultingName) { + if (slave.fetish === "mindbroken") { + r.push(`${His} new name would be insulting to a normal ${girl}, but ${he} dully accepts that it is an accurate description and goes about ${his} duties.`); + } else if (slave.devotion < -50) { + r.push(`Being given such a degrading name <span class="devotion dec">further increases ${his} hatred</span> of you.`); + slave.devotion -= 5; + } else if (slave.devotion <= 50) { + r.push(`Being given such a degrading name <span class="trust dec">terrifies ${him},</span> since ${he} thinks it's fair warning for what ${he}'ll suffer in the future.`); + slave.trust -= 5; + } + } + + /* Wife's surname reaction */ + if (oldSurname !== slave.slaveSurname) { + if (slave.relationship >= 5) { + const slaveWife = getSlave(slave.relationshipTarget); + if (!slaveWife) { + r.push(`<span class="red">Error, relationshipTarget not found.</span>`); + } else { + if (slaveWife.slaveSurname) { + const {wife2} = getPronouns(slaveWife).appendSuffix('2'); + if (slave.slaveSurname === slaveWife.slaveSurname) { + r.push(`${He}'s touched that ${he} now shares a surname with ${his} ${wife2} ${slaveWife.slaveName} ${slaveWife.slaveSurname}, and is <span class="trust inc">more confident than ever</span> that you intend to keep them together in marital bliss.`); + slave.trust += 5; + } else if (oldSurname === slaveWife.slaveSurname) { + r.push(`${He}'s concerned that ${he} no longer shares a surname with ${his} ${wife2} ${slaveWife.slaveName} ${slaveWife.slaveSurname}, and is <span class="trust dec">very worried</span> that you might be considering splitting them up.`); + slave.trust -= 5; + } + } + } + } + } + + /* PC's surname reaction */ + if (oldSurname !== slave.slaveSurname) { + if (slave.relationship === -3) { + if (V.PC.slaveSurname) { + if (slave.fetish === "mindbroken") { + r.push(`Names are meaningless to ${him} and it is unlikely ${he}'ll remember it.`); + } else if (slave.devotion + slave.trust >= 175) { + if (slave.slaveSurname === V.PC.slaveSurname) { + r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} ${slave.slaveSurname} now, ${he} starts to cry. ${He} tries to get ${himself} under control and thank you as best ${he} can,`); + if (hasAnyArms(slave)) { + r.push(`wiping at the tears running down ${his} ${slave.skin} cheeks,`); + } + r.push(`but ${he} can't seem to stop weeping as ${he} thanks you over and over. ${He}'s a sex slave, your property, and it's understandable that some doubts about the permanence of ${his} place as your slave ${wife}. This has <span class="trust inc">helped reassure ${him},</span> and explains the strength of ${his} emotional reaction. The next time you make love to ${him}, ${he} <span class="devotion inc">presses ${himself} as close to you as ${he} can,</span> eager to drink in as much of your presence as ${he} can get.`); + slave.devotion += 5; + slave.trust += 5; + } else if (oldSurname === V.PC.slaveSurname) { + r.push(`${He}'s devastated that you'd rename ${him} something other than your name. ${He}'s <span class="trust dec">terrified</span> that you intend to discard ${him} as your slave ${V.wife}, and <span class="devotion dec">saddened</span> that you would take away something that was precious to ${him}.`); + slave.devotion -= 5; + slave.trust -= 5; + } + } else if (slave.devotion < -20 && slave.trust > 20) { + if (slave.slaveSurname === V.PC.slaveSurname) { + r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} ${slave.slaveSurname} now, ${he} shows no reaction. You already took everything from ${him}, what's a name at this point?`); + } else if (oldSurname === V.PC.slaveSurname) { + r.push(`${He} doesn't care about losing your surname at first, but it quickly sets in that ${he} may have <span class="trust dec">pushed ${his} position too far.</span>`); + slave.trust -= 20; + } + } else if (slave.devotion < -20) { + if (slave.slaveSurname === V.PC.slaveSurname) { + r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} ${slave.slaveSurname} now, ${he} pleads with you not to steal ${his} name. It matters little to you, and ${he} is forced to <span class="devotion inc">accept your will.</span>`); + slave.devotion += 5; + } else if (oldSurname === V.PC.slaveSurname) { + r.push(`${He}'s <span class="devotion dec">happy</span> to no longer have to share a name with ${his} tormentor, but the bliss doesn't last long as <span class="trust dec">dread</span> quickly sets in about what this may mean.`); + slave.devotion += 5; + slave.trust -= 10; + } + } else { + if (slave.slaveSurname === V.PC.slaveSurname) { + r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} ${slave.slaveSurname} now, ${he} nods with approval feeling <span class="trust inc">that ${he} may hold at least some value in your eyes.</span>`); + slave.trust += 5; + } else if (oldSurname === V.PC.slaveSurname) { + r.push(`${He} accepts that you'd rename ${him} something other than your name. ${He}'s <span class="trust dec">a little scared</span> that you intend to discard ${him} as your slave ${V.wife}, or worse, but realizes this was not only a possibility, but likely.`); + slave.trust -= 5; + } + } + } + } + } + } + return jQuery("#rename").empty().append(r.join(" ")); +}; diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js index 71cbccd05a848523b39eb7ce8bea823696ffa6df..8d7ed15a39a17e516150009abfaace5c0aa81970 100644 --- a/src/interaction/slaveInteract.js +++ b/src/interaction/slaveInteract.js @@ -2486,14 +2486,19 @@ App.UI.SlaveInteract.custom = (function() { } function intro(slave) { - V.oldName = slave.slaveName; - V.oldSurname = slave.slaveSurname; - let intro = document.createElement('p'); - intro.className = "scene-intro"; - intro.append(`You may enter custom descriptors for your slave's hair color, hair style, tattoos, or anything else here. After typing, press `); - intro.appendChild(App.UI.DOM.makeElement("kbd", "enter")); - intro.append(` to commit your change. These custom descriptors will appear in descriptions of your slave, but will have no gameplay effect. Changing them is free.`); - return intro; + const frag = new DocumentFragment(); + let p; + p = document.createElement('p'); + p.id = "rename"; + frag.append(p); + + p = document.createElement('p'); + p.className = "scene-p"; + p.append(`You may enter custom descriptors for your slave's hair color, hair style, tattoos, or anything else here. After typing, press `); + p.appendChild(App.UI.DOM.makeElement("kbd", "enter")); + p.append(` to commit your change. These custom descriptors will appear in descriptions of your slave, but will have no gameplay effect. Changing them is free.`); + frag.append(p); + return frag; } function playerTitle(slave) { @@ -2612,6 +2617,8 @@ App.UI.SlaveInteract.custom = (function() { return slaveFullNameNode; function slaveName() { + const oldName = slave.slaveName; + const oldSurname = slave.slaveSurname; // Slave Name let slaveNameNode = document.createElement('p'); label = document.createElement('div'); @@ -2629,9 +2636,10 @@ App.UI.SlaveInteract.custom = (function() { slave.slaveName, v => { slave.slaveName = v; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename"); + ); label.appendChild(textbox); slaveNameNode.appendChild(label); @@ -2640,9 +2648,9 @@ App.UI.SlaveInteract.custom = (function() { ` Restore ${his} birth name`, () => { slave.slaveName = slave.birthName; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); if (V.arcologies[0].FSPastoralist !== "unset") { @@ -2652,9 +2660,9 @@ App.UI.SlaveInteract.custom = (function() { `Give ${him} a random cow given name`, () => { slave.slaveName = setup.cowSlaveNames.random(); + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } } @@ -2665,9 +2673,9 @@ App.UI.SlaveInteract.custom = (function() { `Give ${him} a random stipper given name`, () => { slave.slaveName = setup.bimboSlaveNames.random(); + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } } @@ -2677,9 +2685,9 @@ App.UI.SlaveInteract.custom = (function() { `Give ${him} a random devotional given name`, () => { slave.slaveName = setup.chattelReligionistSlaveNames.random(); + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } slaveNameNode.appendChild(result); @@ -2688,6 +2696,8 @@ App.UI.SlaveInteract.custom = (function() { function slaveSurname() { // Slave Surname + const oldName = slave.slaveName; + const oldSurname = slave.slaveSurname; let slaveSurnameNode = document.createElement('p'); label = document.createElement('div'); result = document.createElement('div'); @@ -2704,9 +2714,9 @@ App.UI.SlaveInteract.custom = (function() { slave.slaveSurname, v => { slave.slaveSurname = textbox.value; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" ); label.appendChild(textbox); @@ -2716,9 +2726,9 @@ App.UI.SlaveInteract.custom = (function() { ` Restore ${his} birth surname`, () => { slave.slaveSurname = slave.birthSurname; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); if (slave.slaveSurname) { @@ -2727,9 +2737,9 @@ App.UI.SlaveInteract.custom = (function() { `Take ${his} surname away`, () => { slave.slaveSurname = 0; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } if (slave.relationship >= 5) { @@ -2743,9 +2753,9 @@ App.UI.SlaveInteract.custom = (function() { `Give ${him} ${his} ${wifePronouns.wife}'s surname`, () => { slave.slaveSurname = V.slaves[_i].slaveSurname; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); break; } @@ -2761,9 +2771,9 @@ App.UI.SlaveInteract.custom = (function() { `Give ${him} your surname`, () => { slave.slaveSurname = V.PC.slaveSurname; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } } @@ -2775,9 +2785,9 @@ App.UI.SlaveInteract.custom = (function() { () => { slave.slaveName = setup.romanSlaveNames.random(); slave.slaveSurname = setup.romanSlaveSurnames.random(); + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } else if (V.arcologies[0].FSAztecRevivalist !== "unset") { result.append(` | `); @@ -2786,9 +2796,9 @@ App.UI.SlaveInteract.custom = (function() { () => { slave.slaveName = setup.aztecSlaveNames.random(); slave.slaveSurname = 0; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } else if (V.arcologies[0].FSEgyptianRevivalist !== "unset") { result.append(` | `); @@ -2797,9 +2807,9 @@ App.UI.SlaveInteract.custom = (function() { () => { slave.slaveName = setup.ancientEgyptianSlaveNames.random(); slave.slaveSurname = 0; + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } else if (V.arcologies[0].FSEdoRevivalist !== "unset") { result.append(` | `); @@ -2808,9 +2818,9 @@ App.UI.SlaveInteract.custom = (function() { () => { slave.slaveName = setup.edoSlaveNames.random(); slave.slaveSurname = setup.edoSlaveSurnames.random(); + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } if (V.arcologies[0].FSDegradationist > -1) { @@ -2819,14 +2829,18 @@ App.UI.SlaveInteract.custom = (function() { `Give ${him} a degrading full name`, () => { DegradingName(slave); + updateName(slave, {oldName:oldName, oldSurname:oldSurname}); }, false, - "Rename" )); } slaveSurnameNode.appendChild(result); return slaveSurnameNode; } + function updateName(slave, {oldName:oldName, oldSurname:oldSurname}) { + App.UI.SlaveInteract.custom(slave); + App.UI.SlaveInteract.rename(slave, {oldName:oldName, oldSurname:oldSurname}); + } } function hair(slave) { diff --git a/src/npc/interaction/rename.tw b/src/npc/interaction/rename.tw deleted file mode 100644 index f6a7679c4d8216239c2f5cb1d2c272a11c20923c..0000000000000000000000000000000000000000 --- a/src/npc/interaction/rename.tw +++ /dev/null @@ -1,140 +0,0 @@ -:: Rename [nobr] - -<<set $nextButton = "Back", $nextLink = "Slave Interact">> -<<set $AS = $activeSlave.ID>> - -<<if getSlave($AS).slaveName === $oldName && getSlave($AS).slaveSurname === $oldSurname>> - <<goto "Slave Interact">> -<<else>> -/* First time renaming reaction */ -<<if getSlave($AS).slaveName === "" || ndef getSlave($AS).slaveName>> - $oldName needs to be called something on the records, so $oldName $he stays. - <<set getSlave($AS).slaveName = $oldName>> -<<elseif getSlave($AS).fetish == "mindbroken">> - <<= getSlave($AS).slaveName>> doesn't even recognize that $he's been renamed. It simply does not register. -<<elseif ($oldName != getSlave($AS).birthName && getSlave($AS).slaveName == getSlave($AS).birthName) || ($oldSurname != getSlave($AS).birthSurname && getSlave($AS).slaveSurname == getSlave($AS).birthSurname)>> - <<= getSlave($AS).slaveName>> - <<if getSlave($AS).devotion > 50>> - cheerfully accepts $his old name back. - <<elseif getSlave($AS).devotion >= -20>> - obediently accepts $his old name back. - <<elseif getSlave($AS).devotion >= -50>> - happily accepts $his original name. - <<elseif getSlave($AS).trust > 20>> - scoffs at the notion that $he was ever anything other than <<= SlaveFullBirthName(getSlave($AS))>>, @@.orangered;weakening your control over $him.@@ - <<set getSlave($AS).trust += 5>> - <<else>> - cautiously accepts the return of $his name. - <</if>> -<<elseif ($oldName == getSlave($AS).birthName && getSlave($AS).slaveName != getSlave($AS).birthName) || ($oldSurname == getSlave($AS).birthSurname && getSlave($AS).slaveSurname != getSlave($AS).birthSurname)>> - <<= getSlave($AS).slaveName>> - <<if getSlave($AS).devotion > 50>> - accepts $his new name cheerfully. This attachment to you @@.hotpink; increases $his devotion.@@ - <<set getSlave($AS).devotion += 4>> - <<elseif getSlave($AS).devotion >= -20>> - obediently accepts $his new name. This surrender to you @@.hotpink; increases $his obedience.@@ - <<set getSlave($AS).devotion += 4>> - <<elseif getSlave($AS).devotion >= -50>> - reluctantly accepts $his new name. - <<else>> - angrily tries to resist $his new name, insisting that $his name is <<= SlaveFullBirthName(getSlave($AS))>>. This resistance @@.mediumorchid; increases $his rebelliousness.@@ - <<set getSlave($AS).devotion -= 5>> - <</if>> -<<else>> - Since <<= getSlave($AS).slaveName>> has already had a new name <<if getSlave($AS).devotion > 20>>given to<<else>>forced on<</if>> $him before, the mere fact of having it changed again doesn't really affect $him. -<</if>> - -<<set _insultingName = 0>> -<<if $oldName != getSlave($AS).slaveName && typeof getSlave($AS).slaveName == "string">> - <<set _toSearch = getSlave($AS).slaveName.toLowerCase()>> - <<for $i = 0; $i < setup.badWords.length; $i++>> - <<if _toSearch.indexOf(setup.badWords[$i]) != -1>> - <<set _insultingName = 1>> - <<break>> - <</if>> - <</for>> -<</if>> -<<if !_insultingName>> - <<if $oldSurname != getSlave($AS).slaveSurname && typeof getSlave($AS).slaveSurname == "string">> - <<set _toSearch = getSlave($AS).slaveSurname.toLowerCase()>> - <<for $i = 0; $i < setup.badWords.length; $i++>> - <<if _toSearch.indexOf(setup.badWords[$i]) != -1>> - <<set _insultingName = 1>> - <<break>> - <</if>> - <</for>> - <</if>> -<</if>> -<<if _insultingName == 1>> - <<if getSlave($AS).fetish == "mindbroken">> - $His new name would be insulting to a normal $girl, but $he dully accepts that it is an accurate description and goes about $his duties. - <<elseif getSlave($AS).devotion < -50>> - Being given such a degrading name @@.mediumorchid;further increases $his hatred@@ of you. - <<set getSlave($AS).devotion -= 5>> - <<elseif getSlave($AS).devotion <= 50>> - Being given such a degrading name @@.gold;terrifies $him,@@ since $he thinks it's fair warning for what $he'll suffer in the future. - <<set getSlave($AS).trust -= 5>> - <</if>> -<</if>> - -/* Wife's surname reaction */ -<<if $oldSurname != getSlave($AS).slaveSurname>> - <<if getSlave($AS).relationship >= 5>> - <<set _i = $slaveIndices[getSlave($AS).relationshipTarget]>> - <<if ndef _i>>@@.red;Error, relationshipTarget not found.@@<</if>> - <<if $slaves[_i].slaveSurname>> - <<setLocalPronouns $slaves[_i] 2>> - <<if getSlave($AS).slaveSurname == $slaves[_i].slaveSurname>> - $He's touched that $he now shares a surname with $his _wife2 $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.mediumaquamarine;more confident than ever@@ that you intend to keep them together in marital bliss. - <<set getSlave($AS).trust += 5>> - <<elseif $oldSurname == $slaves[_i].slaveSurname>> - $He's concerned that $he no longer shares a surname with $his _wife2 $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.gold;very worried@@ that you might be considering splitting them up. - <<set getSlave($AS).trust -= 5>> - <</if>> - <</if>> - <</if>> -<</if>> - -/* PC's surname reaction */ -<<if $oldSurname != getSlave($AS).slaveSurname>> - <<if getSlave($AS).relationship == -3>> - <<if $PC.slaveSurname>> - <<if getSlave($AS).fetish == "mindbroken">> - Names are meaningless to $him and it is unlikely $he'll remember it. - <<elseif getSlave($AS).devotion+getSlave($AS).trust >= 175>> - <<if getSlave($AS).slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as <<= getSlave($AS).slaveName>> <<= getSlave($AS).slaveSurname>> now, $he starts to cry. $He tries to get $himself under control and thank you as best $he can, <<if hasAnyArms(getSlave($AS))>>wiping at the tears running down $his <<= getSlave($AS).skin>> cheeks, <</if>>but $he can't seem to stop weeping as $he thanks you over and over. $He's a sex slave, your property, and it's understandable that some doubts about the permanence of $his place as your slave $wife. This has @@.mediumaquamarine;helped reassure $him,@@ and explains the strength of $his emotional reaction. The next time you make love to $him, $he @@.hotpink;presses $himself as close to you as $he can,@@ eager to drink in as much of your presence as $he can get. - <<set getSlave($AS).devotion += 5, getSlave($AS).trust += 5>> - <<elseif $oldSurname == $PC.slaveSurname>> - $He's devastated that you'd rename $him something other than your name. $He's @@.gold;terrified@@ that you intend to discard $him as your slave $wife, and @@.mediumorchid;saddened@@ that you would take away something that was precious to $him. - <<set getSlave($AS).devotion -= 5, getSlave($AS).trust -= 5>> - <</if>> - <<elseif getSlave($AS).devotion < -20 && getSlave($AS).trust > 20>> - <<if getSlave($AS).slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as <<= getSlave($AS).slaveName>> <<= getSlave($AS).slaveSurname>> now, $he shows no reaction. You already took everything from $him, what's a name at this point? - <<elseif $oldSurname == $PC.slaveSurname>> - $He doesn't care about losing your surname at first, but it quickly sets in that $he may have @@.gold;pushed $his position too far.@@ - <<set getSlave($AS).trust -= 20>> - <</if>> - <<elseif getSlave($AS).devotion < -20>> - <<if getSlave($AS).slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as <<= getSlave($AS).slaveName>> <<= getSlave($AS).slaveSurname>> now, $he pleads with you not to steal $his name. It matters little to you, and $he is forced to @@.hotpink;accept your will.@@ - <<set getSlave($AS).devotion += 5>> - <<elseif $oldSurname == $PC.slaveSurname>> - $He's @@.mediumorchid;happy@@ to no longer have to share a name with $his tormentor, but the bliss doesn't last long as @@.gold;dread@@ quickly sets in about what this may mean. - <<set getSlave($AS).devotion += 5, getSlave($AS).trust -= 10>> - <</if>> - <<else>> - <<if getSlave($AS).slaveSurname == $PC.slaveSurname>> - When you tell $him that $he's to be known as <<= getSlave($AS).slaveName>> <<= getSlave($AS).slaveSurname>> now, $he nods with approval feeling @@.mediumaquamarine;that $he may hold at least some value in your eyes.@@ - <<set getSlave($AS).trust += 5>> - <<elseif $oldSurname == $PC.slaveSurname>> - $He accepts that you'd rename $him something other than your name. $He's @@.gold;a little scared@@ that you intend to discard $him as your slave $wife, or worse, but realizes this was not only a possibility, but likely. - <<set getSlave($AS).trust -= 5>> - <</if>> - <</if>> - <</if>> - <</if>> -<</if>> - -<</if>> /* close new name check */ diff --git a/src/uncategorized/nextWeek.tw b/src/uncategorized/nextWeek.tw index 25f8249827c013185df19ac7747724b752bc9624..262c4c606437daec3162e5aa103526bf9be78fbc 100644 --- a/src/uncategorized/nextWeek.tw +++ b/src/uncategorized/nextWeek.tw @@ -348,7 +348,7 @@ <<set $beforeGingering = null>> /% Strings Memory varies. %/ -<<set $buyer = "", $desc = "", $event = "", $goto = "", $malefactor = "", $oldName = "", $oldSurname = "">> +<<set $buyer = "", $desc = "", $event = "", $goto = "", $malefactor = "">> /% Done with zeroing out, what should be for the most part Temps %/ <<if $autosave != 0>>