From 3e9e60e8b178be3a55f1603a8b6329a7e546a628 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 26 Sep 2020 20:17:37 -0400
Subject: [PATCH] death

---
 src/js/death.js                        | 4 ++++
 src/uncategorized/saLongTermEffects.tw | 9 +++------
 2 files changed, 7 insertions(+), 6 deletions(-)
 create mode 100644 src/js/death.js

diff --git a/src/js/death.js b/src/js/death.js
new file mode 100644
index 00000000000..fa243db18c7
--- /dev/null
+++ b/src/js/death.js
@@ -0,0 +1,4 @@
+globalThis.planDeath = function(slave, reason) {
+	slave.death = reason;
+	V.slaveDeath = 1;
+};
diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw
index f5c27a6ae13..43cd470162a 100644
--- a/src/uncategorized/saLongTermEffects.tw
+++ b/src/uncategorized/saLongTermEffects.tw
@@ -6476,19 +6476,16 @@
 			<<set _deathSeed += 200>>
 		<</if>>
 		<<if random(1,1000) > (400+_deathSeed)>>
-			<<set $slaves[$i].death = "health">>
-			<<set $slaveDeath = 1>>
+			<<run planDeath($slaves[$i], "health")>>
 		<</if>>
 		<<if ($slaves[$i].aphrodisiacs > 0 || $slaves[$i].inflationType == "aphrodisiac") && random(1,1000) > (200+_deathSeed)>>
-			<<set $slaves[$i].death = "OD">>
-			<<set $slaveDeath = 1>>
+			<<run planDeath($slaves[$i], "OD")>>
 		<</if>>
 	<</if>>
 	<<if $seeAge == 1>>
 		<<set _deathSeed = (($slaves[$i].health.health*2)-($slaves[$i].physicalAge*2)-($slaves[$i].chem*4)-($slaves[$i].addict*3))>>
 		<<if $slaves[$i].physicalAge >= Math.max((70+($slaves[$i].health.health/5)-($slaves[$i].addict)-($slaves[$i].chem/20)),50) && random(1,1000) > 800+_deathSeed>>
-			<<set $slaves[$i].death = "old">>
-			<<set $slaveDeath = 1>>
+			<<run planDeath($slaves[$i], "old")>>
 		<</if>>
 	<</if>>
 <</if>>
-- 
GitLab