From 00b296fd64130086c156f34064f2a073528cbdcd Mon Sep 17 00:00:00 2001
From: humblesasquatch <humblesasquatch@gmail.com>
Date: Thu, 15 Dec 2022 01:09:31 -0500
Subject: [PATCH] Initial implementation of auto-impregnation of slaves with
 superfetation

---
 js/003-data/gameVariableData.js   |  1 +
 src/endWeek/saPregnancy.js        |  6 +++---
 src/interaction/universalRules.js | 11 +++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 0eb384e491d..283a4927fdf 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -217,6 +217,7 @@ App.Data.defaultGameStateVariables = {
 	universalRulesFacilityWork: 1,
 	universalRulesImmobileSlavesMaintainMuscles: 0,
 	universalRulesImpregnation: "none",
+	universalRulesSuperfetationImpregnation: 0,
 	universalRulesNewSlavesRA: 1,
 	useAccordion: 1,
 	useFSNames: 1,
diff --git a/src/endWeek/saPregnancy.js b/src/endWeek/saPregnancy.js
index ef80741b563..2b95fe6a2f8 100644
--- a/src/endWeek/saPregnancy.js
+++ b/src/endWeek/saPregnancy.js
@@ -882,7 +882,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) {
 		let StudPenetrative = 0;
 		let StudTakesV = 0;
 
-		if (V.universalRulesImpregnation === "PC" && canImpreg(slave, V.PC) && slave.pregKnown === 0 && slave.PCExclude !== 1) { // consider female X female PC impreg here!
+		if (V.universalRulesImpregnation === "PC" && canImpreg(slave, V.PC) && (slave.pregKnown === 0 || (V.universalRulesSuperfetationImpregnation === 1 && slave.geneticQuirks.superfetation === 2)) && slave.PCExclude !== 1) { // consider female X female PC impreg here!
 			r.push(`${slave.slaveName} is ripe for breeding, so you ejaculate inside ${him} often. When you bore of ${his} fertile`);
 			if (slave.mpreg === 1) {
 				r.push(`ass,`);
@@ -938,7 +938,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) {
 			}
 		} else if ((slave.vagina === 0 || (slave.anus === 0 && slave.mpreg > 0)) && !studIgnoresRules) {
 			// Skip virgins.
-		} else if (V.HeadGirlID !== 0 && slave.ID !== V.HeadGirlID && V.universalRulesImpregnation === "HG" && canPenetrate(S.HeadGirl) && slave.pregKnown === 0) {
+		} else if (V.HeadGirlID !== 0 && slave.ID !== V.HeadGirlID && V.universalRulesImpregnation === "HG" && canPenetrate(S.HeadGirl) && (slave.pregKnown === 0 || (V.universalRulesSuperfetationImpregnation === 1 && slave.geneticQuirks.superfetation === 2))) {
 			const {
 				he2, His2, his2, him2,
 			} = getPronouns(S.HeadGirl).appendSuffix('2');
@@ -1052,7 +1052,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) {
 					seX(slave, "vaginal", S.HeadGirl, "penetrative", 10);
 				}
 			}
-		} else if (Stud && slave.ID !== V.StudID && V.universalRulesImpregnation === "Stud" && slave.pregKnown === 0) {
+		} else if (Stud && slave.ID !== V.StudID && V.universalRulesImpregnation === "Stud" && (slave.pregKnown === 0 || (V.universalRulesSuperfetationImpregnation === 1 && slave.geneticQuirks.superfetation === 2))) {
 			const {
 				He2, he2, his2, him2, himself2,
 			} = getPronouns(Stud).appendSuffix('2');
diff --git a/src/interaction/universalRules.js b/src/interaction/universalRules.js
index f77c28bfe85..7d8255dfe21 100644
--- a/src/interaction/universalRules.js
+++ b/src/interaction/universalRules.js
@@ -216,6 +216,17 @@ App.UI.universalRules = function() {
 				.addValue("No", 0).off();
 		}
 
+		if (V.universalRulesImpregnation !== "none") {
+			options.addOption(`Further impregnate already-pregnant slaves with superfetation quirk.`, `universalRulesSuperfetationImpregnation`)
+				.addValue("Yes", 1).on()
+				.addValue("No", 0).off();
+			if (V.universalRulesSuperfetationImpregnation === 1) {
+				option.addComment(`Already-pregnant slaves with the superfetation quirk will be included in systematic impregnation.`)
+			} else {
+				option.addComment(`Already-pregnant slaves with the superfetation quirk will be ignored in systematic impregnation.`)
+			}
+		}
+
 		option = options.addOption(`Scan heavily pregnant slaves daily`, "universalRulesBirthing")
 			.addValue("Yes", 1).on()
 			.addValue("No", 0).off();
-- 
GitLab