From a3b0c48a2d286ad5827d7842bd6e9793afbe1a79 Mon Sep 17 00:00:00 2001 From: ezsh <ezsh.junk@gmail.com> Date: Sat, 4 Feb 2023 13:03:42 +0100 Subject: [PATCH] Use App.Medicine.fleshSize() instead of in-place computations --- js/medicine/utility.js | 6 ++++-- src/data/backwardsCompatibility/datatypeCleanup.js | 2 +- src/endWeek/player/prDiet.js | 4 ++-- src/endWeek/player/prHormones.js | 4 ++-- src/endWeek/player/prLongTermEffects.js | 2 +- src/endWeek/player/prLongTermPhysicalEffects.js | 9 +++++---- src/endWeek/player/prPregnancy.js | 4 ++-- src/endWeek/reports/clinicReport.js | 2 +- src/endWeek/saDiet.js | 4 ++-- src/endWeek/saDrugs.js | 4 ++-- src/endWeek/saHormonesEffects.js | 4 ++-- src/endWeek/saLongTermEffects.js | 2 +- src/endWeek/saLongTermMentalEffects.js | 2 +- src/endWeek/saLongTermPhysicalEffects.js | 5 +++-- src/endWeek/saPregnancy.js | 4 ++-- src/events/RE/reLegendaryCow.js | 2 +- src/facilities/surgery/surgeryPassageUpper.js | 2 +- src/interaction/siPhysicalRegimen.js | 2 +- src/js/pregJS.js | 4 +++- src/js/storyJS.js | 2 +- src/npc/interaction/passage/fSlaveImpreg.js | 4 ++-- src/player/managePersonalAffairs.js | 2 +- 22 files changed, 41 insertions(+), 35 deletions(-) diff --git a/js/medicine/utility.js b/js/medicine/utility.js index 07682ad63cc..e4bffc8382e 100644 --- a/js/medicine/utility.js +++ b/js/medicine/utility.js @@ -102,7 +102,9 @@ App.Medicine.implantTypesForTarget = function(target) { /** * Returns the size of the flesh part of the sizable body part - * @param {FC.SlaveState} slave + * + * "Flesh" means without implants and without milk in case of boobs + * @param {FC.HumanState} slave * @param {FC.SizableBodyPart} part * @returns {number} */ @@ -118,7 +120,7 @@ App.Medicine.fleshSize = function(slave, part) { /** * Returns the size of the flesh part of the sizable body part - * @param {FC.SlaveState} slave + * @param {FC.HumanState} slave * @param {FC.SizableBodyPart} part * @returns {number} */ diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js index 8ee0bac518a..54848cc5fba 100644 --- a/src/data/backwardsCompatibility/datatypeCleanup.js +++ b/src/data/backwardsCompatibility/datatypeCleanup.js @@ -578,7 +578,7 @@ globalThis.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { } slave.lactation = Math.clamp(+slave.lactation, 0, 2) || 0; slave.boobsMilk = Math.max(+slave.boobsMilk, 0) || 0; - if (slave.boobsMilk > 0 && slave.boobs - slave.boobsMilk - slave.boobsImplant < 0) { + if (slave.boobsMilk > 0 && App.Medicine.fleshSize(slave, 'boobs') < 0) { // should never get here, but if it does, just immediately abort! slave.boobsMilk = 0; } diff --git a/src/endWeek/player/prDiet.js b/src/endWeek/player/prDiet.js index f470ac257de..ce01e0b917e 100644 --- a/src/endWeek/player/prDiet.js +++ b/src/endWeek/player/prDiet.js @@ -9,8 +9,8 @@ App.EndWeek.Player.diet = function(PC = V.PC) { let weightGain; const gigantomastiaMod = PC.geneticQuirks.gigantomastia === 2 ? (PC.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; const rearQuirk = PC.geneticQuirks.rearLipedema === 2 ? 2 : 0; - const boobSize = PC.boobs - PC.boobsImplant - PC.boobsMilk; - const buttSize = PC.butt - PC.buttImplant; + const boobSize = App.Medicine.fleshSize(PC, 'boobs'); + const buttSize = App.Medicine.fleshSize(PC, 'butt'); const ballSize = PC.balls - PC.ballsImplant; if (canEatFood(PC)) { diff --git a/src/endWeek/player/prHormones.js b/src/endWeek/player/prHormones.js index f33394534f1..10b6f7a1d96 100644 --- a/src/endWeek/player/prHormones.js +++ b/src/endWeek/player/prHormones.js @@ -3,8 +3,8 @@ App.EndWeek.Player.hormones = function(PC, selfManufactured, hormonePower) { const gigantomastiaMod = PC.geneticQuirks.gigantomastia === 2 ? (PC.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; const rearLipedemaMod = PC.geneticQuirks.rearLipedema === 2 ? 1 : 0; - const boobSize = PC.boobs - PC.boobsImplant - PC.boobsMilk; - const buttSize = PC.butt - PC.buttImplant; + const boobSize = App.Medicine.fleshSize(PC, 'boobs'); + const buttSize = App.Medicine.fleshSize(PC, 'butt'); let normBreasts; let normButt; const faceValue = PC.face - PC.faceImplant; diff --git a/src/endWeek/player/prLongTermEffects.js b/src/endWeek/player/prLongTermEffects.js index 4ac5dea9dac..94e00fbd876 100644 --- a/src/endWeek/player/prLongTermEffects.js +++ b/src/endWeek/player/prLongTermEffects.js @@ -37,7 +37,7 @@ App.EndWeek.Player.longTermEffects = function(PC = V.PC) { return frag; function boobSize(PC) { - return PC.boobs - PC.boobsImplant - PC.boobsMilk; + return App.Medicine.fleshSize(PC, 'boobs'); } function asexualOvariesBurnout() { // This block needs to be reflected in PC.need generation. diff --git a/src/endWeek/player/prLongTermPhysicalEffects.js b/src/endWeek/player/prLongTermPhysicalEffects.js index 6085c7d5f93..86337259774 100644 --- a/src/endWeek/player/prLongTermPhysicalEffects.js +++ b/src/endWeek/player/prLongTermPhysicalEffects.js @@ -2,8 +2,8 @@ App.EndWeek.Player.longTermPhysicalEffects = function(PC = V.PC) { const r = []; const gigantomastiaMod = PC.geneticQuirks.gigantomastia === 2 ? (PC.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; - const boobSize = PC.boobs - PC.boobsImplant - PC.boobsMilk; - const buttSize = PC.butt - PC.buttImplant; + const boobSize = App.Medicine.fleshSize(PC, 'boobs'); + const buttSize = App.Medicine.fleshSize(PC, 'butt'); const faceValue = PC.face - PC.faceImplant; const averageDicking = V.slaves.filter(s => canAchieveErection(s) && isSlaveAvailable(s) && ((V.policies.sexualOpenness === 1 && s.devotion > 20 && App.Utils.sexAllowed(V.PC, s)) || s.toyHole === "dick")); const isNull = PC.dick === 0 && PC.vagina === -1; @@ -836,10 +836,11 @@ App.EndWeek.Player.longTermPhysicalEffects = function(PC = V.PC) { } if (PC.lactation === 1) { if (PC.boobsMilk > 0) { - if (PC.boobs - PC.boobsImplant + PC.boobsMilk > PC.boobs - PC.boobsImplant * 2) { + const milkToFleshRatio = PC.boobsMilk / App.Medicine.fleshSize(PC, 'boobs'); + if (milkToFleshRatio > 2) { r.push(`Your breasts <span class="health dec">feel like they are going to explode with milk.</span> Spending the week like this is excruciating,`); healthDamage(PC, 20); - } else if (PC.boobs - PC.boobsImplant + PC.boobsMilk > PC.boobs - PC.boobsImplant * .5) { + } else if (milkToFleshRatio > 0.5) { r.push(`Having breasts so swollen with milk that every motion hurts is <span class="health dec">very unpleasant.</span> Spending a week like this only makes it worse,`); healthDamage(PC, 5); } else { diff --git a/src/endWeek/player/prPregnancy.js b/src/endWeek/player/prPregnancy.js index eceaf20e706..ddfd2ed5eb8 100644 --- a/src/endWeek/player/prPregnancy.js +++ b/src/endWeek/player/prPregnancy.js @@ -4,9 +4,9 @@ App.EndWeek.Player.pregnancy = function(PC = V.PC) { const gigantomastiaMod = PC.geneticQuirks.gigantomastia === 2 ? (PC.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; const rearQuirk = PC.geneticQuirks.rearLipedema === 2 ? 2 : 0; const uterineHypersensitivityMod = PC.geneticQuirks.uterineHypersensitivity === 2 ? 2 : 1; - const boobSize = PC.boobs - PC.boobsImplant - PC.boobsMilk; + const boobSize = App.Medicine.fleshSize(PC, 'boobs'); const oldBoobs = PC.boobs; - const buttSize = PC.butt - PC.buttImplant; + const buttSize = App.Medicine.fleshSize(PC, 'butt'); const hipSize = PC.hips - PC.hipsImplant; const child = (PC.pregType > 1 ? "children" : "child"); diff --git a/src/endWeek/reports/clinicReport.js b/src/endWeek/reports/clinicReport.js index 731070c1306..8f1b20dc11f 100644 --- a/src/endWeek/reports/clinicReport.js +++ b/src/endWeek/reports/clinicReport.js @@ -150,7 +150,7 @@ App.EndWeek.clinicReport = function() { } break; case "$He is remembered for winning best in show as a dairy cow.": - if (slave.lactation > 0 && (slave.boobs - slave.boobsImplant - slave.boobsMilk) > 6000) { + if (slave.lactation > 0 && App.Medicine.fleshSize(slave, 'boobs') > 6000) { r.push(`${He} does ${his} best to aid the leaking ${slave.slaveName}, paying special attention to ${his2} huge breasts as well as making sure to milk ${him2} hourly.`); improveCondition(slave, 4); slave.lactationDuration = 2; diff --git a/src/endWeek/saDiet.js b/src/endWeek/saDiet.js index 956fdc75980..be8cab39825 100644 --- a/src/endWeek/saDiet.js +++ b/src/endWeek/saDiet.js @@ -8,8 +8,8 @@ App.SlaveAssignment.diet = function saDiet(slave) { const gigantomastiaMod = slave.geneticQuirks.gigantomastia === 2 ? (slave.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; const rearQuirk = slave.geneticQuirks.rearLipedema === 2 ? 2 : 0; - const boobSize = slave.boobs - slave.boobsImplant - slave.boobsMilk; - const buttSize = slave.butt - slave.buttImplant; + const boobSize = App.Medicine.fleshSize(slave, 'boobs'); + const buttSize = App.Medicine.fleshSize(slave, 'butt'); let growthGoal; let roll; diff --git a/src/endWeek/saDrugs.js b/src/endWeek/saDrugs.js index 5395ab1892f..c03bba400e0 100644 --- a/src/endWeek/saDrugs.js +++ b/src/endWeek/saDrugs.js @@ -9,8 +9,8 @@ App.SlaveAssignment.drugs = function saDrugs(slave) { slave.drugs === "intensive penis enhancement" || slave.drugs === "intensive testicle enhancement") ? 1 : 0; const gigantomastiaMod = slave.geneticQuirks.gigantomastia === 2 ? (slave.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; const rearLipedemaMod = slave.geneticQuirks.rearLipedema === 2 ? 1 : 0; - const boobSize = slave.boobs - slave.boobsImplant - slave.boobsMilk; - const buttSize = slave.butt - slave.buttImplant; + const boobSize = App.Medicine.fleshSize(slave, 'boobs'); + const buttSize = App.Medicine.fleshSize(slave, 'butt'); const { he, him, his, himself, He, His diff --git a/src/endWeek/saHormonesEffects.js b/src/endWeek/saHormonesEffects.js index b2894623bce..5603bca02f9 100644 --- a/src/endWeek/saHormonesEffects.js +++ b/src/endWeek/saHormonesEffects.js @@ -7,8 +7,8 @@ App.SlaveAssignment.hormonesEffects = function saHormonesEffects(slave) { const r = []; const gigantomastiaMod = slave.geneticQuirks.gigantomastia === 2 ? (slave.geneticQuirks.macromastia === 2 ? 3 : 2) : 1; const rearLipedemaMod = slave.geneticQuirks.rearLipedema === 2 ? 1 : 0; - const boobSize = slave.boobs - slave.boobsImplant - slave.boobsMilk; - const buttSize = slave.butt - slave.buttImplant; + const boobSize = App.Medicine.fleshSize(slave, 'boobs'); + const buttSize = App.Medicine.fleshSize(slave, 'butt'); const faceValue = slave.face - slave.faceImplant; const { diff --git a/src/endWeek/saLongTermEffects.js b/src/endWeek/saLongTermEffects.js index b55312fc156..68b43ec5d58 100644 --- a/src/endWeek/saLongTermEffects.js +++ b/src/endWeek/saLongTermEffects.js @@ -98,7 +98,7 @@ App.SlaveAssignment.longTermEffects = function saLongTermEffects(slave) { * */ function boobSize(slave) { - return slave.boobs - slave.boobsImplant - slave.boobsMilk; + return App.Medicine.fleshSize(slave, 'boobs'); } /** diff --git a/src/endWeek/saLongTermMentalEffects.js b/src/endWeek/saLongTermMentalEffects.js index eb876e32d32..48fba18bcc8 100644 --- a/src/endWeek/saLongTermMentalEffects.js +++ b/src/endWeek/saLongTermMentalEffects.js @@ -2057,7 +2057,7 @@ App.SlaveAssignment.longTermMentalEffects = function saLongTermMentalEffects(sla break; case "boobs": if (slave.sexualFlaw !== "breast growth") { - const boobSize = slave.boobs - slave.boobsImplant - slave.boobsMilk; + const boobSize = App.Medicine.fleshSize(slave, 'boobs'); if (slave.drugs === "breast injections" || slave.drugs === "intensive breast injections") { r.push(`${He} loves ${his} tits, and feeling them respond to drug injections starts to hold more fascination for ${him} than mere sex. <span class="paraphilia gain">${His} sexual identity is now dominated by ${his} swelling boobs.</span>`); slave.sexualFlaw = "breast growth"; diff --git a/src/endWeek/saLongTermPhysicalEffects.js b/src/endWeek/saLongTermPhysicalEffects.js index b8d38a68ea9..d0119f3be1b 100644 --- a/src/endWeek/saLongTermPhysicalEffects.js +++ b/src/endWeek/saLongTermPhysicalEffects.js @@ -1068,10 +1068,11 @@ App.SlaveAssignment.longTermPhysicalEffects = function saLongTermPhysicalEffects r.push(`engorged</span> with pent-up milk.`); */ /* I don't know where to put this since it happens at the tail end of endWeek now */ - if (slave.boobs - slave.boobsImplant + slave.boobsMilk > slave.boobs - slave.boobsImplant * 2) { + const milkToFleshRatio = slave.boobsMilk / App.Medicine.fleshSize(slave, 'boobs'); + if (milkToFleshRatio > 2) { r.push(`Having breasts bloated to the point of bursting is <span class="health dec">incredibly painful.</span> Spending a week like that is excruciating,`); healthDamage(slave, 20); - } else if (slave.boobs - slave.boobsImplant + slave.boobsMilk > slave.boobs - slave.boobsImplant * .5) { + } else if (milkToFleshRatio > .5) { r.push(`Having breasts so swollen with milk that every motion hurts is <span class="health dec">very uncomfortable.</span> Spending a week like that only makes it worse,`); healthDamage(slave, 5); } else { diff --git a/src/endWeek/saPregnancy.js b/src/endWeek/saPregnancy.js index c640eb0db0e..fffee9a4371 100644 --- a/src/endWeek/saPregnancy.js +++ b/src/endWeek/saPregnancy.js @@ -671,8 +671,8 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) { boobTarget *= gigantomastiaMod; boobTarget *= slimnessFoodMod; if (slave.geneMods.NCS === 0) { - const boobSize = slave.boobs - slave.boobsImplant - slave.boobsMilk; - const buttSize = slave.butt - slave.buttImplant; + const boobSize = App.Medicine.fleshSize(slave, 'boobs'); + const buttSize = App.Medicine.fleshSize(slave, 'butt'); const hipSize = slave.hips - slave.hipsImplant; if (slave.pregType >= 30 && (((slave.assignment === Job.CONCUBINE || slave.assignment === Job.MASTERSUITE) && V.masterSuitePregnancySlaveLuxuries === 1) || slave.diet === "high caloric")) { if (slave.weight <= 65) { diff --git a/src/events/RE/reLegendaryCow.js b/src/events/RE/reLegendaryCow.js index bac7d53233e..08393593e00 100644 --- a/src/events/RE/reLegendaryCow.js +++ b/src/events/RE/reLegendaryCow.js @@ -8,7 +8,7 @@ App.Events.RELegendaryCow = class RELegendaryCow extends App.Events.BaseEvent { (s) => s.devotion > 50, (s) => s.prestige === 0, (s) => s.lactation > 0, - (s) => (s.boobs - s.boobsImplant - s.boobsMilk) > 6000, // should probably have a milkAmount() check? + (s) => App.Medicine.fleshSize(s, 'boobs') > 6000, // should probably have a milkAmount() check? (s) => [Job.DAIRY, Job.MILKED].includes(s.assignment) ]]; } diff --git a/src/facilities/surgery/surgeryPassageUpper.js b/src/facilities/surgery/surgeryPassageUpper.js index 4fd3a04b348..889db8ac389 100644 --- a/src/facilities/surgery/surgeryPassageUpper.js +++ b/src/facilities/surgery/surgeryPassageUpper.js @@ -208,7 +208,7 @@ App.UI.surgeryPassageUpper = function(slave, refresh, cheat = false) { } else { if (slave.boobs - slave.boobsMilk < 500) { App.UI.DOM.appendNewElement("div", el, `${His} breasts are too small to support reshaping ${his} nipples to be penetratable`, ["choices", "note"]); - } else if (slave.boobs - slave.boobsImplant - slave.boobsMilk < 500) { + } else if (App.Medicine.fleshSize(slave, 'boobs') < 500) { App.UI.DOM.appendNewElement("div", el, `${His} implants are too large to support reshaping ${his} nipples to be penetratable`, ["choices", "note"]); } else if (slave.nipples !== "huge") { App.UI.DOM.appendNewElement("div", el, `${His} nipples are too small to be made fuckable`, ["choices", "note"]); diff --git a/src/interaction/siPhysicalRegimen.js b/src/interaction/siPhysicalRegimen.js index fa79ec52510..745258687b2 100644 --- a/src/interaction/siPhysicalRegimen.js +++ b/src/interaction/siPhysicalRegimen.js @@ -71,7 +71,7 @@ App.UI.SlaveInteract.physicalRegimen = function(slave, refresh) { // Breasts if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { - if ((slave.boobs - slave.boobsImplant - slave.boobsMilk) > 100) { + if (App.Medicine.fleshSize(slave, 'boobs') > 100) { breasts.push({text: `Reducers`, updateSlave: {drugs: `breast redistributors`}}); } else { breasts.push({text: `Reducers`, disabled: `Boobs are too small`}); diff --git a/src/js/pregJS.js b/src/js/pregJS.js index 124a613224e..730beb09091 100644 --- a/src/js/pregJS.js +++ b/src/js/pregJS.js @@ -473,7 +473,9 @@ globalThis.findFather = function(fatherID) { return father; }; -/* not to be used until that last part is defined. It may become slave.boobWomb.volume or some shit */ +/* not to be used until that last part is defined. It may become slave.boobWomb.volume or some shit + * TODO update App.Medicine.fleshSize() when boobsWombVolume comes unto existence +*/ /** * @param {App.Entity.SlaveState} slave * @returns {number} diff --git a/src/js/storyJS.js b/src/js/storyJS.js index 260ee07d444..b65b3c40540 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -150,7 +150,7 @@ globalThis.canFemImpreg = function(slave1, slave2) { */ globalThis.milkAmount = function(slave) { let milk; - let calcs = slave.boobs - slave.boobsImplant - slave.boobsMilk; + let calcs = App.Medicine.fleshSize(slave, 'boobs'); if (calcs > 40000) { milk = (158 + ((calcs - 40000) / 600)); } else if (calcs > 25000) { diff --git a/src/npc/interaction/passage/fSlaveImpreg.js b/src/npc/interaction/passage/fSlaveImpreg.js index 27b934ce639..76a732f536c 100644 --- a/src/npc/interaction/passage/fSlaveImpreg.js +++ b/src/npc/interaction/passage/fSlaveImpreg.js @@ -484,9 +484,9 @@ App.Interact.fSlaveImpreg = function(slave, impregnatrix) { r.push(`middle height,`); } - if ((slave.boobs + impregnatrix.boobs - slave.boobsImplant - impregnatrix.boobsImplant - impregnatrix.boobsMilk) > 1500) { + if (App.Medicine.fleshSize(slave, 'boobs') + App.Medicine.fleshSize(impregnatrix, 'boobs') > 1500) { r.push(`big-titted`); - } else if ((slave.boobs + impregnatrix.boobs - slave.boobsImplant - impregnatrix.boobsImplant - impregnatrix.boobsMilk) < 700) { + } else if (App.Medicine.fleshSize(slave, 'boobs') + App.Medicine.fleshSize(impregnatrix, 'boobs') < 700) { r.push(`flat-chested`); } else { r.push(`moderately-breasted`); diff --git a/src/player/managePersonalAffairs.js b/src/player/managePersonalAffairs.js index c8f8c97c3cd..f1d4b277260 100644 --- a/src/player/managePersonalAffairs.js +++ b/src/player/managePersonalAffairs.js @@ -1153,7 +1153,7 @@ App.UI.managePersonalAffairs = function() { } if (arcology.FSSlimnessEnthusiastResearch === 1) { if (PC.drugs !== "breast redistributors") { - if ((PC.boobs - PC.boobsImplant - PC.boobsMilk) > 100) { + if (App.Medicine.fleshSize(PC, 'boobs') > 100) { links.push(App.UI.DOM.link(`Breast redistributors`, () => { PC.drugs = "breast redistributors"; App.UI.DOM.replace(drugsDiv, drugs); -- GitLab