From cac850f0aa355612a7f35a3a2d6ec5affb0d92ed Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Thu, 26 Dec 2019 20:53:24 -0500
Subject: [PATCH] birth fix

---
 src/pregmod/widgets/seBirthWidgets.tw | 85 ++++++++++++++-------------
 1 file changed, 44 insertions(+), 41 deletions(-)

diff --git a/src/pregmod/widgets/seBirthWidgets.tw b/src/pregmod/widgets/seBirthWidgets.tw
index 7df289a8be3..34fbf47f05f 100644
--- a/src/pregmod/widgets/seBirthWidgets.tw
+++ b/src/pregmod/widgets/seBirthWidgets.tw
@@ -11,8 +11,13 @@
 <<set $slaveDead = 0>>
 <<set $birthed = 1>>
 <<set $birthDamage = 0>>
+<<set _newMother = 0>>
 
 /* birth complications calcs */
+<<if $slaves[$i].counter.laborCount == 0 && $slaves[$i].counter.birthsTotal == 0>>
+	<<set $birthDamage += 2>>
+	<<set _newMother = 1>>
+<</if>>
 <<if $slaves[$i].mpreg == 1>>
 	<<if $slaves[$i].anus < 2>>
 		<<set $birthDamage += 3>>
@@ -21,6 +26,9 @@
 	<<if $slaves[$i].vagina < 2>>
 		<<set $birthDamage += 3>>
 	<</if>>
+	<<if $slaves[$i].vaginaLube == 0>>
+		<<set $birthDamage += 1>>
+	<</if>>
 <</if>>
 <<if $slaves[$i].hips < 0>>
 	<<set $birthDamage += (2-$slaves[$i].hips)>>
@@ -30,16 +38,12 @@
 <<elseif $slaves[$i].weight <= -30>>
 	<<set $birthDamage += 5>>
 <</if>>
-<<if $slaves[$i].muscles < -95>>
-	<<set $birthDamage += 30>>
-<<elseif $slaves[$i].muscles < -30>>
-	<<set $birthDamage += 4>>
-<<elseif $slaves[$i].muscles < -5>>
-	<<set $birthDamage += 2>>
-<</if>>
 <<if $slaves[$i].health.condition < -20>>
 	<<set $birthDamage += (4-($slaves[$i].health.condition/10))>>
 <</if>>
+<<if $slaves[$i].health.illness >= 3>>
+	<<set $birthDamage += $slaves[$i].health.illness>>
+<</if>>
 <<if $slaves[$i].physicalAge < 6>>
 	<<set $birthDamage += 5>>
 <<elseif $slaves[$i].physicalAge < 9>>
@@ -47,18 +51,16 @@
 <<elseif $slaves[$i].physicalAge < 13>>
 	<<set $birthDamage += 1>>
 <</if>>
-<<if $slaves[$i].counter.laborCount == 0 && $slaves[$i].counter.birthsTotal == 0>>
+<<if $slaves[$i].health.tired > 80>>
+	<<set $birthDamage += 20>>
+<<elseif $slaves[$i].health.tired > 50>>
 	<<set $birthDamage += 2>>
 <</if>>
-<<if $slaves[$i].mpreg != 1>>
-	<<if $slaves[$i].vaginaLube == 0>>
-		<<set $birthDamage += 1>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].tired > 0>>
-	<<set $birthDamage += 2>>
-<</if>>
-<<if $slaves[$i].wombImplant == "restraint">>
+<<if $slaves[$i].muscles < -95>>
+	<<set $birthDamage += 30>>
+<<elseif $slaves[$i].muscles < -30>>
+	<<set $birthDamage += 4>>
+<<elseif $slaves[$i].muscles < -5>>
 	<<set $birthDamage += 2>>
 <</if>>
 <<if $slaves[$i].preg >= $slaves[$i].pregData.normalBirth*1.5>> /* better get her a c-sec*/
@@ -84,32 +86,20 @@
 		<<set $birthDamage += (2-$slaves[$i].hips)>>
 	<</if>>
 <</if>>
-<<if $slaves[$i].mpreg == 1>>
-	<<if $slaves[$i].anus >= 2>>
-		<<set $birthDamage -= 2>>
-	<</if>>
-<<else>>
-	<<if $slaves[$i].vagina >= 2>>
-		<<set $birthDamage -= 2>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].hips > 0>>
-	<<set $birthDamage -= $slaves[$i].hips>>
-<</if>>
-<<if $slaves[$i].intelligenceImplant >= 15>>
-	<<set $birthDamage -= 2>>
-<</if>>
-<<if $slaves[$i].counter.laborCount > 0 || $slaves[$i].counter.birthsTotal != 0>>
-	<<set $birthDamage -= 3>>
+<<if $slaves[$i].wombImplant == "restraint">>
+	<<set $birthDamage += 2>>
 <</if>>
 <<if $slaves[$i].mpreg != 1>>
 	<<if $slaves[$i].vaginaLube > 0>>
 		<<set $birthDamage -= $slaves[$i].vaginaLube>>
 	<</if>>
 <</if>>
-<<if $slaves[$i].curatives > 0>>
+<<if $slaves[$i].counter.laborCount > 0 || $slaves[$i].counter.birthsTotal != 0>>
 	<<set $birthDamage -= 3>>
 <</if>>
+<<if $slaves[$i].hips > 0>>
+	<<set $birthDamage -= $slaves[$i].hips>>
+<</if>>
 <<if $slaves[$i].pregAdaptation >= 1000>>
 	<<set $birthDamage -= 10>>
 <<elseif $slaves[$i].pregAdaptation >= 500>>
@@ -117,8 +107,13 @@
 <<elseif $slaves[$i].pregAdaptation >= 100>>
 	<<set $birthDamage -= 1>>
 <</if>>
+<<if $slaves[$i].curatives > 0>>
+	<<set $birthDamage -= 3>>
+<</if>>
 <<if setup.nurseCareers.includes($slaves[$i].career) && $slaves[$i].fetish != "mindbroken" && $slaves[$i].muscles >= -95>>
 	<<set $birthDamage = 0>>
+<<elseif $slaves[$i].intelligenceImplant >= 15>>
+	<<set $birthDamage -= 2>>
 <</if>>
 
 /* early birth calcs */
@@ -593,7 +588,7 @@ This descriptions can be expanded with more outcomes later. But it's not practic
 	/* I think all this reactions should be showed only if no c'section used too. Setting it up for just in case: */
 <<if $csec == 0 && $slaves[$i].assignment != "work in the dairy">> /*if not desired, this check can be easily removed or deactivated with condition set to true.*/
 	<br>
-	<<if $slaves[$i].counter.laborCount == 0 && $slaves[$i].counter.birthsTotal == 0>>
+	<<if _newMother == 1>>
 		<br>
 		$His inexperience @@.red;complicated $his first birth.@@
 		<<set _compoundCondition = 1>>
@@ -630,6 +625,10 @@ This descriptions can be expanded with more outcomes later. But it's not practic
 		$His poor health made laboring @@.red;exhausting.@@
 		<<set _compoundCondition = 1>>
 	<</if>>
+	<<if $slaves[$i].health.illness >= 3>>
+		$His ongoing illness @@.red;already sapped most of $his strength.@@
+		<<set _compoundCondition = 1>>
+	<</if>>
 	<<if $slaves[$i].physicalAge < 6>>
 		<br>
 		$His very young body was @@.red;not designed to be able pass a baby.@@
@@ -641,7 +640,11 @@ This descriptions can be expanded with more outcomes later. But it's not practic
 		$His young body had @@.red;trouble birthing@@ $his <<if _curBabies > 1>>babies<<else>>baby<</if>>.
 		<<set _compoundCondition = 1>>
 	<</if>>
-	<<if $slaves[$i].tired > 0>>
+	<<if $slaves[$i].health.tired > 80>>
+		<br>
+		$He was thoroughly exhausted to begin with; $he @@.red;lacked the energy to push at all.@@
+		<<set _compoundCondition = 1>>
+	<<elseif $slaves[$i].health.tired > 50>>
 		<br>
 		$He was so tired, $he @@.red;lacked the energy to effectively push.@@
 		<<set _compoundCondition = 1>>
@@ -666,7 +669,7 @@ This descriptions can be expanded with more outcomes later. But it's not practic
 	<<if $slaves[$i].wombImplant == "restraint">>
 		$His support implant @@.red;weakens $his contractions@@ and inhibits $his womb's ability to give birth.
 	<</if>>
-	<<if (($slaves[$i].vagina >= 2 || $slaves[$i].vaginaLube > 0) && $slaves[$i].mpreg == 1) || $slaves[$i].counter.births > 0 || $slaves[$i].hips > 0 || (setup.nurseCareers.includes($slaves[$i].career) && $slaves[$i].fetish != "mindbroken" && $slaves[$i].muscles >= -95) || $slaves[$i].intelligenceImplant >= 15 || $slaves[$i].pregAdaptation >= 100>>
+	<<if (($slaves[$i].vagina >= 2 || $slaves[$i].vaginaLube > 0) && $slaves[$i].mpreg == 1) || _newMother == 0 || $slaves[$i].hips > 0 || (setup.nurseCareers.includes($slaves[$i].career) && $slaves[$i].fetish != "mindbroken" && $slaves[$i].muscles >= -95) || $slaves[$i].intelligenceImplant >= 15 || $slaves[$i].pregAdaptation >= 100>>
 		<br>However:
 		<<if $slaves[$i].mpreg == 1>>
 			<<if $slaves[$i].anus >= 2>>
@@ -683,7 +686,7 @@ This descriptions can be expanded with more outcomes later. But it's not practic
 				$His @@.green;moist vagina@@ hastened $his <<if _curBabies > 1>>children's<<else>>child's<</if>> birth.
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].counter.laborCount > 0 || $slaves[$i].counter.birthsTotal != 0>>
+		<<if _newMother == 0>>
 			<br>
 			$He has @@.green;given birth before,@@ so $he knows just what to do.
 		<</if>>
@@ -701,11 +704,11 @@ This descriptions can be expanded with more outcomes later. But it's not practic
 		<<if setup.nurseCareers.includes($slaves[$i].career) && $slaves[$i].fetish != "mindbroken" && $slaves[$i].muscles >= -95>>
 			<br>
 			Thanks to $his @@.green;previous career,@@ childbirth went smoothly.
-		<</if>>
-		<<if $slaves[$i].intelligenceImplant >= 15>>
+		<<elseif $slaves[$i].intelligenceImplant >= 15>>
 			<br>
 			$He was @@.green;taught how to handle birth@@ in class.
 		<</if>>
+
 	<</if>>
 <</if>>
 /*----- Body/mother resume -------------------------*/
-- 
GitLab