diff --git a/src/npc/descriptions/relationRival.js b/src/npc/descriptions/relationRival.js new file mode 100644 index 0000000000000000000000000000000000000000..68650051dd28a3ea874131233ae4f977416fff9c --- /dev/null +++ b/src/npc/descriptions/relationRival.js @@ -0,0 +1,45 @@ +/** + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ +App.Desc.relationRival = function(slave) { + const r = []; + const { + his, He + } = getPronouns(slave); + + r.push(relative()); + r.push(rival()); + + return r.join(" "); + + function relative() { + if (slave.relationship >= 3 && totalRelatives(slave) > 0) { + const lover = getSlave(slave.relationshipTarget); + if (lover) { + if (relativeTerm(slave, lover) !== null) { + return `${He} is in an <span class="lightgreen">incestuous relationship with ${his} ${relativeTerm(slave, lover)}, ${SlaveFullName(lover)}.</span>`; + } + } + } else if (slave.relationship <= -2) { + if (relativeTerm(slave, V.PC) !== null) { + return `${He} is in an <span class="lightgreen">incestuous relationship with ${his} ${relativeTerm(slave, V.PC)}, you.</span>`; + } + } + } + + function rival() { + if (slave.rivalry !== 0) { + if (getSlave(slave.rivalryTarget)) { + if (slave.rivalry <= 1) { + return `${He} <span class="lightsalmon">dislikes</span> ${SlaveFullName(getSlave(slave.rivalryTarget))}.`; + } else if (slave.rivalry <= 2) { + return `${He} is ${SlaveFullName(getSlave(slave.rivalryTarget))}'s <span class="lightsalmon">rival.</span>`; + } else { + return `${He} <span class="lightsalmon">bitterly hates</span> ${SlaveFullName(getSlave(slave.rivalryTarget))}.`; + } + } + } + } +}; + diff --git a/src/uncategorized/longSlaveDescription.tw b/src/uncategorized/longSlaveDescription.tw index 0ee34090e0e9d3acecc2b6232172c1d028ada3ee..2e1af53f95acce882955223d79e3d52f8da63262 100644 --- a/src/uncategorized/longSlaveDescription.tw +++ b/src/uncategorized/longSlaveDescription.tw @@ -126,34 +126,7 @@ is <<= App.Desc.family($activeSlave)>> -<<if $activeSlave.relationship >= 3 && totalRelatives($activeSlave) > 0>> - <<set _lover = getSlave($activeSlave.relationshipTarget)>> - <<if def _lover>> - <<set _relTerm = relativeTerm($activeSlave, _lover)>> - <<if _relTerm !== null>> - $He is in an <span class="lightgreen">incestuous relationship with $his _relTerm, <<= SlaveFullName(_lover)>>.</span> - <</if>> - <</if>> -<<elseif $activeSlave.relationship <= -2>> - <<set _relTerm = relativeTerm($activeSlave, $PC)>> - <<if _relTerm !== null>> - $He is in an <span class="lightgreen">incestuous relationship with $his _relTerm, you.</span> - <</if>> -<</if>> - -<<if $activeSlave.rivalry != 0>> - <<set _lsd = $slaveIndices[$activeSlave.rivalryTarget]>> - <<if def _lsd>> - $He - <<if $activeSlave.rivalry <= 1>> - <span class="lightsalmon">dislikes</span> <<= SlaveFullName($slaves[_lsd])>>. - <<elseif $activeSlave.rivalry <= 2>> - is <<= SlaveFullName($slaves[_lsd])>>'s <span class="lightsalmon">rival.</span> - <<else>> - <span class="lightsalmon">bitterly hates</span> <<= SlaveFullName($slaves[_lsd])>>. - <</if>> - <</if>> -<</if>> +<<= App.Desc.relationRival($activeSlave)>> <<if $activeSlave.bodySwap > 0>> <<if $activeSlave.origBodyOwner !== "">>