From 40429a2ae2ca86ec600beab3e70240f0e2d55556 Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Sat, 4 May 2019 21:46:30 -0400
Subject: [PATCH] Added priapism agents and .chem clinic summary

---
 slave variables documentation - Pregmod.txt |  1 +
 src/js/slaveStatsChecker.js                 |  6 ++++-
 src/js/slaveSummaryWidgets.js               | 11 ++++++++-
 src/uncategorized/longSlaveDescription.tw   | 14 ++++++++++++
 src/uncategorized/saDrugs.tw                | 20 +++++++++++++++++
 src/uncategorized/slaveInteract.tw          |  3 +++
 src/utility/descriptionWidgetsFlesh.tw      | 25 ++++++++++++++++-----
 src/utility/miscWidgets.tw                  |  3 +++
 8 files changed, 75 insertions(+), 8 deletions(-)

diff --git a/slave variables documentation - Pregmod.txt b/slave variables documentation - Pregmod.txt
index d0b72382bff..faee542935c 100644
--- a/slave variables documentation - Pregmod.txt	
+++ b/slave variables documentation - Pregmod.txt	
@@ -2556,6 +2556,7 @@ drugs:
 "butt redistributors"
 "sag-B-gone"
 "growth stimulants"
+"priapism agents"
 
 aphrodisiacs:
 
diff --git a/src/js/slaveStatsChecker.js b/src/js/slaveStatsChecker.js
index 262a1485116..776d6d6ebc9 100644
--- a/src/js/slaveStatsChecker.js
+++ b/src/js/slaveStatsChecker.js
@@ -378,7 +378,11 @@ window.isFertile = function(slave) {
 window.canAchieveErection = function(slave) {
 	if (!slave) {
 		return null;
-	} else if (slave.dick < 7 && slave.dick > 0 && slave.drugs !== "hormone blockers" && (slave.balls > 0 ? slave.hormoneBalance < 100 : slave.hormoneBalance <= -100) && slave.ballType !== "sterile") {
+	} else if (slave.dick <= 0) {
+		return false;
+	} else if (slave.dick < 16 && slave.drugs === "priapism agents") {
+		return true;
+	} else if (slave.dick < 7 && slave.drugs !== "hormone blockers" && (slave.balls > 0 ? slave.hormoneBalance < 100 : slave.hormoneBalance <= -100) && slave.ballType !== "sterile") {
 		return true;
 	}
 	return false;
diff --git a/src/js/slaveSummaryWidgets.js b/src/js/slaveSummaryWidgets.js
index 295ccb94dc4..4a9e4264ba4 100644
--- a/src/js/slaveSummaryWidgets.js
+++ b/src/js/slaveSummaryWidgets.js
@@ -770,6 +770,9 @@ window.SlaveSummaryUncached = (function() {
 			r += `<strong><span class="green">H${V.summaryStats? `[${slave.health}]` : ''}</span></strong>`;
 		}
 		r += " ";
+		if (passage() === "Clinic" && V.clinicUpgradeScanner && slave.chem > 15) {
+			r += `<strong><span class="cyan">C${Math.ceil(slave.chem/10)}</span></strong> `;
+		}
 	}
 
 	/**
@@ -792,6 +795,9 @@ window.SlaveSummaryUncached = (function() {
 			r += `<span class="green">Unnaturally healthy${V.summaryStats? `[${slave.health}]` : ''}.</span>`;
 		}
 		r += " ";
+		if (passage() === "Clinic" && V.clinicUpgradeScanner && slave.chem > 15) {
+			r += `<strong><span class="cyan">Carcinogen buildup: ${Math.ceil(slave.chem/10)}</span>.</strong> `;
+		}
 	}
 
 	/**
@@ -897,7 +903,10 @@ window.SlaveSummaryUncached = (function() {
 				r += `<strong>Dr:AntiSag</strong>`;
 				break;
 			case "growth stimulants":
-				r += `<strong>Dr:groStim</strong>`;
+				r += `<strong>Dr:GroStim</strong>`;
+				break;
+			case "priapism agents":
+				r += `<strong>Dr:Erection</strong>`;
 				break;
 		}
 		r += `</span> `;
diff --git a/src/uncategorized/longSlaveDescription.tw b/src/uncategorized/longSlaveDescription.tw
index 4361dd9e244..d7327f5014e 100644
--- a/src/uncategorized/longSlaveDescription.tw
+++ b/src/uncategorized/longSlaveDescription.tw
@@ -2216,6 +2216,20 @@ $He is
 <<if $activeSlave.fuckdoll == 0>>
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
 	<<switch $activeSlave.drugs>>
+	<<case "priapism agents">>
+		<<if $activeSlave.dick > 0 && $activeSlave.dick <= 15>>
+			<<if $activeSlave.chastityPenis == 1>>
+				$He can do nothing but writhe in agony at the pain of $his priapismic erection trapped in $his chastity cage.
+			<<else>>
+				<<if ($activeSlave.dick > 8)>>
+					$His oversized dick is painfulled engorged to a state of semi-hardness due to the priapism agents.
+				<<elseif ($activeSlave.dick > 6)>>
+					$He sports a painful, oversized erection due to the priapism agents.
+				<<else>>
+					$He sports a throbbing, painful erection due to the priapism agents.
+				<</if>>
+			<</if>>
+		<</if>>
 	<<case "super fertility drugs">>
 		<<if isFertile($activeSlave) && $activeSlave.preg == 0>>
 			$He is constantly dripping sexual fluids and $his breasts and belly are slightly swollen. The super fertility drugs have $him ready to be impregnated.
diff --git a/src/uncategorized/saDrugs.tw b/src/uncategorized/saDrugs.tw
index 13010bff4e4..ad99a525bb3 100644
--- a/src/uncategorized/saDrugs.tw
+++ b/src/uncategorized/saDrugs.tw
@@ -13,6 +13,26 @@
 
 <<case "hormone enhancers">>
 	$His drug regime prepares $his body to accept hormonal effects.
+	
+<<case "priapism agents">>
+	<<if $slaves[$i].dick == 0>>
+		Since $he lacks a dick, it is pointless to try and keep it hard. @@.yellow;$His drug regimen has been ended.@@
+		<<set $slaves[$i].drugs = "no drugs">>
+	<<elseif $slaves[$i].chastityPenis == 1>>
+		A tight cage around a dick forced hard are a bad mix so @@.yellow;$his drug regimen has been ended.@@
+	<<elseif $slaves[$i].health <= -50>>
+		$He is too unwell to risk further health complications from priapism. @@.yellow;$His drug regimen has been ended.@@
+	<<elseif $slaves[$i].dick > 15>>
+		$His dick is so enormous that attempts to force an erection would kill $him. @@.yellow;$His drug regimen has been mercifully ended.@@
+		<<set $slaves[$i].drugs = "no drugs">>
+	<<else>>
+		$His drug regime keeps $his dick @@.red;painfully erect.@@
+		<<set $slaves[$i].health -= 5>>
+		<<if $slaves[$i].dick >= 7>>
+			The amount of blood needed to keep $his oversized cock hard has @@.red;severe effects on $his health!@@
+			<<set $slaves[$i].health -= $slaves[$i].dick*5>>
+		<</if>>
+	<</if>>
 
 <<case "psychosuppressants">>
 	<<if ($slaves[$i].fetish != "mindbroken")>>
diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw
index a75dbe6ca52..5b02ae1e448 100644
--- a/src/uncategorized/slaveInteract.tw
+++ b/src/uncategorized/slaveInteract.tw
@@ -1113,6 +1113,9 @@
 				| Penis reducers
 			<</if>>
 		<</if>>
+		<<if $activeSlave.dick > 0 && $activeSlave.dick < 16 && !canAchieveErection($activeSlave) && $activeSlave.chastityPenis != 1>>
+			| <<link "Erectile dysfunction circumvention">><<set $activeSlave.drugs = "priapism agents">><<SlaveInteractDrugs>><</link>>
+		<</if>>
 		<<if ($activeSlave.balls > 0)>>
 			| <<link "Testicle enhancement">><<set $activeSlave.drugs = "testicle enhancement">><<SlaveInteractDrugs>><</link>>
 			<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
diff --git a/src/utility/descriptionWidgetsFlesh.tw b/src/utility/descriptionWidgetsFlesh.tw
index 752b9f670d5..f1d37dc7a1c 100644
--- a/src/utility/descriptionWidgetsFlesh.tw
+++ b/src/utility/descriptionWidgetsFlesh.tw
@@ -3904,11 +3904,24 @@ $He's got a
 			<<elseif ($activeSlave.dick > 6)>>
 				$He's only half hard despite the drugs ejaculated by the dildo up $his asshole, and $he must feel very faint, since even that requires much of $his blood volume.
 			<<else>>
-				The drugs ejaculated by the dildo up $his asshole keep $his almost permanently hard, only letting $his go soft right after ejaculation.
+				The drugs ejaculated by the dildo up $his asshole keep $his almost permanently hard, only letting $him go soft right after ejaculation.
 			<</if>>
 			As you watch, the machine detects that $his balls are ready for emptying. It reams $his ass until semen whitens the transparent tubing coming off the head of the receptacle covering $his dick.
 		<<elseif ($activeSlave.chastityPenis == 1)>>
 			<<dickAccessoryDescription>>
+		<<elseif $activeSlave.drugs == "priapism agents">>
+			<<if ($activeSlave.dick > 8)>>
+				$He's painfully hard, despite the size of $his cock, and on the brink of consciousness, since a dangerous amount of $his blood volume is required to even get it to this point.
+			<<elseif ($activeSlave.dick > 6)>>
+				$He's painfully erect, or as erect that a cock of that size could be, and $he must feel very faint, since even that requires much of $his blood volume.
+			<<else>>
+				$He's painfully erect.
+			<</if>>
+			<<if ($activeSlave.prostate > 2)>>
+				The area above $his crotch has a slight swell to it from $his prostate implant. A constant dribble of precum drips from the tip of $his cock; $his artificially hyperactive prostate keeps $him that way.
+			<<elseif ($activeSlave.prostate > 1)>>
+				$He's got a string of precum dangling from the tip of $his cock; $his artificially hyperactive prostate keeps $him that way.
+			<</if>>
 		<<elseif ($activeSlave.dick > 8)>>
 			$He's too huge for $his cardiovascular system to create even the beginnings of an erection. $His cock is a soft, sensitive monolith<<if ($activeSlave.dick*6) > $activeSlave.height>> bigger than $his body<<elseif ($activeSlave.dick*6) > ($activeSlave.height/2)>> the size of one of $his legs<<else>> the size of one of $his arms<</if>>,
 			<<if $activeSlave.amp == 1 && (($activeSlave.dick*6) > $activeSlave.height)>>
@@ -4221,7 +4234,7 @@ $He's got a
 		<<if ($activeSlave.foreskin > 0)>>
 			<<if ($activeSlave.foreskin - $activeSlave.dick < -1)>>
 				$His cockhead is much too large for $his foreskin, probably as a result of recent penis growth it hasn't had time to stretch to accommodate yet.
-				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac"))>>
+				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac") || ($activeSlave.drugs == "priapism agents"))>>
 					The bit of erect dickhead visible at the tip of the uncomfortably stretched skin is an angry color from being squeezed so hard.
 				<<elseif canAchieveErection($activeSlave)>>
 					$He isn't erect right now, but getting a hard-on will probably be very uncomfortable for $him.
@@ -4230,7 +4243,7 @@ $He's got a
 				<</if>>
 			<<elseif ($activeSlave.foreskin - $activeSlave.dick < 0)>>
 				$His foreskin is stretched by $his dickhead, probably as a result of recent penis growth it hasn't had time to get used to yet.
-				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac"))>>
+				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac") || ($activeSlave.drugs == "priapism agents"))>>
 					$His erection has stretched the skin there taut.
 				<<elseif canAchieveErection($activeSlave)>>
 					$He isn't erect right now, but getting a hard-on will probably be a bit uncomfortable for $him.
@@ -4239,7 +4252,7 @@ $He's got a
 				<</if>>
 			<<elseif ($activeSlave.foreskin - $activeSlave.dick > 0)>>
 				$His foreskin seems too large for $his dick, probably as a result of recent penis shrinkage.
-				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac"))>>
+				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac") || ($activeSlave.drugs == "priapism agents"))>>
 					$His erection cannot fully retract it, though it's loose enough that this doesn't look uncomfortable.
 				<<elseif canAchieveErection($activeSlave)>>
 					$He isn't erect right now, making the tip of $his dick look shriveled.
@@ -4248,7 +4261,7 @@ $He's got a
 				<</if>>
 			<<elseif ($activeSlave.foreskin - $activeSlave.dick > 1)>>
 				$His foreskin is far too large for $his dick, probably as a result of recent penis shrinkage.
-				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac"))>>
+				<<if canAchieveErection($activeSlave) && (($activeSlave.devotion > 20) || ($activeSlave.aphrodisiacs > 0) || ($saleDescription == 1 && $gingering == "vasodilator") || ($activeSlave.inflationType == "aphrodisiac") || ($activeSlave.drugs == "priapism agents"))>>
 					$His erection cannot retract it at all, though it's loose enough that this doesn't look uncomfortable. Orgasming, though, will likely produce a dribbling mess.
 				<<elseif canAchieveErection($activeSlave)>>
 					$He isn't erect right now, so the excess skin droops lamely off $his cockhead.
@@ -5207,7 +5220,7 @@ $He's got a
 
 <<if $activeSlave.fuckdoll == 0>>
 	<<if ($activeSlave.releaseRules == "permissive") || $activeSlave.releaseRules == "masturbation">>
-		<<if ($activeSlave.aphrodisiacs > 0) || ($activeSlave.inflationType == "aphrodisiac")>>
+		<<if (($activeSlave.aphrodisiacs > 0) || ($activeSlave.inflationType == "aphrodisiac")) && $activeSlave.drugs != "priapism agents">>
 			<<if ($activeSlave.aphrodisiacs > 1) || ($activeSlave.inflationType == "aphrodisiac" && $activeSlave.inflation > 1)>>
 				<<if ($activeSlave.dick != 0) && ($activeSlave.hormoneBalance >= 100) && ($activeSlave.amp == 1)>>
 					The extreme dose of aphrodisiacs combined with the hormones that keep $him flaccid have $him in a state of extreme sexual frustration; $he's <<if (($activeSlave.fetish == "buttslut") || (($activeSlave.sexualFlaw != "hates anal") && ($activeSlave.counter.anal > 9)))>>unconsciously humping $his ass against whatever's next to $him for anal stimulation and<</if>>humping $his dick against whatever $he can manage to mount without limbs.<<if $activeSlave.inflationType == "aphrodisiac">> $His efforts force $his distended middle to jiggle around, stirring up the aphrodisiacs contained in $his gut and strengthening their effects even more.<</if>>
diff --git a/src/utility/miscWidgets.tw b/src/utility/miscWidgets.tw
index a16d6eac94f..ee65cefaa60 100644
--- a/src/utility/miscWidgets.tw
+++ b/src/utility/miscWidgets.tw
@@ -238,6 +238,9 @@
 				| Penis reducers
 			<</if>>
 		<</if>>
+		<<if $activeSlave.dick > 0 && $activeSlave.dick < 16 && !canAchieveErection($activeSlave) && $activeSlave.chastityPenis != 1>>
+			| <<link "Erectile dysfunction circumvention">><<set $activeSlave.drugs = "priapism agents">><<SlaveInteractDrugs>><</link>>
+		<</if>>
 		<<if ($activeSlave.balls > 0)>>
 			| <<link "Testicle enhancement">><<set $activeSlave.drugs = "testicle enhancement">><<SlaveInteractDrugs>><</link>>
 			<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-- 
GitLab