diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js index e31285558d9cf46a3a70d665176be0b36e6a2663..6ccd07c9d1d0ec4b9fb7a26b3ad5a56417ee1070 100644 --- a/src/interaction/slaveInteract.js +++ b/src/interaction/slaveInteract.js @@ -2176,24 +2176,24 @@ App.UI.SlaveInteract.rules = function(slave) { // Living if (slave.fuckdoll > 0) { - // Rules have little meaning for living sex toys// + App.UI.DOM.appendNewElement("span", p, "Rules have little meaning for living sex toys", "note"); } else { penthouseCensus(); p.append("Living standard: "); App.UI.DOM.appendNewElement("span", p, slave.rules.living, "bold"); } if (setup.facilityCareers.includes(slave.assignment)) { - // ${His} living conditions are managed by ${his} assignment.// + App.UI.DOM.appendNewElement("span", p, ` ${His} living conditions are managed by ${his} assignment.`, "note"); } else if ((slave.assignment === "be your Head Girl") && (V.HGSuite === 1)) { - // ${He} has ${his} own little luxurious room in the penthouse with everything ${he} needs to be a proper Head Girl.// + App.UI.DOM.appendNewElement("span", p, ` ${He} has ${his} own little luxurious room in the penthouse with everything ${he} needs to be a proper Head Girl.`, "note"); } else if ((slave.assignment === "guard you") && (V.dojo > 1)) { - // ${He} has a comfortable room in the armory to call ${his} own.// + App.UI.DOM.appendNewElement("span", p, ` ${He} has a comfortable room in the armory to call ${his} own.`, "note"); } else { choices = [ {value: "spare"}, {value: "normal"}, ]; - if (V.roomsPopulation <= V.rooms - 0.5) { + if (canMoveToRoom(slave) || slave.rules.living === "luxurious") { choices.push({value: "luxurious"}); } else { choices.push({ diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 8992d75d5edc8fc856401db684e6a3f7fb9f9b26..5a257141d1563c6939e5d73b1cffd3f07b9734b5 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -1847,14 +1847,9 @@ globalThis.DefaultRules = (function() { } } else if (slave.rules.living !== rule.livingRules) { if (rule.livingRules !== "luxurious") { - if (V.roomsPopulation <= V.rooms - 0.5) { + if (canMoveToRoom(slave)) { slave.rules.living = rule.livingRules; r += `<br>${slave.slaveName}'s living standard has been set to ${rule.livingRules}.`; - if (slave.relationship >= 4) { - V.roomsPopulation += 0.5; - } else { - V.roomsPopulation += 1; - } } else { slave.rules.living = "normal"; r += `<br>${slave.slaveName}'s living standard has been set to normal, since there is no room for ${him} to occupy.`; @@ -1863,6 +1858,7 @@ globalThis.DefaultRules = (function() { slave.rules.living = rule.livingRules; r += `<br>${slave.slaveName}'s living standard has been set to ${rule.livingRules}.`; } + penthouseCensus(); } } } diff --git a/src/js/utilsFC.js b/src/js/utilsFC.js index 80080401ce90d1da6fbcc6ed4fc3ea341e76ed31..e359072b3b56246a1d5e7d66b6eeffef24c24870 100644 --- a/src/js/utilsFC.js +++ b/src/js/utilsFC.js @@ -2916,6 +2916,16 @@ globalThis.penthouseCensus = function() { V.dormitoryPopulation = penthouseSlaves.filter(s => s.rules.living !== "luxurious").length; }; +/** Determine whether a given penthouse slave can move into a private room or not. + * @param {App.Entity.SlaveState} slave + * @returns {boolean} + */ +globalThis.canMoveToRoom = function(slave) { + const partner = slave.relationship >= 4 ? getSlave(slave.relationshipTarget) : null; + const partnerHasRoom = partner && assignmentVisible(partner) && partner.rules.living === "luxurious"; + return partnerHasRoom || V.rooms - V.roomsPopulation >= 1; +}; + /** * @param {App.Entity.Facilities.Job|App.Entity.Facilities.Facility} jobOrFacility job or facility object * @returns {App.Entity.SlaveState[]} array of slaves employed at the job or facility, sorted in accordance to user choice diff --git a/src/uncategorized/saRules.tw b/src/uncategorized/saRules.tw index 8a68e5987af98b74ee9c73be4d65c19d5d9e2a49..5c486de75a04e39ee68de7d91c1b98f06b3c3eb4 100644 --- a/src/uncategorized/saRules.tw +++ b/src/uncategorized/saRules.tw @@ -4430,8 +4430,7 @@ <<if $slaves[$i].rules.living == "luxurious">> There are @@.yellow;too many slaves for the penthouse's individual rooms,@@ so $he moves out into the dormitory. <<set $slaves[$i].rules.living = "normal">> - <<set $dormitoryPopulation += 1>> - <<if $slaves[$i].relationship >= 4>><<set $roomsPopulation -= 0.5>><<else>><<set $roomsPopulation -= 1>><</if>> + <<run penthouseCensus()>> <</if>> <</if>> <</if>>