diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js index 0bac999020850d2d74bf857af5db3e200eea533d..1d543ae9e2dcc568620ca558156c827ceaf0f797 100644 --- a/src/interaction/slaveInteract.js +++ b/src/interaction/slaveInteract.js @@ -531,6 +531,72 @@ App.UI.SlaveInteract.drugs = function(slave) { return jQuery('#drugs').empty().append(el); }; +App.UI.SlaveInteract.hormones = function(slave) { + let el = document.createElement('div'); + const options = []; + const level = []; + + if (slave.hormones !== 0) { + level.push({text: `None`, updateSlave: {hormones: 0}}); + } + + if (slave.indentureRestrictions < 2) { + options.push({text: `Intensive Female`, updateSlave: {hormones: 2}}); + } + options.push({text: `Female`, updateSlave: {hormones: 1}}); + options.push({text: `Male`, updateSlave: {hormones: -1}}); + if (slave.indentureRestrictions < 2) { + options.push({text: `Intensive Male`, updateSlave: {hormones: -2}}); + } else { + options.push({text: `Intensive Male`, disabled: `Cannot use this hormone level on indentured slaves`}); + } + + let title = document.createElement('div'); + title.textContent = `Hormones: `; + let choice = document.createElement('span'); + choice.style.fontWeight = "bold"; + switch(slave.hormones) { + case 2: { + choice.textContent = `intensive female `; + break; + } + case 1: { + choice.textContent = `female `; + break; + } + case 0: { + choice.textContent = `none `; + break; + } + case -1: { + choice.textContent = `male `; + break; + } + case -2: { + choice.textContent = `intensive male `; + break; + } + default: { + choice.textContent = `Not set `; + } + } + + title.append(choice); + title.appendChild(App.UI.SlaveInteract.generateRows(level, slave)); + el.append(title); + + let links = document.createElement('div'); + links.appendChild(App.UI.SlaveInteract.generateRows(options, slave)); + links.className = "choices"; + el.append(links); + + return jQuery('#hormones').empty().append(el); +}; + + + + + App.UI.SlaveInteract.useSlaveDisplay = function(slave) { // Goal: Be able to write the entire "use her" block with only dom fragments. let el = document.createElement('div'); @@ -2630,4 +2696,5 @@ App.UI.SlaveInteract.refreshAll = function(slave) { App.UI.SlaveInteract.incubator(slave); App.UI.SlaveInteract.nursery(slave); App.UI.SlaveInteract.custom(slave); + App.UI.SlaveInteract.hormones(slave); }; diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index 94563e1648293ab8a1089e530db378682f18de42..b54d573d44005e062629ad2b1a77d889337a2dc0 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -315,17 +315,10 @@ <span id="bloating"></span> <script>App.UI.SlaveInteract.bloating(getSlave(V.activeSlave.ID))</script> - Hormones: <strong><span id="hormones"> - <<if getSlave($AS).hormones == -2>>intensive male<<elseif getSlave($AS).hormones == -1>>male<<elseif getSlave($AS).hormones == 2>>intensive female<<elseif getSlave($AS).hormones == 1>>female<<else>>none<</if>></span></strong>. - <<if getSlave($AS).indentureRestrictions < 2>> - <<link "Intensive Female">><<set getSlave($AS).hormones = 2>><<replace "#hormones">>intensive female<</replace>><</link>> | - <</if>> - <<link "Female">><<set getSlave($AS).hormones = 1>><<replace "#hormones">>female<</replace>><</link>> | - <<link "None">><<set getSlave($AS).hormones = 0>><<replace "#hormones">>none<</replace>><</link>> | - <<link "Male">><<set getSlave($AS).hormones = -1>><<replace "#hormones">>male<</replace>><</link>> | - <<if getSlave($AS).indentureRestrictions < 2>> - <<link "Intensive Male">><<set getSlave($AS).hormones = -2>><<replace "#hormones">>intensive male<</replace>><</link>> - <</if>> + + + <span id="hormones"></span> + <script>App.UI.SlaveInteract.hormones(getSlave(V.activeSlave.ID))</script> <br>Diet: <strong><span id="diet"><<= getSlave($AS).diet>></span></strong>. <<link "Healthy">><<set getSlave($AS).diet = "healthy">><<replace "#diet">><<= getSlave($AS).diet>><</replace>><</link>>