diff --git a/src/facilities/surgery/surgeryPassageUpper.js b/src/facilities/surgery/surgeryPassageUpper.js new file mode 100644 index 0000000000000000000000000000000000000000..793038d5038e08dad389375e5c80fa373b44f88f --- /dev/null +++ b/src/facilities/surgery/surgeryPassageUpper.js @@ -0,0 +1,540 @@ +/** + * UI for performing surgery. Refreshes without refreshing the passage. + * @param {App.Entity.SlaveState} slave + * @param {boolean} [cheat=false] + * @returns {HTMLElement} + */ + +App.UI.surgeryPassageUpper = function(slave, cheat = false) { + const container = document.createElement("span"); + container.append(content()); + return container; + + function content() { + const el = new DocumentFragment(); + const _pubertyAge = Math.min(slave.pubertyAgeXX, slave.pubertyAgeXY); + const { + His, He, + his, he, him + } = getPronouns(slave); + /** @type {HTMLAnchorElement[]} */ + let linkArray; + + App.Events.drawEventArt(el, slave); + + let r = []; + + /* Generic boob desc*/ + App.UI.DOM.appendNewElement("h3", el, `Chest:`); + // <div> + r.push(`${His}`); + if (slave.boobs < 300) { + either("androgynous", "flat"); + r.push(` chest is barely there.`); + } else if (slave.boobs < 400) { + either("pointy", "tiny"); + r.push(`, `); + slave.boobs; + r.push(`cc chest only fill A-cups.`); + } else if (slave.boobs < 8500) { + if (V.showBoobCCs === 1) { + r.push(App.Desc.boobBits.format("%ADJ %NOUN, %VOLUME CCs, would fill %ACUP.", slave.boobs)); + } else { + r.push(App.Desc.boobBits.format("%ADJ %NOUN, would fill %ACUP.", slave.boobs)); + } + } else { + r.push(App.Desc.boobBits.format("%ADJ %NOUN, %VOLUME CCs, ", slave.boobs)); + r.push(` fill out an enormous custom bra; ${his} tits dominate ${his} entire frame.`); + } + // </div> + + /* Boob implants*/ + // <div> + r.push(`${He} has`); + if (["fillable", "advanced fillable", "hyper fillable"].includes(slave.boobsImplantType)) { + if (slave.boobsImplantType === "hyper fillable") { + if (slave.boobsImplant < 20000) { + r.push(`underfilled,`); + } else { + r.push(`enormous,`); + } + } else if (slave.boobsImplantType === "advanced fillable") { + if (slave.boobsImplant <= 1000) { + r.push(`deflated,`); + } else if (slave.boobsImplant < 2200) { + r.push(`underfilled,`); + } else if (slave.boobsImplant > 10000) { + r.push(`massively overfilled,`); + } else { + r.push(`massive,`); + } + } else { + if (slave.boobsImplant <= 500) { + r.push(`deflated,`); + } else if (slave.boobsImplant < 800) { + r.push(`underfilled,`); + } else if (slave.boobsImplant > 1800) { + r.push(`massively overfilled,`); + } else if (slave.boobsImplant > 1000) { + r.push(`massive,`); + } else if (slave.boobsImplant >= 800) { + r.push(`giant,`); + } + } + r.push(`${slave.boobsImplant}`); + r.push(`cc `); + slave.boobsImplantType; + r.push(` breast implants.`); + } else if (slave.boobsImplantType !== "none") { + if (slave.boobsImplant > 1000) { + r.push(`massive, `); + slave.boobsImplant; + r.push(`cc`); + } else if (slave.boobsImplant > 800) { + r.push(`giant, `); + slave.boobsImplant; + r.push(`cc`); + } else if (slave.boobsImplant > 600) { + r.push(`huge, `); + slave.boobsImplant; + r.push(`cc`); + } else if (slave.boobsImplant > 400) { + r.push(`large, `); + slave.boobsImplant; + r.push(`cc`); + } else if (slave.boobsImplant > 200) { + r.push(`moderate, `); + slave.boobsImplant; + r.push(`cc`); + } else if (slave.boobsImplant > 0) { + r.push(`small, `); + slave.boobsImplant; + r.push(`cc`); + } + if (slave.boobsImplantType !== "normal") { + r.push(`${slave.boobsImplantType}`); + } + r.push(`breast implants.`); + if (slave.boobsImplant > 8000 && slave.boobsImplantType === "string") { + r.push(`<span class="yellow">Large string based implants are a risk to a slave's health.</span>`); + } + } else { + r.push(`no implants.`); + } + // <div class="choices"> + const _surgeries = App.Medicine.Surgery.sizingProcedures.boobs(slave, App.Medicine.Surgery.allSizingOptions()); + const _surgeryLinks = _surgeries.map(s => App.Medicine.Surgery.makeLink("Surgery Degradation", s, slave)); + r.push(App.UI.DOM.generateLinksStrip(_surgeryLinks)); + // </div> + // </div> + + // <div> + if (slave.boobsImplant !== 0) { + r.push(`The shape of ${his} breasts is determined by ${his} implants.`); + } else { + if (slave.boobs <= 250) { + r.push(`${He}'s so flat-chested that ${his} breasts don't have much shape.`); + } else { + switch (slave.boobShape) { + case "perky": + r.push(`They're perky, with nipples that point slightly upwards.`); + break; + case "downward-facing": + r.push(`They're not attractively shaped; ${his} nipples pointing downward.`); + break; + case "torpedo-shaped": + r.push(`They're torpedo-shaped, projecting some way from ${his} chest.`); + break; + case "wide-set": + r.push(`They're wide-set, with nipples pointing away from ${his} sternum.`); + break; + case "saggy": + r.push(`They're not attractively shaped, with ${his} nipples pointing down.`); + break; + default: + r.push(`They're nicely rounded and rest naturally.`); + } + // <div class="choices"> + if (slave.indentureRestrictions >= 2) { + r.push(`<span class="note">${His} indenture does not allow breast restructuring</span>`); + } else if (slave.breastMesh === 1) { + r.push(`<span class="note">${His} supportive mesh implant prevents reconstruction</span>`); + } else { + if (slave.boobShape === "saggy" || slave.boobShape === "downward-facing") { + // [[Breast lift|Surgery Degradation][slave.boobShape = "normal", surgeryDamage(slave,20),cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "breastLift"]] + if (slave.preg > slave.pregData.normalBirth/1.42 || (slave.boobs >= 5000 && slave.boobs < 8000)) { + r.push(` <span class="note">${His} current state may result in ${his} breasts becoming saggy again</span>`); + } + } else { + if (slave.boobShape === "normal") { + // [[Reshape them to be perkier|Surgery Degradation][slave.boobShape = "perky",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave),surgeryDamage(slave,10),V.surgeryType = "breastReconstruction"]] + // | [[Make them torpedo-shaped|Surgery Degradation][slave.boobShape = "torpedo-shaped",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave),surgeryDamage(slave,10),V.surgeryType = "breastReconstruction"]] + } else { + // [[Reshape them to be more normal|Surgery Degradation][slave.boobShape = "normal",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave),surgeryDamage(slave,10),V.surgeryType = "breastReconstruction"]] + } + if (slave.boobShape !== "saggy" && slave.boobShape !== "downward-facing" && slave.boobs >= 2000 && slave.boobsImplant === 0 && V.meshImplants === 1 && V.surgeryUpgrade === 1) { + // | [[Implant a supportive mesh to preserve their shape|Surgery Degradation][slave.breastMesh = 1,cashX(forceNeg(V.surgeryCost*(slave.boobs/100)), "slaveSurgery", slave),surgeryDamage(slave,10),V.surgeryType = "breastShapePreservation"]] + } + } + } + // </div> + } + } + // </div> + + /* Nipples*/ + // <div> + if (V.surgeryUpgrade === 1) { + r.push(`${He} has ${slave.nipples} nipples.`); + // <div class="choices"> + if (slave.indentureRestrictions >= 2) { + r.push(`<span class="note">${His} indenture forbids elective surgery</span>`); + } else if (slave.indentureRestrictions === 1) { + r.push(`<span class="note">${His} indenture forbids extreme body modification</span>`); + } else { /* split for possible dicknips later on, should lcd wish to attempt it again. */ + if (slave.nipples === "fuckable") { + // [[Restore their shape and function|Surgery Degradation][slave.nipples = "huge",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + } else { + if (slave.boobs-slave.boobsMilk < 500) { + r.push(`<span class="note">${His} breasts are too small to support reshaping ${his} nipples to be penetratable</span>`); + } else if (slave.boobs-slave.boobsImplant-slave.boobsMilk < 500) { + r.push(`<span class="note">${His} implants are too large to support reshaping ${his} nipples to be penetratable</span>`); + } else if (slave.nipples !== "huge") { + r.push(`<span class="note">${His} nipples are too small to be made fuckable</span>`); + } else { + // [[Reshape them to support being penetrated|Surgery Degradation][slave.nipples = "fuckable",slave.nipplesPiercing = 0,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,20),V.surgeryType = "nippleCunts"]] + if (slave.nipplesPiercing > 0) { + r.push(` <span class="note">Will remove piercings.</span>`); + } + } + } + } + // </div> + } + // </div> + + /* Areolae*/ + // <div> + if (slave.areolae === 0) { + r.push(`${His} areolae are small`); + if (slave.areolaeShape !== "circle") { + r.push(`and have been surgically altered to be ${slave.areolaeShape}-shaped.`); + } else { + r.push(`and fairly normal.`); + } + } else if (slave.areolae === 1) { + r.push(`${His} areolae are large`); + if (slave.areolaeShape !== "circle") { + r.push(`and have been surgically altered to be ${slave.areolaeShape}-shaped.`); + } else { + r.push(`but still fairly normal.`); + } + } else if (slave.areolae > 1) { + r.push(`${He} has`); + if (slave.areolae === 2) { + r.push(`wide`); + } else if (slave.areolae === 3) { + r.push(`huge`); + } else if (slave.areolae === 4) { + r.push(`massive`); + } + r.push(`areolae`); + if (slave.areolaeShape !== "circle") { + r.push(`, which have been surgically altered to be ${slave.areolaeShape}-shaped`); + } + r.push(`.`); + } + if (slave.indentureRestrictions < 2) { + if (slave.areolaeShape !== "circle") { + r.push(`${His} ${slave.areolaeShape}-shaped areolae can be normalized or reshaped:`); + + // <div class="choices"> + // [[Normal|Surgery Degradation][slave.areolaeShape = "circle",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + if (slave.areolaeShape !== "heart") { + // | [[Heart-shaped|Surgery Degradation][slave.areolaeShape = "heart",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + } + if (slave.areolaeShape !== "star") { + // | [[Star-shaped|Surgery Degradation][slave.areolaeShape = "star",cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] | + } + // </div> + } + if (slave.areolae > 0 && slave.areolaeShape === "circle") { + r.push(`They are big enough that they could be reshaped into a pattern. Graft skin to make ${his} areolae:`); + } + // <div class="choices"> + if (slave.areolae > 0 && slave.areolaeShape === "circle") { + // [[Heart-shaped|Surgery Degradation][slave.areolaeShape = "heart",slave.areolae -= 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + // | [[Star-shaped|Surgery Degradation][slave.areolaeShape = "star",slave.areolae -= 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + } + if (slave.areolae > 0) { + // | [[Reduce areolae|Surgery Degradation][slave.areolae -= 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + } + if (slave.areolae > 0) { + // | + } + if (slave.areolae < 4) { + // [[Enlarge areolae|Surgery Degradation][slave.areolae += 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "areolae"]] + } + // </div> + } + // </div> + + /* Lactation*/ + // <div> + if (slave.lactation === 0) { + r.push(`${He} is not lactating.`); + } else if (slave.lactation === 2) { + r.push(`${He} is implanted with slow-release pro-lactation drugs.`); + } else { + r.push(`${He} is lactating naturally.`); + } + // <div class="choices"> + if (slave.lactation < 2) { + if (slave.indentureRestrictions < 2) { + // [[Implant slow-release pro-lactation drugs|Surgery Degradation][slave.lactationDuration = 2, slave.induceLactation = 0, slave.boobs -= slave.boobsMilk, slave.boobsMilk = 0, slave.rules.lactation = "none", cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "lactation"]] <span class="note">This may increase ${his} natural breast size</span> + } + } + if (slave.lactation > 1) { + // | [[Remove lactation implant|Surgery Degradation][slave.lactation = 0, slave.lactationDuration = 0,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "endlac"]] + } + // </div> + // </div> + App.UI.DOM.appendNewElement("h3", el, `Midrif:`); + /* Fat*/ + // <div> + if (slave.indentureRestrictions >= 2 && slave.weight > 30) { + r.push(`<span class="note">${His} indenture forbids elective surgery</span>`); + } else if (slave.weight > 30) { + if (slave.weight > 190) { + r.push(`${He} is extremely fat.`); + // [[Major liposuction|Surgery Degradation][surgeryDamage(getSlave(${V.AS)},40), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "liposuction"]]; + } else if (slave.weight > 130) { + r.push(`${He} is fat.`); + // [[Heavy liposuction|Surgery Degradation][surgeryDamage(getSlave(${V.AS)},20), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "liposuction"]]; + } else if (slave.weight > 30) { + r.push(`${He} is overweight.`); + // [[Liposuction|Surgery Degradation][surgeryDamage(getSlave(${V.AS)},10), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "liposuction"]]; + } + if (V.surgeryUpgrade === 1) { + // | [[Fat grafting|Fat Grafting][surgeryDamage(slave,40), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave)*2, V.surgeryType = "fat graft"]] + } + } + // </div> + + /* Also fat*/ + // <div> + r.push(`${He} has`); + if (slave.waist > 95) { + r.push(`a masculine`); + } else if (slave.waist > 40) { + r.push(`an ugly`); + } else if (slave.waist > 10) { + r.push(`an unattractive`); + } else if (slave.waist >= -10) { + r.push(`an average`); + } else if (slave.waist >= -40) { + r.push(`a feminine`); + } else if (slave.waist >= -95) { + r.push(`an hourglass`); + } else { + r.push(`an absurd`); + } + r.push(`waist.`); + if (slave.waist >= -75) { + if (slave.indentureRestrictions < 2) { + // [[Liposuction|Surgery Degradation][slave.waist -= 20,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "lipo"]] + } + } + if (slave.waist >= -95 && slave.waist < -75 && V.seeExtreme === 1) { + if (slave.indentureRestrictions < 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) { + // [["Remove ribs to severely narrow " + ${his} + " waist"|Surgery Degradation][slave.waist = -100,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,40),V.surgeryType = "ribs"]] + } + } + // </div> + + /* Belly*/ + // <div> + r.push(`${He}'s`); + if (slave.pregKnown > 0) { + r.push(`pregnant.`); + } else if (slave.womb.length === 0 && slave.broodmother > 0) { + r.push(`got a dormant broodmother implant in ${his} womb.`); + } else if (slave.preg > 0) { + r.push(`showing unusual discomfort as ${his} stomach is inspected. A quick test reveals that <span class="lime">${he} is pregnant.</span>`); + slave.pregKnown = 1; + } else if (slave.bellyImplant > 0) { + r.push(`got a ${slave.bellyImplant}cc implant filled implant located in ${his} abdomen.`); + if (slave.cervixImplant === 1 ) { + r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`); + } else if (slave.cervixImplant === 2) { + r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`); + } else if (slave.cervixImplant === 3) { + r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`); + } + } else if (slave.bellyFluid >= 1500) { + r.push(`got a ${slave.inflationType}-filled implant located in ${his} abdomen.`); + + if (slave.cervixImplant === 1 ) { + r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`); + } else if (slave.cervixImplant === 2) { + r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`); + } else if (slave.cervixImplant === 3) { + r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`); + } + } else if (slave.bellyImplant === 0) { + r.push(`got an empty fillable implant located in ${his} abdomen.`); + if (slave.cervixImplant === 1 ) { + r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`); + } else if (slave.cervixImplant === 2) { + r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`); + } else if (slave.cervixImplant === 3) { + r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`); + } + } else { + r.push(`got a normal stomach.`); + } + // <div class="choices"> + if (slave.indentureRestrictions >= 2) { + r.push(`<span class="note">${His} indenture forbids elective surgery</span>`); + } else if (slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset") { + r.push(`<span class="note">You are forbidden from affecting ${his} fertility</span>`); + } else if (slave.preg > 0 || slave.inflation > 0 || slave.broodmother > 0) { + r.push(`<span class="note">${He} is unable to support an abdominal implant at this time</span>`); + } else if (slave.bellyImplant >= 750000) { + r.push(`<span class="note">${His} abdominal implant is so far beyond its maximum limit it is at risk of rupturing</span>`); + } else if (slave.bellyImplant >= 600000) { + r.push(`<span class="note">${His} abdominal implant is greatly beyond its maximum limit</span>`); + } else if (slave.bellyImplant >= 450000) { + r.push(`<span class="note">${His} abdominal implant is over-filled</span>`); + } else if (slave.bellyImplant >= 400000) { + r.push(`<span class="note">${His} abdominal implant is at its capacity</span>`); + } else if (slave.bellyImplant > 130000 && V.arcologies[0].FSTransformationFetishistResearch !== 1) { + r.push(`<span class="note">${His} abdominal implant is at its capacity</span>`); + } else if (slave.bellyImplant === -1 && (slave.ovaries === 1 || slave.mpreg === 1) && V.bellyImplants === 1) { + // [[Implant fillable abdominal implant|Surgery Degradation][slave.bellyImplant = 0,slave.preg = -2, slave.bellyPain += 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "bellyIn"]] + } else if (slave.bellyImplant === -1 && V.bellyImplants === 1) { + // [[Implant a fillable abdominal implant|Surgery Degradation][slave.bellyImplant = 0, cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), slave.bellyPain += 2, surgeryDamage(slave,50), V.surgeryType = "bellyInMale"]] + } else if (slave.bellyPain === 2) { + r.push(`<span class="note">${His} body cannot handle more filler this week</span>`); + } else if (slave.bellyImplant > -1 && slave.bellyPain === 0) { + // [[Add inert filler|Surgery Degradation][slave.bellyImplant += 200, slave.bellyPain += 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10),V.surgeryType = "bellyUp"]] + // | [[Add a considerable amount of inert filler|Surgery Degradation][slave.bellyImplant += 500, slave.bellyPain += 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,20),V.surgeryType = "bellyUp"]] + } else if (slave.bellyImplant > -1 && slave.bellyPain === 1) { + // [[Add more inert filler|Surgery Degradation][slave.bellyImplant += 200, slave.bellyPain += 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,30),V.surgeryType = "bellyUp"]] + // | [[Add a considerable amount of inert filler|Surgery Degradation][slave.bellyImplant += 500, slave.bellyPain += 1,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,40),V.surgeryType = "bellyUp"]] + if (slave.health.health < 0) { + r.push(`<span class="note red">This may cause severe health issues</span>`); + } + } + if (slave.bellyImplant > -1) { + // | [[Drain implant|Surgery Degradation][slave.bellyImplant -= 200,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,5), V.surgeryType = "bellyDown"]] + if (slave.bellyImplant >= 500) { + // | [[Greatly drain implant|Surgery Degradation][slave.bellyImplant -= 500, surgeryDamage(slave,5),cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "bellyDown"]] + } + if (slave.indentureRestrictions < 2) { + // | [[Remove implant|Surgery Degradation][slave.bellyImplant = -1, slave.cervixImplant = 0, cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,10), V.surgeryType = "bellyOut"]] + if (slave.cervixImplant !== 1 && slave.cervixImplant !== 3 && V.cervixImplants >= 1 && slave.vagina > -1) { + /* slave should have vagina */ + // <div> + // [[Install cervix micropump filter|Surgery Degradation][slave.cervixImplant = (slave.cervixImplant==0?1:3), surgeryDamage(slave, 5), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "cervixPump"]] + r.push(`<span class="note">Will allow ${his} belly implant to slowly swell as people cum in ${his} vagina</span>`); + // </div> + } + if (slave.cervixImplant !== 2 && slave.cervixImplant !== 3 && V.cervixImplants === 2) { + // <div> + // [[Install rectal micropump filter|Surgery Degradation][slave.cervixImplant = (slave.cervixImplant==0?2:3), surgeryDamage(slave, 20), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "cervixPumpA"]] + r.push(`<span class="note">Will allow ${his} belly implant to slowly swell as people cum in ${his} anus</span>`); + // </div> + } + } + } + // </div> + // </div> + + /* Uterine Implants */ + // <div> + if (slave.wombImplant === "none" && (V.UterineRestraintMesh === 1) && (slave.ovaries === 1 || slave.mpreg === 1)) { + r.push(`${He} has a normal uterus`); + if (slave.mpreg === 1) { + r.push(`, though slightly repositioned`); + } + r.push(`.`); + if (slave.indentureRestrictions >= 1) { + r.push(`<span class="note">${His} indenture forbids invasive elective surgery</span>`); + } else if (slave.bellyImplant > 0 || slave.preg > 0) { + r.push(`<span class="note">${His} womb is currently in use and unsafe to operate on</span>`); + } else { + if (V.surgeryUpgrade === 1) { + if (V.UterineRestraintMesh === 1) { + // [[Install reinforcing organic mesh|Surgery Degradation][slave.wombImplant = "restraint", surgeryDamage(slave,25), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "womb"]] + } + } + } + } else if (slave.wombImplant === "restraint") { + r.push(`${He} has a mesh reinforced uterus.`); + if (slave.indentureRestrictions >= 1) { + r.push(`<span class="note">${His} indenture forbids invasive elective surgery</span>`); + } else if (slave.bellyImplant > 0 || slave.preg > 0) { + r.push(`<span class="note">${His} womb is currently in use and unsafe to operate on</span>`); + } else { + // [[Remove organic mesh|Surgery Degradation][slave.wombImplant = "none", surgeryDamage(slave,50), cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), V.surgeryType = "womb"]] + if (slave.health.health < 0) { + r.push(`<span class="note red">This may cause severe health issues</span>`); + } + } + } + // </div> + + /* Belly sag*/ + // <div> + if (slave.bellySagPreg > 0) { + if (slave.belly >= 1500) { + r.push(`${He} has a sagging midriff, ruined from excessive pregnancy. It is currently filled out by ${his} swollen belly and cannot safely be worked on.`); + } else { + r.push(`${He} has a sagging midriff, ruined from excessive pregnancy.`); + // [[Tummy tuck|Surgery Degradation][slave.bellySag = 0,slave.bellySagPreg = 0,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,20),V.surgeryType = "tummyTuck"]] + } + } else if (slave.bellySag > 0) { + if (slave.belly >= 1500) { + r.push(`${He} has a sagging midriff, ruined from excessive distention. It is currently filled out by ${his} swollen belly and cannot safely be worked on.`); + } else { + r.push(`${He} has a sagging midriff, ruined from excessive distention.`); + // [[Tummy tuck|Surgery Degradation][slave.bellySag = 0,slave.bellySagPreg = 0,cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave), surgeryDamage(slave,20),V.surgeryType = "tummyTuck"]] + } + } + // </div> + + return el; + } + + /** + * + * @param {string} title + * @param {string} surgeryType + * @param {function(void):void} [func] + * @param {number} [costMult=1] + * @returns {HTMLAnchorElement} + */ + function makeLink(title, surgeryType, func, costMult = 1) { + const cost = Math.trunc(V.surgeryCost * costMult); + return App.UI.DOM.link( + title, + () => { + if (typeof func === "function") { + func(); + } + if (cheat) { + jQuery(container).empty().append(content()); + } else { + V.surgeryType = surgeryType; + // TODO: pass if it affected health or not? + cashX(forceNeg(cost), "slaveSurgery", slave); + Engine.play("Surgery Degradation"); + } + }, + [], + "", + `Costs ${cashFormat(cost)}` + ); + } +}; diff --git a/src/npc/surgery/surgery.js b/src/npc/surgery/surgery.js index 4777bc268a2e2e0c4e56966a2663940ffbacd767..6c7ab79e59fa35ed9de98f477bf12fd3a6816431 100644 --- a/src/npc/surgery/surgery.js +++ b/src/npc/surgery/surgery.js @@ -90,11 +90,11 @@ App.Medicine.Surgery.commit = function(surgery, slave, cheat = false) { * @param {FC.Medicine.Surgery.Procedure} surgery * @param {App.Entity.SlaveState} slave * @param {boolean} [cheat] - * @returns {string} + * @returns {HTMLElement} */ App.Medicine.Surgery.makeLink = function(passage, surgery, slave, cheat = false) { if (surgery.action === undefined) { - return App.UI.disabledLink(surgery.label, [surgery.description]); + return App.UI.DOM.disabledLink(surgery.label, [surgery.description]); } function healthCosts() { @@ -111,7 +111,7 @@ App.Medicine.Surgery.makeLink = function(passage, surgery, slave, cheat = false) return 'insignificant'; } - return App.UI.link(surgery.label, App.Medicine.Surgery.commit, [surgery, slave], passage, + return App.UI.DOM.link(surgery.label, App.Medicine.Surgery.commit, [surgery, slave], passage, `${capFirstChar(surgery.description)}.${cheat ? `` : `\nSurgery costs: ${cashFormat(surgery.costs)}.\nProjected health damage: ${healthCosts()}.`}`); };