diff --git a/src/cheats/cheatEditSlave.js b/src/cheats/cheatEditSlave.js index ab151ade2a0b9e0954c6bff0850118411fa0f65e..54fea7440484ec731eea6e113e475e89f3b27b9b 100644 --- a/src/cheats/cheatEditSlave.js +++ b/src/cheats/cheatEditSlave.js @@ -27,6 +27,7 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { const tabCaptions = { "profile": 'Profile', "physical": 'Physical', + "womb": 'Womb', "mental": 'Mental', "skills": 'Skills', "family": 'Relationships', @@ -40,6 +41,7 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { tabBar.append( App.UI.tabBar.tabButton('profile', tabCaptions.profile), App.UI.tabBar.tabButton('physical', tabCaptions.physical), + App.UI.tabBar.tabButton('womb', tabCaptions.womb), App.UI.tabBar.tabButton('mental', tabCaptions.mental), App.UI.tabBar.tabButton('skills', tabCaptions.skills), App.UI.tabBar.tabButton('family', tabCaptions.family), @@ -53,6 +55,9 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { el.append(App.UI.tabBar.makeTab('profile', makeSpanIded("content-profile", App.StartingGirls.profile(V.tempSlave, true)))); el.append(App.UI.tabBar.makeTab('physical', makeSpanIded("content-physical", App.StartingGirls.physical(V.tempSlave, true)))); + if (V.tempSlave.womb.length > 0) { + el.append(App.UI.tabBar.makeTab('womb', makeSpanIded("content-womb", analyzePregnancies(V.tempSlave, true)))); + } el.append(App.UI.tabBar.makeTab('mental', makeSpanIded("content-mental", App.StartingGirls.mental(V.tempSlave, true)))); el.append(App.UI.tabBar.makeTab('skills', makeSpanIded("content-skills", App.StartingGirls.skills(V.tempSlave, true)))); el.append(App.UI.tabBar.makeTab('family', makeSpanIded("content-family", App.Intro.editFamily(V.tempSlave, true)))); @@ -78,8 +83,8 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link( "Apply cheat edits", () => { - App.StartingGirls.cleanup(tempSlave); - V.slaves[V.slaveIndices[slave.ID]] = tempSlave; + App.StartingGirls.cleanup(V.tempSlave); + V.slaves[V.slaveIndices[slave.ID]] = V.tempSlave; ibc.recalculate_coeff_id(slave.ID); delete V.tempSlave; }, diff --git a/src/facilities/surgery/analyzePregnancy.js b/src/facilities/surgery/analyzePregnancy.js index fb33e286902ab8899c7bfebac5d1fbc0e4960f36..a556e7023af75a1e3156a6f8daf5f9b18620959f 100644 --- a/src/facilities/surgery/analyzePregnancy.js +++ b/src/facilities/surgery/analyzePregnancy.js @@ -14,79 +14,130 @@ globalThis.analyzePregnancies = function(mother, cheat) { function scanFetus(i) { const el = new DocumentFragment(); const fetus = mother.womb[i]; - let linkArray = []; + const genes = fetus.genetics; + let option; + const options = new App.UI.OptionsGroup(); if (fetus.age >= 2) { - App.UI.DOM.appendNewElement("div", el, `Ova: ${fetus.genetics.name}`); - App.UI.DOM.appendNewElement("div", el, `Age: ${Math.trunc(fetus.age * 1000) / 1000}`); + options.addOption(`Ova: ${genes.name}`, "name", genes).showTextBox(); + options.addOption(`Age: ${Math.trunc(fetus.age * 1000) / 1000}`, "age", fetus).showTextBox(); if (V.geneticMappingUpgrade >= 1) { - App.UI.DOM.appendNewElement("div", el, `Gender: ${fetus.genetics.gender}`); - App.UI.DOM.appendNewElement("div", el, `Father ID: ${fetus.genetics.father}`); - App.UI.DOM.appendNewElement("div", el, `Father Name: ${(fetus.genetics.fatherName) ? fetus.genetics.fatherName : `name not registered`}`); - - App.UI.DOM.appendNewElement("div", el, `Mother ID: ${fetus.genetics.mother}`); - App.UI.DOM.appendNewElement("div", el, `Mother Name: ${(fetus.genetics.motherName) ? fetus.genetics.motherName : `name not registered`}`); - App.UI.DOM.appendNewElement("div", el, `Nationality: ${fetus.genetics.nationality}`); - App.UI.DOM.appendNewElement("div", el, `Race: ${capFirstChar(fetus.genetics.race)}`); - App.UI.DOM.appendNewElement("div", el, `Skin tone: ${capFirstChar(fetus.genetics.skin)}`); - App.UI.DOM.appendNewElement("div", el, `Intelligence index: ${fetus.genetics.intelligence} out of 100`); - App.UI.DOM.appendNewElement("div", el, `Face index: ${fetus.genetics.face} out of 100`); - App.UI.DOM.appendNewElement("div", el, `Eye Color: ${capFirstChar(fetus.genetics.eyeColor)}`); - App.UI.DOM.appendNewElement("div", el, `Hair Color: ${capFirstChar(fetus.genetics.hColor)}`); + option = options.addOption(`Gender: ${genes.gender}`, "age", fetus); + if (cheat) { + option.addValue("Female", "XX"); + option.addValue("Male", "XY"); + } + options.addOption(`Father name: ${(genes.fatherName) ? genes.fatherName : `name not registered`}; ID: ${genes.father}`, "father", genes).showTextBox(); + options.addOption(`Mother name: ${(genes.motherName) ? genes.motherName : `name not registered`}; ID: ${genes.mother}`, "mother", genes).showTextBox(); + options.addOption(`Nationality: ${genes.nationality}`, "nationality", genes).showTextBox(); + if (V.seeRace === 1) { + options.addOption(`Race: ${capFirstChar(genes.race)}`, "race", genes).showTextBox().pulldown() + .addValueList(Array.from(App.Data.misc.filterRaces, (k => [k[1], k[0]]))); + } + options.addOption(`Skin tone: ${capFirstChar(genes.skin)}`, "skin", genes).showTextBox().pulldown() + .addValueList(App.Medicine.Modification.naturalSkins); + options.addOption(`Intelligence index: ${genes.intelligence} out of 100`, "intelligence", genes).showTextBox(); + options.addOption(`Face index: ${genes.face} out of 100`, "face", genes).showTextBox(); + option = options.addOption(`Eye Color: ${capFirstChar(genes.eyeColor)}`, "eyeColor", genes).showTextBox().pulldown(); + for (const color of App.Medicine.Modification.eyeColor.map(color => color.value)) { + option.addValue(capFirstChar(color), color); + } + option = options.addOption(`Hair Color: ${capFirstChar(genes.hColor)}`, "hColor", genes).showTextBox().pulldown(); + for (const color of App.Medicine.Modification.Color.Primary.map(color => color.value)) { + option.addValue(capFirstChar(color), color); + } + options.addOption(`Pubic hair: ${capFirstChar(genes.pubicHStyle)}`, "pubicHStyle", genes).showTextBox().pulldown() + .addValue("hairless") + .addValueList(App.Medicine.Modification.pubicStyles); - if (fetus.genetics.underArmHStyle === "hairless" && fetus.genetics.pubicHStyle === "hairless") { - App.UI.DOM.appendNewElement("div", el, `Body hair: None`); - } else if (fetus.genetics.underArmHStyle === "hairless") { - App.UI.DOM.appendNewElement("div", el, `Body hair: Lacks underarm hair`); - } else if (fetus.genetics.pubicHStyle === "hairless") { - App.UI.DOM.appendNewElement("div", el, `Body hair: Lacks pubic hair`); + options.addOption(`Armpit hair: ${capFirstChar(genes.underArmHStyle)}`, "underArmHStyle", genes).showTextBox().pulldown() + .addValue("hairless") + .addValueList(App.Medicine.Modification.armpitStyles); + if (genes.markings === "freckles" || genes.markings === "heavily freckled") { + options.addOption(`Markings: ${capFirstChar(genes.markings)}`, "markings", genes) + .addValueList([ + ["None", "none"], + ["Freckles", "freckles"], + ["Heavily freckled", "heavily freckled"], + ["Beauty mark", "beauty mark"], + ["Birthmark", "birthmark"], + ]); } - if (fetus.genetics.markings === "freckles" || fetus.genetics.markings === "heavily freckled") { - App.UI.DOM.appendNewElement("div", el, `Markings: ${capFirstChar(fetus.genetics.markings)}`); + el.append(options.render()); + if (cheat) { + const geneQuirks = App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link( + "Show Genetic Quirks", + () => { + const el = new DocumentFragment(); + const options = new App.UI.OptionsGroup(); + for (const [key, obj] of App.Data.genes) { + option = options.addOption(capFirstChar(obj.title), key, genes.geneticQuirks) + .addComment(capFirstChar(obj.description)) + .addValue("off", 0).off() + .addValue("carrier", 1); + if (key === "heterochromia") { + option.pulldown(); + for (const color of App.Medicine.Modification.eyeColor.map(color => color.value)) { + option.addValue(capFirstChar(color), color); + } + } else { + option.addValue("on", 2).on(); + } + } + el.append(options.render()); + jQuery(geneQuirks).empty().append(el); + } + )); + } else { + el.append(fetusAbnormalities()); } - el.append(fetusAbnormalities()); } else { if (fetus.age > 13) { - App.UI.DOM.appendNewElement("div", el, `Gender: ${fetus.genetics.gender}`); + App.UI.DOM.appendNewElement("div", el, `Gender: ${genes.gender}`); } if (fetus.age > 5) { - App.UI.DOM.appendNewElement("div", el, `Father ID: ${fetus.genetics.father}`); - App.UI.DOM.appendNewElement("div", el, `Father Name: ${fetus.genetics.fatherName}`); - App.UI.DOM.appendNewElement("div", el, `Mother ID: ${fetus.genetics.mother}`); - App.UI.DOM.appendNewElement("div", el, `Mother Name: ${fetus.genetics.motherName}`); + App.UI.DOM.appendNewElement("div", el, `Father ID: ${genes.father}`); + App.UI.DOM.appendNewElement("div", el, `Father Name: ${genes.fatherName}`); + App.UI.DOM.appendNewElement("div", el, `Mother ID: ${genes.mother}`); + App.UI.DOM.appendNewElement("div", el, `Mother Name: ${genes.motherName}`); } } if (V.incubator.capacity > 0 || V.nursery > 0) { App.UI.DOM.appendNewElement("div", el, `Reserved: ${fetus.reserve}`); } - App.UI.DOM.appendNewElement("div", el, `Rename: `) - .append(App.UI.DOM.makeTextBox( - fetus.genetics.name, - (v) => fetus.genetics.name = v - )); if (fetus.age < 4 && (V.arcologies[0].FSRestart === "unset" || V.eugenicsFullControl === 1 || mother.breedingMark === 0 || V.propOutcome === 0 || (fetus.fatherID !== -1 && fetus.fatherID !== -6))) { - linkArray.push(App.UI.DOM.link( - "Terminate ovum", - () => { - WombRemoveFetus(mother, i); - if (mother.preg === 0) { - mother.pregWeek = -1; - } - } - )); + option = options.addOption(``) + .customButton( + "Terminate ovum", + () => { + WombRemoveFetus(mother, i); + if (mother.preg === 0) { + mother.pregWeek = -1; + } + }, + passage() + ) + .customButton( + "Terminate ovum", + () => { + WombRemoveFetus(mother, i); + if (mother.preg === 0) { + mother.pregWeek = -1; + } + }, + passage() + ); if (V.surgeryUpgrade === 1) { - linkArray.push(App.UI.DOM.link( + option.customButton( "Transplant ovum", () => { V.donatrix = mother; V.wombIndex = i; V.nextLink = "Analyze Pregnancy"; }, - [], "Ova Transplant Workaround" - )); + ); } - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); } if (V.incubator.capacity > 0) { if (fetus.reserve === "incubator") { @@ -135,32 +186,30 @@ globalThis.analyzePregnancies = function(mother, cheat) { } } } else { - linkArray = []; App.UI.DOM.appendNewElement("div", el, `Unidentified ova found, no detailed data available.`); App.UI.DOM.appendNewElement("div", el, `Age: too early for scan.`); - linkArray.push(App.UI.DOM.link( - `Terminate ovum`, - () => { - WombRemoveFetus(mother, i); - if (mother.preg === 0) { - mother.pregWeek = -1; - } - }, - [], - passage() - )); + option = options.addOption(``) + .customButton( + `Terminate ovum`, + () => { + WombRemoveFetus(mother, i); + if (mother.preg === 0) { + mother.pregWeek = -1; + } + }, + passage() + ); if (V.surgeryUpgrade === 1) { - linkArray.push(App.UI.DOM.link( + option.customButton( `Transplant ovum`, () => { V.donatrix = mother; V.wombIndex = i; V.nextLink = "Analyze Pregnancy"; }, - [], `Ova Transplant Workaround` - )); + ); } } return el; @@ -169,13 +218,13 @@ globalThis.analyzePregnancies = function(mother, cheat) { const div = App.UI.DOM.makeElement("div", null); const abnormalitySpans = []; - for (const gene in fetus.genetics.geneticQuirks) { + for (const gene in genes.geneticQuirks) { const geneObj = App.Data.genes.get(gene); const quirkName = (geneObj && geneObj.abbreviation) ? geneObj.abbreviation : gene; const quirkColor = (geneObj && geneObj.goodTrait) ? "green" : "red"; - if (fetus.genetics.geneticQuirks[gene] === 2 || typeof fetus.genetics.geneticQuirks[gene] === "string") { // String check is for heterochromia + if (genes.geneticQuirks[gene] === 2 || typeof genes.geneticQuirks[gene] === "string") { // String check is for heterochromia abnormalitySpans.push(App.UI.DOM.makeElement("span", quirkName, quirkColor)); - } else if (fetus.genetics.geneticQuirks[gene] === 1 && V.geneticMappingUpgrade >= 2) { + } else if (genes.geneticQuirks[gene] === 1 && V.geneticMappingUpgrade >= 2) { abnormalitySpans.push(App.UI.DOM.makeElement("span", quirkName, "yellow")); } }