diff --git a/src/endWeek/saPregnancy.js b/src/endWeek/saPregnancy.js index 49aefc0cd370484cf8ca7eee0129f98cc45fd473..27a9ec37ebcbca22129b9e8d514611966efcce1b 100644 --- a/src/endWeek/saPregnancy.js +++ b/src/endWeek/saPregnancy.js @@ -109,7 +109,7 @@ App.SlaveAssignment.pregnancy = (function() { * */ function pregnancyLibido(slave) { - if (slave.geneticQuirks.uterineHypersensitivity === 2 && $geneticMappingUpgrade >= 1) { + if (slave.geneticQuirks.uterineHypersensitivity === 2 && V.geneticMappingUpgrade >= 1) { if (slave.preg >= slave.pregData.normalBirth) { r.push(`${He}'s full-term and has never been hornier. ${His} uterine hypersensitivity combined with ${his} full womb and upcoming birth confers a <span class="improvement">huge improvement in ${his} sexual appetite.</span>`); slave.energy += 7; @@ -322,7 +322,7 @@ App.SlaveAssignment.pregnancy = (function() { r.push(`${He} can't help but feel <span class="trust inc">proud</span> over the life you helped conceive and the future generation of Futanari Sisters.`); slave.devotion += 1; } - if (slave.devotion > 20 && $arcologies[0].FSRepopulationFocus !== "unset" && slave.sexualQuirk === "motherly") { + if (slave.devotion > 20 && V.arcologies[0].FSRepopulationFocus !== "unset" && slave.sexualQuirk === "motherly") { r.push(`${His} pregnancy fills ${him} with <span class="devotion inc">joyful pride,</span> since ${he} is surrounded by those that share ${his} values on having children.`); slave.devotion += 1; } @@ -440,7 +440,7 @@ App.SlaveAssignment.pregnancy = (function() { slave.devotion += 10; } else if (slave.geneticQuirks.uterineHypersensitivity === 2) { r.push(`${He} is <span class="improvement">extremely aroused</span> over ${his} straining womb.`); - if (geneticMappingUpgrade >= 1) { + if (V.geneticMappingUpgrade >= 1) { r.push(`${His} hypersensitive uterus is overstimulated by the pressure, clouding both pain and worry from ${his} mind.`); } else { r.push(`Every week ${he} gets bigger, fuller, tighter, and, strangely enough, hornier. It's unclear why ${he} is this way, but it distracts ${him} from worrying at least.`); @@ -463,7 +463,7 @@ App.SlaveAssignment.pregnancy = (function() { } } else if (slave.geneticQuirks.uterineHypersensitivity === 2) { r.push(`${He} is <span class="improvement">extremely aroused</span> over ${his} straining womb.`); - if (geneticMappingUpgrade >= 1) { + if (V.geneticMappingUpgrade >= 1) { r.push(`${His} hypersensitive uterus is overstimulated by the pressure, clouding both pain and worry from ${his} mind.`); } else { r.push(`Every week ${he} gets bigger, fuller, tighter, and, strangely enough, hornier. It's unclear why ${he} is this way, but it distracts ${him} from worrying at least.`); @@ -481,7 +481,7 @@ App.SlaveAssignment.pregnancy = (function() { break; case "labor suppressors": if (slave.geneticQuirks.uterineHypersensitivity === 2 && slave.counter.birthsTotal > 0) { - if (geneticMappingUpgrade >= 1) { + if (V.geneticMappingUpgrade >= 1) { r.push(`Birth is incredibly pleasurable to ${him} due to ${his} uterine hypersensitivity, filling ${him} with <span class="trust dec">fear</span> and <span class="devotion dec">loathing</span> that ${he} won't be allowed to reach that high again.`); } else { r.push(`${He} is filled with unwarranted <span class="trust dec">paranoia</span> and <span class="devotion dec">hate</span> over you delaying ${his} upcoming birth.`); @@ -1608,14 +1608,7 @@ App.SlaveAssignment.pregnancy = (function() { } } if (StudVaginal) { - if (Stud.vagina >= 0) { - seX(Stud, "vaginal", 10); - } - if (slave.mpreg === 1) { - seX(slave, "anal", 10); - } else { - seX(slave, "vaginal", 10); - } + seX(Stud, "vaginal", slave, slave.mpreg === 1 ? "anal" : "vaginal", 10); } } } else if (conceptionSeed > (50 - (V.reproductionFormula * 10))) { @@ -1658,12 +1651,11 @@ App.SlaveAssignment.pregnancy = (function() { slave.pregType = setPregType(slave); WombImpregnate(slave, slave.pregType, -1, 1); } else { // look for a random father among master suite slaves - let msSlaves = V.slaves.filter((s) => s.assignment === "serve in the master suite"); - msSlaves = msSlaves.shuffle(); - for (let m = 0; m < msSlaves.length; m++) { - if (canImpreg(slave, msSlaves[m]) && App.Utils.sexAllowed(slave, msSlaves[m])) { + const msSlaves = V.slaves.filter((s) => s.assignment === "serve in the master suite").shuffle(); + for (const msSlave of msSlaves) { + if (canImpreg(slave, msSlave) && App.Utils.sexAllowed(slave, msSlave)) { /* catch for self-impregnation */ - if (slave.ID === msSlaves[m].ID) { + if (slave.ID === msSlave.ID) { if (conceptionSeed <= 95) { continue; /* 95% chance not to self-impregnate */ } @@ -1671,7 +1663,7 @@ App.SlaveAssignment.pregnancy = (function() { /* found eligible father */ r.push(`After all the unprotected sex ${he} had this week, it's really no surprise when <span class="pregnant">${he} ends up pregnant.</span>`); slave.preg = 1; - slave.pregSource = msSlaves[m].ID; + slave.pregSource = msSlave.ID; slave.pregWeek = 1; slave.pregKnown = 1; slave.pregType = setPregType(slave); @@ -1739,25 +1731,12 @@ App.SlaveAssignment.pregnancy = (function() { default: /* random impregnation chance on other assignments - consider relationships first */ if (App.Utils.hasNonassignmentSex(slave) || slave.devotion <= 50) { if (conceptionSeed > 80 && ((slave.counter.vaginal > 0) || (slave.counter.anal > 0 && slave.mpreg > 0))) { /* TODO: compare to previous week totals? */ - if (slave.relationshipTarget > 0) { - const tempLover = getSlave(slave.relationshipTarget); - if (!tempLover) { - r.push(`<span class="error">Error, relationshipTarget not found.</span>`); - } - } else if (slave.rivalryTarget > 0) { - const tempRival = getSlave(slave.rivalryTarget); - if (!tempRival) { - r.push(`<span class="error">Error, rivalryTarget not found.</span>`); - } - } else if (slave.subTarget > 0) { - const tempSub = getSlave(slave.subTarget); - if (!tempSub) { - r.push(`<span class="error">Error, subTarget not found.</span>`); - } - } + const tempLover = slave.relationship > 2 ? getSlave(slave.relationshipTarget) : null; + const tempRival = slave.rivalry > 2 ? getSlave(slave.rivalryTarget) : null; + const tempSub = slave.assignment === Job.SUBORDINATE && slave.subTarget > 0 ? getSlave(slave.subTarget) : null; if (((slave.relationship === -3) || (slave.relationship === -2)) && canImpreg(slave, V.PC) && App.Utils.sexAllowed(slave, V.PC)) { slave.pregSource = -1; - } else if (slave.relationship > 2 && canImpreg(slave, tempLover)) { /* erection not needed for impregnation via consensual sex play (FWB or better) */ + } else if (tempLover && canImpreg(slave, tempLover)) { /* erection not needed for impregnation via consensual sex play (FWB or better) */ if (App.Utils.sexAllowed(slave, tempLover)) { slave.pregSource = tempLover.ID; } else if (disobedience(slave) + disobedience(tempLover) + 5 > random(0, 100)) { /* note higher than normal disobedience chance...telling lovers they can't play is just asking for trouble */ @@ -1766,9 +1745,9 @@ App.SlaveAssignment.pregnancy = (function() { tempLover.trust -= 5; slave.pregSource = tempLover.ID; } - } else if (slave.subTarget !== 0 && slave.assignment === "be a subordinate slave" && canAchieveErection(tempSub) && canImpreg(slave, tempSub)) { /* subordinate must have erection to impregnate target */ + } else if (tempSub && canAchieveErection(tempSub) && canImpreg(slave, tempSub)) { /* subordinate must have erection to impregnate target */ slave.pregSource = tempSub.ID; - } else if (random(1, 100) > 95 && slave.rivalry > 2 && canAchieveErection(tempRival) && canImpreg(slave, tempRival)) { /* 5% chance to be raped and knocked up by bitter rival - erection needed */ + } else if (random(1, 100) > 95 && tempRival && canAchieveErection(tempRival) && canImpreg(slave, tempRival)) { /* 5% chance to be raped and knocked up by bitter rival - erection needed */ if (App.Utils.sexAllowed(slave, tempRival)) { r.push(`Driven by the bitter rivalry between them, ${tempRival.slaveName} successfully manages to overpower ${slave.slaveName} and rape ${him}, cumming deep in ${his} fertile`); if (slave.mpreg === 1) { @@ -1793,38 +1772,27 @@ App.SlaveAssignment.pregnancy = (function() { } else if (random(1, 100) > 95 && slave.eggType === "human" && slave.devotion <= 20) { /* 5% chance of impregnation by random citizen - TODO: make this optional for players who want random fathers from among their own slaves only */ slave.pregSource = -2; } else { - /* pick a random starting point in the slave array and iterate (wrapping around) until finding eligible father or coming back to starting point */ - let sourceSeed = random(0, V.slaves.length - 1); - let tried = 0; - let disobedienceSeed = disobedience(slave); - for (let saP = sourceSeed + 1; saP !== sourceSeed; saP++) { - if (saP === V.slaves.length) { /* wrap around */ - saP = 0; - tried = 1; - } - if (saP === sourceSeed + 1 && tried === 1) { /* give up after a full loop */ + const potentialFathers = V.slaves.filter(s => canImpreg(slave, s)).shuffle(); + const motherDisobeys = disobedience(slave) > random(0, 100); + for (const father of potentialFathers) { + if (father.ID === slave.ID) { /* self-impregnation check */ + if (conceptionSeed <= 5) { /* 95% chance not to self-impregnate */ + slave.pregSource = slave.ID; + break; + } + } else if (App.Utils.sexAllowed(slave, father)) { + slave.pregSource = father.ID; /* this is an eligible father */ break; - } - if (canImpreg(slave, V.slaves[saP])) { - if (V.slaves[saP].ID === slave.ID) { /* self-impregnation check */ - if (conceptionSeed <= 95) { - continue; /* 95% chance not to self-impregnate */ - } else { - slave.pregSource = slave.ID; - } - } else if (App.Utils.sexAllowed(slave, V.slaves[saP])) { - slave.pregSource = V.slaves[saP].ID; /* this is an eligible father */ - } else if (disobedienceSeed > random(0, 100) && (V.universalRulesConsent === 0 || disobedience(V.slaves[saP]) > random(0, 50))) { - r.push(`Although sexual contact between them is forbidden, ${slave.slaveName} <span class="trust dec">breaks the rules</span> by`); - if (V.universalRulesConsent === 0) { - r.push(`compelling`); - } else { - r.push(`convincing`); - } - r.push(`${V.slaves[saP]} to fuck ${him}.`); - slave.trust -= 5; - slave.pregSource = V.slaves[saP].ID; + } else if (motherDisobeys && (V.universalRulesConsent === 0 || disobedience(father) > random(0, 50))) { + r.push(`Although sexual contact between them is forbidden, ${slave.slaveName} <span class="trust dec">breaks the rules</span> by`); + if (V.universalRulesConsent === 0) { + r.push(`compelling`); + } else { + r.push(`convincing`); } + r.push(`${father.slaveName} to fuck ${him}.`); + slave.trust -= 5; + slave.pregSource = father.ID; break; } } @@ -1850,7 +1818,7 @@ App.SlaveAssignment.pregnancy = (function() { function autoImpregnation(slave) { knockMeUp(slave, 100, 2, slave.ID, true); if (slave.geneticQuirks.superfetation === 2 && slave.pregKnown === 1) { - if (geneticMappingUpgrade !== 0) { + if (V.geneticMappingUpgrade !== 0) { r.push(`${He} experiences frequent spontaneous orgasms from ${his} asexual reproduction modification despite already being pregnant.`); } else { r.push(`Since ${he} is fertile and pregnant, the frequent orgasms caused by ${his} asexual reproduction modifications eventually force <span class="pregnant">another child into ${his} increasingly crowded womb.</span>`);