diff --git a/src/facilities/bodyModification/bodyModification.js b/src/facilities/bodyModification/bodyModification.js index 4975c4009184b594cf92850a2ac77179c4b3ac01..972d1841a5f34bb4571f80e776e82b80898c5f8f 100644 --- a/src/facilities/bodyModification/bodyModification.js +++ b/src/facilities/bodyModification/bodyModification.js @@ -21,11 +21,11 @@ App.UI.bodyModification = function(slave, cheat = false) { function createPage() { const el = new DocumentFragment(); - if (V.seeImages > 0) { - App.Events.drawEventArt(el, slave); - } - el.append(intro()); if (!cheat) { + if (V.seeImages > 0 ) { + App.Events.drawEventArt(el, slave); + } + el.append(intro()); el.append(reaction()); } el.append(piercings()); @@ -574,7 +574,7 @@ App.UI.bodyModification = function(slave, cheat = false) { const el = new DocumentFragment(); const selection = document.createElement("span"); selection.id = "brand-selection"; - selection.append(App.Medicine.Modification.Select.brand(slave, cheat)); + selection.append(brand(slave, cheat)); el.append(selection); if (slave.breedingMark === 1 && (V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) { @@ -861,6 +861,349 @@ App.UI.bodyModification = function(slave, cheat = false) { return el; } + function brand(slave, cheat = false) { + const el = new DocumentFragment(); + let p = document.createElement('p'); + let div = document.createElement('div'); + const {his, His, him, He} = getPronouns(slave); + + App.UI.DOM.appendNewElement("h2", el, "Branding"); + + for (const brandPlace in slave.brand) { + div = document.createElement('div'); + div.append(`${His} ${brandPlace} is marked with ${slave.brand[brandPlace]}`); + if (slave.brand[brandPlace] === V.brandDesign.official) { + div.append(`, your `); + div.append(App.UI.DOM.passageLink("official brand", "Universal Rules")); + } + div.append(": "); + if (!cheat) { + div.append( + App.UI.DOM.link( + "Remove Brand", + () => { + V.brandApplied = 0; + delete slave.brand[brandPlace]; + cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); + V.degradation -= 10; + refresh(); + }, + ) + ); + } else { + div.append( + App.UI.DOM.link( + "Remove Brand", + () => { + delete slave.brand[brandPlace]; + brandRefresh(); + }, + ) + ); + } + p.append(div); + } + + if (jQuery.isEmptyObject(slave.brand)) { + App.UI.DOM.appendNewElement("div", p, `${His} skin is unmarked.`); + } + + if (!(Object.values(slave.brand).includes(V.brandDesign.official))) { + div = document.createElement('div'); + div.append(`${He} lacks your `); + div.append(App.UI.DOM.passageLink("official brand", "Universal Rules")); + div.append(`, "${V.brandDesign.official}."`); + p.append(div); + } + + el.append(p); + p = document.createElement('p'); + + div = document.createElement('div'); + div.append(`Use ''${V.brandDesign.local}'' or choose another brand: `); + div.append(symbolOptions("personal")); + p.append(div); + + p.append(symbolBlock("dirtyWord")); + p.append(symbolBlock("genitalSymbol")); + p.append(symbolBlock("silhouettes")); + p.append(symbolBlock("FS")); + + div = document.createElement('div'); + div.append(`Or design your own: `); + div.append( + App.UI.DOM.makeTextBox( + V.brandDesign.local, + v => { + V.brandDesign.local = v; + brandRefresh(); + }, + ) + ); + p.append(div); + el.append(p); + + p = document.createElement('p'); + App.UI.DOM.appendNewElement("div", p, "Choose a site for branding: "); + const body = slaveBody(); + p.append(partLinks(body.head)); + p.append(partLinks(body.torso)); + p.append(partLinks(body.arms)); + p.append(partLinks(body.legs)); + + div = document.createElement('div'); + div.append(`Or a custom site: `); + div.append( + App.UI.DOM.makeTextBox( + V.brandTarget.local, + v => { + V.brandTarget.local = v; + brandRefresh(); + }, + ) + ); + p.append(div); + el.append(p); + + p = document.createElement('p'); + + if (["ankle", "breast", "buttock", "calf", "cheek", "ear", "foot", "hand", "lower arm", "shoulder", "testicle", "thigh", "upper arm", "wrist"].includes(V.brandTarget.local)) { + const leftTarget = ("left " + V.brandTarget.local); + const rightTarget = ("right " + V.brandTarget.local); + if (slave.brand[leftTarget]) { + p.append(`${His} ${leftTarget} is already marked with ${slave.brand[leftTarget]}. `); + } + if (slave.brand[rightTarget]) { + p.append(`${His} ${rightTarget} is already marked with ${slave.brand[rightTarget]}. `); + } + p.append(`Brand ${him} now with ''${V.brandDesign.local}'' on the `); // todo: break out bold + let _left; + let _right; + if ( + !(["upper arm", "lower arm", "wrist", "hand"].includes(V.brandTarget.local) && getLeftArmID(slave) !== 1) && + !(["thigh", "calf", "ankle", "foot"].includes(V.brandTarget.local) && getLeftLegID(slave) !== 1) + ) { + _left = 1;// make next checks easier + if (!cheat) { + p.append( + App.UI.DOM.link( + "left", + () => { + V.brandApplied = 1; + slave.brand[leftTarget] = check(V.brandDesign.local); + cashX(forceNeg(V.modCost), "slaveMod", slave); + V.degradation += 10; + refresh(); + }, + ) + ); + } else { + p.append( + App.UI.DOM.link( + "left", + () => { + slave.brand[leftTarget] = check(V.brandDesign.local); + refresh(); + }, + ) + ); + } + + if (!(["upper arm", "lower arm", "wrist", "hand"].includes(V.brandTarget.local) && getRightArmID(slave) !== 1) && !(["thigh", "calf", "ankle", "foot"].includes(V.brandTarget.local) && getRightLegID(slave) !== 1)) { + _right = 1; // make next checks easier + } + if (_left && _right) { + p.append(` ${V.brandTarget.local}, or the `); + } + if (_right) { + if (!cheat) { + p.append( + App.UI.DOM.link( + "right", + () => { + V.brandApplied = 1; + slave.brand[rightTarget] = check(V.brandDesign.local); + cashX(forceNeg(V.modCost), "slaveMod", slave); + V.degradation += 10; + refresh(); + }, + ) + ); + } else { + p.append( + App.UI.DOM.link( + "right", + () => { + slave.brand[rightTarget] = check(V.brandDesign.local); + refresh(); + }, + ) + ); + } + } + p.append(`? `); + if (!_left || !_right) { + p.append(` ${V.brandTarget.local}`); + App.UI.DOM.appendNewElement("span", p, `Branding will slightly reduce ${his} beauty but may slowly increase your reputation.`, "note"); + } + } + } else { + if (slave.brand[V.brandTarget.local] === V.brandDesign.local) { + p.append(`${He} already has ${V.brandDesign.local} on ${his} ${V.brandTarget.local}.`); + } else { + if (!cheat) { + p.append( + App.UI.DOM.link( + "Brand", + () => { + V.brandApplied = 1; + slave.brand[V.brandTarget.local] = V.brandDesign.local; + cashX(forceNeg(V.modCost), "slaveMod", slave); + V.degradation += 10; + refresh(); + }, + ) + ); + } else { + p.append( + App.UI.DOM.link( + "Brand", + () => { + slave.brand[V.brandTarget.local] = V.brandDesign.local; + refresh(); + }, + ) + ); + } + p.append(` with ${V.brandDesign.local} on the ${V.brandTarget.local}`); + if (slave.brand[V.brandTarget.local]) { + p.append(`, covering the "${slave.brand[V.brandTarget.local]}" that is already there? `); + } else { + p.append(`. `); + } + App.UI.DOM.appendNewElement("span", p, `Branding will slightly reduce ${his} beauty but may slowly increase your reputation.`, "note"); + } + } + el.append(p); + return el; + + function symbolBlock(brandList) { + const div = document.createElement('div'); + div.classList.add("choices"); + div.append(symbolOptions(brandList)); + return div; + } + + function symbolOptions(brandList) { + const list = App.Medicine.Modification.Brands[brandList]; + const array = []; + for (const brand in list) { + const frag = new DocumentFragment(); + if (!cheat && list[brand].hasOwnProperty("requirements")) { + if (!list[brand].requirements(slave)) { + continue; + } + } + if (brandList === "FS") { + App.UI.DOM.appendNewElement("span", frag, "FS ", "note"); + } + frag.append( + App.UI.DOM.link( + list[brand].displayName, + () => { + V.brandDesign.local = check(brand); + brandRefresh(); + } + ) + ); + array.push(frag); + } + return App.UI.DOM.generateLinksStrip(array); + } + + function slaveBody() { + const body = {}; + // Sorted head to toe + // Head + body.head = {}; + if (slave.earShape !== "none") { + body.head.ears = "Ears"; + } + body.head.cheek = "Cheeks"; + body.head.neck = "Neck"; + + // Torso + body.torso = {}; + body.torso.chest = "Chest"; + body.torso.breast = "Breasts"; + body.torso.back = "Back"; + body.torso["lower back"] = "Lower Back"; + body.torso.belly = "Belly"; + body.torso["pubic mound"] = "Pubic Mound"; + + if (slave.dick > 0) { + body.torso.penis = "Penis"; + } + if (slave.balls > 0 && slave.scrotum > 0) { + body.torso.testicle = "Testicles"; + } + + // Arms + body.arms = {}; + body.arms.shoulder = "Shoulders"; + if (hasAnyNaturalArms(slave)) { + body.arms["upper arm"] = "Arm, upper"; + body.arms["lower arm"] = "Arm, lower"; + body.arms.wrist = "Wrists"; + body.arms.hand = "Hands"; + } + + // Legs + body.legs = {}; + body.legs.buttock = "Buttocks"; + if (hasAnyNaturalLegs(slave)) { + body.legs.thigh = "Thighs"; + body.legs.calf = "Calves"; + body.legs.ankle = "Ankles"; + body.legs.foot = "Feet"; + } + return body; + } + + function partLinks(bodyPartObj) { + const div = document.createElement("div"); + div.classList.add("choices"); + const array = []; + for (const bp in bodyPartObj) { + array.push( + App.UI.DOM.link( + bodyPartObj[bp], + () => { + V.brandTarget.local = check(bp); + brandRefresh(); + } + ) + ); + } + div.append(App.UI.DOM.generateLinksStrip(array)); + return div; + } + + function check(brand) { + switch(brand) { + case "a big helping of your favorite food": + return "a big helping of " + V.PC.refreshment; + default: + return brand; + } + } + + function brandRefresh() { + jQuery('#brand-selection').empty().append(brand(slave, cheat)); + } + } + + function refresh() { jQuery("#body-modification").empty().append(createPage()); } diff --git a/src/facilities/bodyModification/createBrand.js b/src/facilities/bodyModification/createBrand.js deleted file mode 100644 index fb7b5cc58e1fb92c777536573c4dc7d38f5921e1..0000000000000000000000000000000000000000 --- a/src/facilities/bodyModification/createBrand.js +++ /dev/null @@ -1,342 +0,0 @@ -App.Medicine.Modification.Select.brand = function(slave, cheat = false) { - const el = new DocumentFragment(); - let p = document.createElement('p'); - let div = document.createElement('div'); - const {his, His, him, He} = getPronouns(slave); - - App.UI.DOM.appendNewElement("h2", el, "Branding"); - - for (const brandPlace in slave.brand) { - div = document.createElement('div'); - div.append(`${His} ${brandPlace} is marked with ${slave.brand[brandPlace]}`); - if (slave.brand[brandPlace] === V.brandDesign.official) { - div.append(`, your `); - div.append(App.UI.DOM.passageLink("official brand", "Universal Rules")); - } - div.append(": "); - if (!cheat) { - div.append( - App.UI.DOM.link( - "Remove Brand", - () => { - V.brandApplied = 0; - delete slave.brand[brandPlace]; - cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - V.degradation -= 10; - }, - [], - "Body Modification" - ) - ); - } else { - div.append( - App.UI.DOM.link( - "Remove Brand", - () => { - delete slave.brand[brandPlace]; - refresh(); - }, - ) - ); - } - p.append(div); - } - - if (jQuery.isEmptyObject(slave.brand)) { - App.UI.DOM.appendNewElement("div", p, `${His} skin is unmarked.`); - } - - if (!(Object.values(slave.brand).includes(V.brandDesign.official))) { - div = document.createElement('div'); - div.append(`${He} lacks your `); - div.append(App.UI.DOM.passageLink("official brand", "Universal Rules")); - div.append(`, "${V.brandDesign.official}."`); - p.append(div); - } - - el.append(p); - p = document.createElement('p'); - - div = document.createElement('div'); - div.append(`Use ''${V.brandDesign.local}'' or choose another brand: `); - div.append(symbolOptions("personal")); - p.append(div); - - p.append(symbolBlock("dirtyWord")); - p.append(symbolBlock("genitalSymbol")); - p.append(symbolBlock("silhouettes")); - p.append(symbolBlock("FS")); - - div = document.createElement('div'); - div.append(`Or design your own: `); - div.append( - App.UI.DOM.makeTextBox( - V.brandDesign.local, - v => { - V.brandDesign.local = v; - refresh(); - }, - ) - ); - p.append(div); - el.append(p); - - p = document.createElement('p'); - App.UI.DOM.appendNewElement("div", p, "Choose a site for branding: "); - const body = slaveBody(); - p.append(partLinks(body.head)); - p.append(partLinks(body.torso)); - p.append(partLinks(body.arms)); - p.append(partLinks(body.legs)); - - div = document.createElement('div'); - div.append(`Or a custom site: `); - div.append( - App.UI.DOM.makeTextBox( - V.brandTarget.local, - v => { - V.brandTarget.local = v; - refresh(); - }, - ) - ); - p.append(div); - el.append(p); - - p = document.createElement('p'); - - if (["ankle", "breast", "buttock", "calf", "cheek", "ear", "foot", "hand", "lower arm", "shoulder", "testicle", "thigh", "upper arm", "wrist"].includes(V.brandTarget.local)) { - const leftTarget = ("left " + V.brandTarget.local); - const rightTarget = ("right " + V.brandTarget.local); - if (slave.brand[leftTarget]) { - p.append(`${His} ${leftTarget} is already marked with ${slave.brand[leftTarget]}. `); - } - if (slave.brand[rightTarget]) { - p.append(`${His} ${rightTarget} is already marked with ${slave.brand[rightTarget]}. `); - } - p.append(`Brand ${him} now with ''${V.brandDesign.local}'' on the `); // todo: break out bold - let _left; - let _right; - if ( - !(["upper arm", "lower arm", "wrist", "hand"].includes(V.brandTarget.local) && getLeftArmID(slave) !== 1) && - !(["thigh", "calf", "ankle", "foot"].includes(V.brandTarget.local) && getLeftLegID(slave) !== 1) - ) { - _left = 1;// make next checks easier - if (!cheat) { - p.append( - App.UI.DOM.link( - "left", - () => { - V.brandApplied = 1; - slave.brand[leftTarget] = check(V.brandDesign.local); - cashX(forceNeg(V.modCost), "slaveMod", slave); - V.degradation += 10; - }, - [], - "Body Modification" - ) - ); - } else { - p.append( - App.UI.DOM.link( - "left", - () => { - slave.brand[leftTarget] = check(V.brandDesign.local); - }, - ) - ); - } - - if (!(["upper arm", "lower arm", "wrist", "hand"].includes(V.brandTarget.local) && getRightArmID(slave) !== 1) && !(["thigh", "calf", "ankle", "foot"].includes(V.brandTarget.local) && getRightLegID(slave) !== 1)) { - _right = 1; // make next checks easier - } - if (_left && _right) { - p.append(` ${V.brandTarget.local}, or the `); - } - if (_right) { - if (!cheat) { - p.append( - App.UI.DOM.link( - "right", - () => { - V.brandApplied = 1; - slave.brand[rightTarget] = check(V.brandDesign.local); - cashX(forceNeg(V.modCost), "slaveMod", slave); - V.degradation += 10; - }, - [], - "Body Modification" - ) - ); - } else { - p.append( - App.UI.DOM.link( - "right", - () => { - slave.brand[rightTarget] = check(V.brandDesign.local); - }, - ) - ); - } - } - p.append(`? `); - if (!_left || !_right) { - p.append(` ${V.brandTarget.local}`); - App.UI.DOM.appendNewElement("span", p, `Branding will slightly reduce ${his} beauty but may slowly increase your reputation.`, "note"); - } - } - } else { - if (slave.brand[V.brandTarget.local] === V.brandDesign.local) { - p.append(`${He} already has ${V.brandDesign.local} on ${his} ${V.brandTarget.local}.`); - } else { - if (!cheat) { - p.append( - App.UI.DOM.link( - "Brand", - () => { - V.brandApplied = 1; - slave.brand[V.brandTarget.local] = V.brandDesign.local; - cashX(forceNeg(V.modCost), "slaveMod", slave); - V.degradation += 10; - }, - [], - "Body Modification" - ) - ); - } else { - p.append( - App.UI.DOM.link( - "Brand", - () => { - slave.brand[V.brandTarget.local] = V.brandDesign.local; - }, - ) - ); - } - p.append(` with ${V.brandDesign.local} on the ${V.brandTarget.local}`); - if (slave.brand[V.brandTarget.local]) { - p.append(`, covering the "${slave.brand[V.brandTarget.local]}" that is already there? `); - } else { - p.append(`. `); - } - App.UI.DOM.appendNewElement("span", p, `Branding will slightly reduce ${his} beauty but may slowly increase your reputation.`, "note"); - } - } - el.append(p); - return el; - - function symbolBlock(brandList) { - const div = document.createElement('div'); - div.classList.add("choices"); - div.append(symbolOptions(brandList)); - return div; - } - - function symbolOptions(brandList) { - const list = App.Medicine.Modification.Brands[brandList]; - const array = []; - for (const brand in list) { - const frag = new DocumentFragment(); - if (!cheat && list[brand].hasOwnProperty("requirements")) { - if (!list[brand].requirements(slave)) { - continue; - } - } - if (brandList === "FS") { - App.UI.DOM.appendNewElement("span", frag, "FS ", "note"); - } - frag.append( - App.UI.DOM.link( - list[brand].displayName, - () => { - V.brandDesign.local = check(brand); - refresh(); - } - ) - ); - array.push(frag); - } - return App.UI.DOM.generateLinksStrip(array); - } - - function slaveBody() { - const body = {}; - // Sorted head to toe - // Head - body.head = {}; - if (slave.earShape !== "none") { - body.head.ears = "Ears"; - } - body.head.cheek = "Cheeks"; - body.head.neck = "Neck"; - - // Torso - body.torso = {}; - body.torso.chest = "Chest"; - body.torso.breast = "Breasts"; - body.torso.back = "Back"; - body.torso["lower back"] = "Lower Back"; - body.torso.belly = "Belly"; - body.torso["pubic mound"] = "Pubic Mound"; - - if (slave.dick > 0) { - body.torso.penis = "Penis"; - } - if (slave.balls > 0 && slave.scrotum > 0) { - body.torso.testicle = "Testicles"; - } - - // Arms - body.arms = {}; - body.arms.shoulder = "Shoulders"; - if (hasAnyNaturalArms(slave)) { - body.arms["upper arm"] = "Arm, upper"; - body.arms["lower arm"] = "Arm, lower"; - body.arms.wrist = "Wrists"; - body.arms.hand = "Hands"; - } - - // Legs - body.legs = {}; - body.legs.buttock = "Buttocks"; - if (hasAnyNaturalLegs(slave)) { - body.legs.thigh = "Thighs"; - body.legs.calf = "Calves"; - body.legs.ankle = "Ankles"; - body.legs.foot = "Feet"; - } - return body; - } - - function partLinks(bodyPartObj) { - const div = document.createElement("div"); - div.classList.add("choices"); - const array = []; - for (const bp in bodyPartObj) { - array.push( - App.UI.DOM.link( - bodyPartObj[bp], - () => { - V.brandTarget.local = check(bp); - refresh(); - } - ) - ); - } - div.append(App.UI.DOM.generateLinksStrip(array)); - return div; - } - - function check(brand) { - switch(brand) { - case "a big helping of your favorite food": - return "a big helping of " + V.PC.refreshment; - default: - return brand; - } - } - - function refresh() { - jQuery('#brand-selection').empty().append(App.Medicine.Modification.Select.brand(slave, cheat)); - } -}; diff --git a/src/npc/startingGirls/startingGirls.tw b/src/npc/startingGirls/startingGirls.tw index 5439453d4e8e602da0cdfd39ca2d57574e4374eb..4b9b6acfa1de4b32e73391fd52b2f085168246b9 100644 --- a/src/npc/startingGirls/startingGirls.tw +++ b/src/npc/startingGirls/startingGirls.tw @@ -372,6 +372,7 @@ <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'Mental')" id="tab Mental">Mental</button> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'Skills')" id="tab Skills">Skills</button> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'Family', App.StartingGirls.uncommittedFamilyTree(V.activeSlave))" id="tab Family">Family</button> + <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'body-mods')" id="tab body-mods">Body Mods</button> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'Customization')" id="tab Customization">Customization</button> <<if $cash >= _slaveCost>> <button class="tab-links" onclick="App.UI.tabBar.openTab(event, 'assignRemove')" id="tab assignRemove">Finalize</button> @@ -1064,6 +1065,12 @@ </div> </div> +<div id="body-mods" class="tab-content"> + <div class="content"> + <<includeDOM App.UI.bodyModification($activeSlave, true)>> + </div> +</div> + <div id="Customization" class="tab-content"> <div class="content">