diff --git a/src/interaction/rename.js b/src/interaction/rename.js index faaa4a952f15040d07a07d381ef052d038bc8024..280e830d518ca8c551058291d4e726723fc42412 100644 --- a/src/interaction/rename.js +++ b/src/interaction/rename.js @@ -90,18 +90,19 @@ App.UI.SlaveInteract.rename = function(slave, {oldName = "", oldSurname = ""} = /* Wife's surname reaction */ if (oldSurname !== slave.slaveSurname) { if (slave.relationship >= 5) { - let _i = V.slaveIndices[slave.relationshipTarget]; - if (!_i) { + const slaveWife = getSlave(slave.relationshipTarget); + if (!slaveWife) { r.push(`<span class="red">Error, relationshipTarget not found.</span>`); - } - if (V.slaves[_i].slaveSurname) { - const {wife2} = getPronouns(V.slaves[_i]).appendSuffix('2'); - if (slave.slaveSurname === V.slaves[_i].slaveSurname) { - r.push(`${He}'s touched that ${he} now shares a surname with ${his} ${wife2} ${V.slaves[_i].slaveName} ${V.slaves[_i].slaveSurname}, and is <span class="mediumaquamarine">more confident than ever</span> that you intend to keep them together in marital bliss.`); - slave.trust += 5; - } else if (oldSurname === V.slaves[_i].slaveSurname) { - r.push(`${He}'s concerned that ${he} no longer shares a surname with ${his} ${wife2} ${V.slaves[_i].slaveName} ${V.slaves[_i].slaveSurname}, and is <span class="gold">very worried</span> that you might be considering splitting them up.`); - slave.trust -= 5; + } 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="mediumaquamarine">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="gold">very worried</span> that you might be considering splitting them up.`); + slave.trust -= 5; + } } } }