diff --git a/src/facilities/surgery/surgeryPassageExotic.js b/src/facilities/surgery/surgeryPassageExotic.js index 29e99c9e6611f466f586e636937f8d6f56acbd97..df7cb0717b535b50e9dec26bfe6cbffb96f29314 100644 --- a/src/facilities/surgery/surgeryPassageExotic.js +++ b/src/facilities/surgery/surgeryPassageExotic.js @@ -50,13 +50,12 @@ App.UI.surgeryPassageExotic = function(slave, refreshParent, cheat = false) { function geneTherapy() { const el = new DocumentFragment(); - const r = []; - const linkArray = []; if (slave.indentureRestrictions >= 1) { App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]); } else if (slave.health.health < 0) { App.UI.DOM.appendNewElement("div", el, `${He}'s too unhealthy to undergo gene therapy`, ["choices", "note"]); } else { + const linkArray = []; if (V.arcologies[0].childhoodFertilityInducedNCSResearch === 1) { if (slave.geneMods.NCS === 0) { linkArray.push(App.Medicine.Surgery.makeLink( @@ -86,16 +85,16 @@ App.UI.surgeryPassageExotic = function(slave, refreshParent, cheat = false) { App.UI.DOM.appendNewElement("div", el, `${He} already is already immortal`, ["choices", "note"]); } } + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices"); } - App.Events.addNode(el, r, "div"); - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices"); el.append(retroVirus()); return el; function retroVirus() { const el = new DocumentFragment(); const slaveGeneList = App.UI.DOM.appendNewElement("ul", el); - const select = App.UI.DOM.appendNewElement("select", el); + const select = document.createElement("select"); + const canEditGenes = slave.indentureRestrictions === 0 && slave.health.health >= 0; select.classList.add("rajs-list"); const description = App.UI.DOM.appendNewElement("div", el, null); for (const gene in slave.geneticQuirks) { @@ -120,15 +119,20 @@ App.UI.surgeryPassageExotic = function(slave, refreshParent, cheat = false) { ) { continue; } - const choice = App.UI.DOM.appendNewElement("option", select, capFirstChar(geneData.title)); - choice.value = gene; - select.append(choice); + if (canEditGenes) { + const choice = App.UI.DOM.appendNewElement("option", select, capFirstChar(geneData.title)); + choice.value = gene; + select.append(choice); + } + } + if (canEditGenes) { + select.selectedIndex = -1; + select.onchange = () => { + // selectedGene = select.options[select.selectedIndex]; + jQuery(description).empty().append(describeGene(select.value)); + }; + el.append(select); } - select.selectedIndex = -1; - select.onchange = () => { - // selectedGene = select.options[select.selectedIndex]; - jQuery(description).empty().append(describeGene(select.value)); - }; return el;