:: 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 */

src/npc/interaction/rename.tw