From dff6fd1d9a17054b909e80980d0df32b7d8e015b Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Mon, 19 Oct 2020 18:13:20 -0400
Subject: [PATCH] abortion total

---
 src/endWeek/saLongTermEffects.js  | 6 ++----
 src/js/DefaultRules.js            | 6 ++----
 src/js/sexActsJS.js               | 2 +-
 src/npc/generate/lawCompliance.js | 9 +++------
 src/pregmod/personalNotes.tw      | 3 +--
 src/uncategorized/saLiveWithHG.tw | 3 +--
 6 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/src/endWeek/saLongTermEffects.js b/src/endWeek/saLongTermEffects.js
index 0ec051747d2..d227fae9f10 100644
--- a/src/endWeek/saLongTermEffects.js
+++ b/src/endWeek/saLongTermEffects.js
@@ -2249,8 +2249,7 @@ App.SlaveAssignment.longTermEffects = (function() {
 				if (slave.pregSource !== -1 && slave.pregSource !== -6) {
 					r.push(`${slave.slaveName}'s weekly health checkup revealed ${he} is pregnant with an unacceptable child. <span class="elites loss">Its life has been terminated, you have been fined ${cashFormat(100000)}, and your rep among the Elite has been severely damaged.</span>`);
 					TerminatePregnancy(slave);
-					slave.counter.abortions++;
-					V.abortionsTotal++;
+					actX(slave, "abortions");
 					cashX(-100000, "fines", slave);
 					V.failedElite += 150;
 					if (slave.abortionTat > -1) {
@@ -2444,8 +2443,7 @@ App.SlaveAssignment.longTermEffects = (function() {
 							}
 						}
 						TerminatePregnancy(slave);
-						slave.counter.abortions++;
-						V.abortionsTotal++;
+						actX(slave, "abortions");
 						if (slave.abortionTat > -1) {
 							slave.abortionTat++;
 							r.push(`The temporary tattoo of a child has been replaced with ${his} ${ordinalSuffix(slave.abortionTat)} crossed out infant.`);
diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js
index c576d479d20..6b17e48aab3 100644
--- a/src/js/DefaultRules.js
+++ b/src/js/DefaultRules.js
@@ -1084,8 +1084,7 @@ globalThis.DefaultRules = (function() {
 				}
 				if (WL === 0) {
 					TerminatePregnancy(slave);
-					slave.counter.abortions++;
-					V.abortionsTotal++;
+					actX(slave, "abortions");
 				}
 			}
 			return res;
@@ -1142,8 +1141,7 @@ globalThis.DefaultRules = (function() {
 						cashX(forceNeg(V.modCost), "slaveMod", slave);
 					}
 					TerminatePregnancy(slave);
-					slave.counter.abortions++;
-					V.abortionsTotal++;
+					actX(slave, "abortions");
 				} else if (ar === "male") {
 					if (conditionalTermination(slave, fetus => fetus.genetics.gender === "XY")) {
 						r += `<br>${slave.slaveName}'s male fetuses have been terminated.`;
diff --git a/src/js/sexActsJS.js b/src/js/sexActsJS.js
index ce983ed4270..c3a42134b2d 100644
--- a/src/js/sexActsJS.js
+++ b/src/js/sexActsJS.js
@@ -446,7 +446,7 @@ globalThis.actX = function(slave, act, count = 1) {
 			V.pitKillsTotal += count;
 			break;
 		case "miscarriages":
-			V.miscarriagesTotal++;
+			V.miscarriagesTotal += count;
 			break;
 		case "publicUse":
 			break;
diff --git a/src/npc/generate/lawCompliance.js b/src/npc/generate/lawCompliance.js
index b5f2cb59426..105b40a3156 100644
--- a/src/npc/generate/lawCompliance.js
+++ b/src/npc/generate/lawCompliance.js
@@ -276,8 +276,7 @@ App.Desc.lawCompliance = function(slave, market = 0) {
 		const r = [];
 		if (slave.balls > 0 || slave.ovaries > 0) {
 			TerminatePregnancy(slave);
-			slave.counter.abortions++;
-			V.abortionsTotal++;
+			actX(slave, "abortions");
 			slave.balls = 0;
 			slave.ovaries = 0;
 			r.push(`As a member of the lowest class,`);
@@ -790,8 +789,7 @@ App.Desc.lawCompliance = function(slave, market = 0) {
 				}
 				r.push(`tubes were promptly tied to prevent ${him} from passing on ${his} inferior genes, <span class="mediumorchid">saddening</span> and <span class="gold">frightening</span> ${him}.`);
 				TerminatePregnancy(slave);
-				slave.counter.abortions++;
-				V.abortionsTotal++;
+				actX(slave, "abortions");
 				slave.devotion -= 30;
 				slave.trust -= 30;
 			} else if (slave.balls > 0) {
@@ -814,8 +812,7 @@ App.Desc.lawCompliance = function(slave, market = 0) {
 				}
 				r.push(`tubes were promptly tied to prevent ${him} from passing on ${his} inferior genes, <span class="mediumorchid">saddening</span> and <span class="gold">frightening</span> ${him}.`);
 				TerminatePregnancy(slave);
-				slave.counter.abortions++;
-				V.abortionsTotal++;
+				actX(slave, "abortions");
 				slave.devotion -= 10;
 				slave.trust -= 10;
 			} else {
diff --git a/src/pregmod/personalNotes.tw b/src/pregmod/personalNotes.tw
index fee3bd9ad7f..bc2ab16cd9d 100644
--- a/src/pregmod/personalNotes.tw
+++ b/src/pregmod/personalNotes.tw
@@ -344,8 +344,7 @@
 							<<set $PC.devotion -= 10, $PC.trust -= 10>>
 						<</if>>
 						<<set TerminatePregnancy($PC)>>
-						<<set $PC.counter.abortions++>>
-						<<set $abortionsTotal++>>
+						<<run actX($PC, "abortions")>>
 						<<if $PC.abortionTat > -1>>
 							<<set $PC.abortionTat++>>
 							The temporary tattoo of a child has been replaced with $his <<= ordinalSuffix($PC.abortionTat)>> crossed out infant.
diff --git a/src/uncategorized/saLiveWithHG.tw b/src/uncategorized/saLiveWithHG.tw
index 04a2edfdd14..3090acf5a33 100644
--- a/src/uncategorized/saLiveWithHG.tw
+++ b/src/uncategorized/saLiveWithHG.tw
@@ -372,8 +372,7 @@
 			<<else>>
 				_S.HeadGirl.slaveName promptly aborts the child growing in $slaves[$i].slaveName since _he2 prefers _his2 <<= $girl>>s not harboring someone else's child or loaded down with _his2 own unwanted spawn.
 				<<run TerminatePregnancy($slaves[$i])>>
-				<<set $slaves[$i].counter.abortions++>>
-				<<set $abortionsTotal++>>
+				<<run actX($slaves[$i], "abortions")>>
 			<</if>>
 		<</if>>
 	<</if>>
-- 
GitLab