From e165058d4e1314e9ec5b9793959d71e47943334f Mon Sep 17 00:00:00 2001 From: Pregmodder <pregmodder@gmail.com> Date: Thu, 15 Oct 2020 16:29:06 -0400 Subject: [PATCH] singleton completion --- src/endWeek/saLongTermEffects.js | 3 +++ src/js/wombJS.js | 21 +++++++++++++++------ src/npc/descriptions/belly/belly.js | 18 +++++++++++++++--- src/npc/descriptions/womb/pregnancy.js | 4 +++- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/endWeek/saLongTermEffects.js b/src/endWeek/saLongTermEffects.js index 5e3d8b1a2be..a0d1d773ac0 100644 --- a/src/endWeek/saLongTermEffects.js +++ b/src/endWeek/saLongTermEffects.js @@ -2333,6 +2333,9 @@ App.SlaveAssignment.longTermEffects = (function() { miscarriageChance *= 2; } } + if (slave.bellyPreg > WombGetFetalSizeSum(slave)) { + miscarriageChance *= 1 + Math.floor((slave.bellyPreg - WombGetFetalSizeSum(slave)) / 10000); + } miscarriageChance = Math.round(miscarriageChance); if (miscarriageChance > random(0, 100)) { const chance = random(1, 100); diff --git a/src/js/wombJS.js b/src/js/wombJS.js index 95a99995366..e1f912fb36b 100644 --- a/src/js/wombJS.js +++ b/src/js/wombJS.js @@ -350,8 +350,8 @@ globalThis.WombGetVolume = function(actor) { // most legacy code from pregJS.tw targetLen = targetData.size * targetData.rate; ft.volume = ((4 / 3) * (Math.PI) * (phi / 2) * (Math.pow((targetLen / 2), 3))); - wombSize += ft.volume; - // wombSize += ft.genetics.geneticQuirks.polyhydramnios === 2 ? ft.volume * 2 : ft.volume; + // wombSize += ft.volume; + wombSize += ft.genetics.geneticQuirks.polyhydramnios === 2 ? ft.volume * 2 : ft.volume; // oldVol = ((4 / 3) * (Math.PI) * (phi / 2) * (Math.pow((oldLen / 2), 3))); // for debug @@ -380,8 +380,8 @@ globalThis.WombGetVolume = function(actor) { // most legacy code from pregJS.tw actor.womb.forEach(ft => { targetData = getCurData(actor, ft.age); - wombSize += targetData.size * targetData.rate; - // wombSize += ft.genetics.geneticQuirks.polyhydramnios === 2 ? targetData.size * targetData.rate * 2 : targetData.size * targetData.rate; + // wombSize += targetData.size * targetData.rate; + wombSize += ft.genetics.geneticQuirks.polyhydramnios === 2 ? targetData.size * targetData.rate * 2 : targetData.size * targetData.rate; }); if (wombSize < 0) { // catch for strange cases, to avoid messing with outside code. @@ -399,8 +399,8 @@ globalThis.WombGetVolume = function(actor) { // most legacy code from pregJS.tw actor.womb.forEach(ft => { targetData = getCurData(actor, ft.age); - wombSize += targetData.size; - // wombSize += ft.genetics.geneticQuirks.polyhydramnios === 2 ? targetData.size * 2 : targetData.size; + // wombSize += targetData.size; + wombSize += ft.genetics.geneticQuirks.polyhydramnios === 2 ? targetData.size * 2 : targetData.size; }); if (wombSize < 0) { // catch for strange cases, to avoid messing with outside code. @@ -932,3 +932,12 @@ globalThis.WombGetLittersData = function(actor) { return data; }; + +// simple function used for splitting actual size from total size due to polyhydramnios. +globalThis.WombGetFetalSizeSum = function(actor) { + let sum = 0; + + actor.womb.forEach((ft) => sum += ft.volume); + + return sum; +}; \ No newline at end of file diff --git a/src/npc/descriptions/belly/belly.js b/src/npc/descriptions/belly/belly.js index 8f0dd4e6645..e1f59d1592c 100644 --- a/src/npc/descriptions/belly/belly.js +++ b/src/npc/descriptions/belly/belly.js @@ -1984,9 +1984,17 @@ App.Desc.belly = function(slave, {market, eventDescription} = {}) { if (slave.preg < 33) { r.push(`Given how far along ${he} is, ${he} is clearly having more than two.`); } else if (slave.preg < 42) { - r.push(`${He} is clearly full-term with twins.`); + if (slave.pregType === 1) { + r.push(`${He} looks full-term with twins, but is really only carrying one and an obscene amount of amniotic fluid.`); + } else { + r.push(`${He} is clearly full-term with twins.`); + } } else if (slave.pregType === 1) { - r.push(`${His} womb contains one single, massive child. There is little chance of ${him} giving birth to it.`); + if (WombGetFetalSizeSum(slave) < 30000) { + r.push(`${He} is ready to pop, literally; there is so much amniotic fluid around ${his} sole baby it is a wonder ${his} water hasn't broken yet.`); + } else { + r.push(`${His} womb contains one single, massive child. There is little chance of ${him} giving birth to it.`); + } } if (slave.bellyFluid >= 1500) { if (slave.inflationMethod === 2) { @@ -2070,7 +2078,11 @@ App.Desc.belly = function(slave, {market, eventDescription} = {}) { r.push(`and ${his} huge, drum-taut belly dominates ${his} frame.`); } if (slave.preg < 33) { - r.push(`Given how far along ${he} is, ${he} is clearly having multiples.`); + if (WombGetFetalSizeSum(slave) < 15000) { + r.push(`Despite ${his} size, ${he} is only having one; the rest of ${his} womb is filled with an abnormal amount of amniotic fluid.`); + } else { + r.push(`Given how far along ${he} is, ${he} is clearly having multiples.`); + } } else { r.push(`${He} is clearly full-term.`); } diff --git a/src/npc/descriptions/womb/pregnancy.js b/src/npc/descriptions/womb/pregnancy.js index 16facf1fe01..d9c04997111 100644 --- a/src/npc/descriptions/womb/pregnancy.js +++ b/src/npc/descriptions/womb/pregnancy.js @@ -548,6 +548,8 @@ App.Desc.pregnancy = function(slave, {market, eventDescription} = {}) { r.push(`<span class="pink">massively pregnant:</span> ${he}'s`); if (slave.pregType === 3) { r.push(`almost ready to give birth to triplets.`); + } else if (WombGetFetalSizeSum(slave) < 30000) { + r.push(`ready to give birth.`); } else { r.push(`ready to give birth to twins.`); } @@ -924,7 +926,7 @@ App.Desc.pregnancy = function(slave, {market, eventDescription} = {}) { } } } - if (slave.bellyPreg > (slave.pregAdaptation * 1000)) { + if (slave.bellyPreg > (slave.pregAdaptation * 1000) || (slave.preg > slave.pregData.normalBirth / 2 && slave.womb.find((ft) => ft.genetics.geneticQuirks.polyhydramnios === 2 && ft.age >= 20))) { r.push(`${He} is undergoing a <span class="red">high risk pregnancy.</span>`); } -- GitLab