From 3eb60c89f91c36df1049a0104d69590cba10e4da Mon Sep 17 00:00:00 2001
From: FCGudder <-@->
Date: Fri, 7 Jul 2017 20:20:18 +0200
Subject: [PATCH] Quick & dirty anaphrodisiacs implementation

---
 src/gui/Encyclopedia/encyclopedia.tw   |  2 ++
 src/js/economyJS.tw                    |  4 ++--
 src/uncategorized/RETS.tw              |  2 +-
 src/uncategorized/costs.tw             |  2 +-
 src/uncategorized/costsReport.tw       |  6 +++---
 src/uncategorized/rulesAssistant.tw    |  9 +++++++++
 src/uncategorized/saLongTermEffects.tw |  4 ++++
 src/uncategorized/slaveInteract.tw     |  4 ++--
 src/uncategorized/slaveSummary.tw      | 10 ++++++++--
 src/utility/assayWidgets.tw            |  2 +-
 src/utility/raWidgets.tw               |  2 ++
 11 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/src/gui/Encyclopedia/encyclopedia.tw b/src/gui/Encyclopedia/encyclopedia.tw
index de3ee345c46..fc6368ea09f 100644
--- a/src/gui/Encyclopedia/encyclopedia.tw
+++ b/src/gui/Encyclopedia/encyclopedia.tw
@@ -94,6 +94,8 @@ A variety of new pharmaceuticals are becoming available in the regulatory desert
 //Aphrodisiacs,// powerful, addictive sexual enhancers that cause a mental and physical state not dissimilar to traditional hypersexuality. These drugs are based on female hormones, and may have long-term effects similar to female hormone reassignment treatment. They are strongly addictive, both physically and mentally, and the usual recommendation to slave owners is that slaves should be put on aphrodisiacs only for a brief time, or permanently. Aphrodisiac addiction can typically only be overcome by supporting a slave through withdrawal for a similar period to the amount of time she was on the drugs.
 Aphrodisiacs can also be administered in //extreme doses.// This is medically dangerous, but is sometimes used by unscrupulous slave owners. Slaves so dosed will feel an extreme need for sex regardless of their emotional state; for example, rebellious, virgin slaves on extreme aphrodisiac doses will typically enjoy having their virginity sold.
 
+//Anaphrodisiacs// are in many ways the opposite of aphrodisiacs, in that they limit the slave's libido. However, their method of action is generally slower, gentler and less damaging to the body's chemistry. They atill allow for a healthy appetite.
+
 -- Dodgson, Jane Elizabeth, //Pharmaceutical Review '32//
 <<case "From Rebellious to Devoted">>\
 //Almost everything can affect a slave's willingness to obey. Increases in obedience @@.hotpink;are in hot pink,@@ while decreases @@.mediumorchid;are in orchid.@@ Meanwhile, increases in trust (and decreases in fear) @@.mediumaquamarine;are in aquamarine,@@ while decreases in trust (and increases in fear) @@.gold;are in gold.@@
diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw
index ccc00d42c27..1bb82e4af07 100644
--- a/src/js/economyJS.tw
+++ b/src/js/economyJS.tw
@@ -172,8 +172,8 @@ window.getSlaveCost = function(s) {
 	if(s.curatives > 0) {
 		cost += drugsCost * (1 + s.curatives);
 	}
-	if(s.aphrodisiacs > 0) {
-		cost += drugsCost * s.aphrodisiacs;
+	if(s.aphrodisiacs !== 0) {
+		cost += drugsCost * Math.abs(s.aphrodisiacs);
 	}
 	if(s.hormones !== 0) {
 		cost += Math.trunc(drugsCost * Math.abs(s.hormones) * 0.5);
diff --git a/src/uncategorized/RETS.tw b/src/uncategorized/RETS.tw
index 24a11cf1ab0..0417cdc922d 100644
--- a/src/uncategorized/RETS.tw
+++ b/src/uncategorized/RETS.tw
@@ -870,7 +870,7 @@ She turns away.
 <<Enunciate $activeSlave>>
 $activeSlave.slaveName is almost in tears.
 <<if $activeSlave.releaseRules == "permissive">>
-	"I have," she moans, blue balled. "<<if $activeSlave.aphrodisiacs>>It'<<s>> the<<s>>e fucking aphrodi<<s>>iac<<s>>. I can't help it. Plea<<s>>e, plea<<s>>e let me try cumming in<<s>>ide you. I won't be able to <<s>>leep.<<else>>It'<<s>> not the same. I need to <<s>>tick my dick in <<s>>omething <<s>>o bad. Plea<<s>>e.<</if>>"
+	"I have," she moans, blue balled. "<<if $activeSlave.aphrodisiacs > 0>>It'<<s>> the<<s>>e fucking aphrodi<<s>>iac<<s>>. I can't help it. Plea<<s>>e, plea<<s>>e let me try cumming in<<s>>ide you. I won't be able to <<s>>leep.<<else>>It'<<s>> not the same. I need to <<s>>tick my dick in <<s>>omething <<s>>o bad. Plea<<s>>e.<</if>>"
 <<else>>
 	"But I want you," she moans, blue balled.
 	<<if _vaginal>><<set _hole = $subSlave.vagina>><<else>><<set _hole = $subSlave.anus>><</if>>
diff --git a/src/uncategorized/costs.tw b/src/uncategorized/costs.tw
index 668b7c6123d..95babcd3005 100644
--- a/src/uncategorized/costs.tw
+++ b/src/uncategorized/costs.tw
@@ -260,7 +260,7 @@
 	<<set $slaves[$i].curatives = 0>>
 <</if>>
 <<if ($slaves[$i].aphrodisiacs > 0)>>
-	<<set $costs += $drugsCost*$slaves[$i].aphrodisiacs>>
+	<<set $costs += $drugsCost*Math.abs($slaves[$i].aphrodisiacs)>>
 <<elseif ndef $slaves[$i].aphrodisiacs>>
 	<<set $slaves[$i].aphrodisiacs = 0>>
 <</if>>
diff --git a/src/uncategorized/costsReport.tw b/src/uncategorized/costsReport.tw
index a73941bfc78..6299f82a915 100644
--- a/src/uncategorized/costsReport.tw
+++ b/src/uncategorized/costsReport.tw
@@ -361,9 +361,9 @@
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;Health drugs: ¤<<print $drugsCost+($slaves[$i].curatives*$drugsCost)>>
 		<<set $individualCosts += $drugsCost+($slaves[$i].curatives*$drugsCost)>>
 	<</if>>
-	<<if ($slaves[$i].aphrodisiacs > 0)>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;Aphrodisiacs: ¤<<print ($drugsCost*$slaves[$i].aphrodisiacs)>>
-		<<set $individualCosts += $drugsCost*$slaves[$i].aphrodisiacs>>
+	<<if ($slaves[$i].aphrodisiacs !== 0)>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;Aphrodisiacs/Anaphrodisiacs: ¤<<print ($drugsCost*Math.abs($slaves[$i].aphrodisiacs))>>
+		<<set $individualCosts += $drugsCost*Math.abs($slaves[$i].aphrodisiacs)>>
 	<</if>>
 	<<if ($slaves[$i].hormones != 0)>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;Hormones: ¤<<print (Math.trunc($drugsCost*Math.abs($slaves[$i].hormones)*0.5))>>
diff --git a/src/uncategorized/rulesAssistant.tw b/src/uncategorized/rulesAssistant.tw
index e0abe88431d..d95f301177c 100644
--- a/src/uncategorized/rulesAssistant.tw
+++ b/src/uncategorized/rulesAssistant.tw
@@ -1242,6 +1242,8 @@ Aphrodisiacs:
 	<<else>>
 		''standard.''
 	<</if>>
+<<elseif $currentRule.aphrodisiacs === -1>>
+	''anaphrodisiacs.''
 <<else>>
 	''none.''
 <</if>>
@@ -1274,6 +1276,13 @@ Aphrodisiacs:
 	<<RAChangeSave>>
 	<<RAChangeApply>>
 <</link>>
+|
+<<link "Anaphrodisiacs">>
+	<<set $currentRule.aphrodisiacs = -1>>
+	<<RAChangeAphrodisiacs>>
+	<<RAChangeSave>>
+	<<RAChangeApply>>
+<</link>>
 
 <br>
 
diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw
index ebe2f810d9a..34b7c508c11 100644
--- a/src/uncategorized/saLongTermEffects.tw
+++ b/src/uncategorized/saLongTermEffects.tw
@@ -3,6 +3,7 @@
 <<fetishChangeChance $slaves[$i]>>
 <<set $bellyAccessory to $slaves[$i].bellyAccessory>>
 <<set _para = 0>>
+<<if $slaves[$i].aphrodisiacs === -1>><<set _oldEnergy = $slaves[$i].energy, _maxEnergyGain = Math.round((75 - _oldEnergy)/9.3)>><</if>>
 
 <<if $slaves[$i].fuckdoll > 0>>
 <<if $slaves[$i].fuckdoll >= 100>>
@@ -6713,3 +6714,6 @@
 	<<set $slaves[$i].hLength += 1>>
 	<</if>>
 <</if>>
+
+<<if $slaves[$i].aphrodisiacs === -1 && $slaves[$i].energy - _oldEnergy > _maxEnergyGain>>Anaphrodisiacs @@.red;limit her sex drive@@.<<set $slaves[$i].energy = _oldEnergy + _maxEnergyGain>><</if>>
+
diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw
index 794fbe81325..8c0c66218bf 100644
--- a/src/uncategorized/slaveInteract.tw
+++ b/src/uncategorized/slaveInteract.tw
@@ -960,11 +960,11 @@ Health: <span id="curatives"><strong><<if $activeSlave.curatives > 1>>curatives<
 
 &nbsp;&nbsp;&nbsp;&nbsp;
 
-Aphrodisiacs: <span id="aphrodisiacs"><strong><<if $activeSlave.aphrodisiacs > 1>>extreme<<elseif $activeSlave.aphrodisiacs > 0>>applied<<else>>none<</if>></strong></span>.
+Aphrodisiacs: <span id="aphrodisiacs"><strong><<if $activeSlave.aphrodisiacs > 1>>extreme<<elseif $activeSlave.aphrodisiacs > 0>>applied<<elseif $activeSlave.aphrodisiacs === -1>>anaphrodisiacs<<else>>none<</if>></strong></span>.
 	<<link "None">><<set $activeSlave.aphrodisiacs = 0>><<replace "#aphrodisiacs">><strong>none</strong><</replace>><</link>>
 	| <<link "Apply">><<set $activeSlave.aphrodisiacs = 1>><<replace "#aphrodisiacs">><strong>applied</strong><</replace>><</link>>
 	| <<link "Extreme">><<set $activeSlave.aphrodisiacs = 2>><<replace "#aphrodisiacs">><strong>extreme</strong><</replace>><</link>>
-
+	| <<link "Anaphrodisiacs">><<set $activeSlave.aphrodisiacs = -1>><<replace "#aphrodisiacs">><strong>anaphrodisiacs</strong><</replace>><</link>>
 <br>
 <span id="fertilityblock">
 <<if $activeSlave.fuckdoll == 0 && ($activeSlave.ovaries == 1 || $activeSlave.mpreg == 1)>>
diff --git a/src/uncategorized/slaveSummary.tw b/src/uncategorized/slaveSummary.tw
index 7efbc14fceb..c1b06f3241e 100644
--- a/src/uncategorized/slaveSummary.tw
+++ b/src/uncategorized/slaveSummary.tw
@@ -1017,8 +1017,10 @@ Release rules: _Slave.releaseRules.
 	<<if _Slave.aphrodisiacs != 0>>
 	<<if _Slave.aphrodisiacs == 1>>
 		''Aph''
-	<<else>>
+	<<elseif _Slave.aphrodisiacs == 2>>
 		''Aph++''
+	<<else>>
+		''Anaph''
 	<</if>>
 	<</if>>
 	<<if _Slave.addict != 0>>
@@ -1036,6 +1038,8 @@ Release rules: _Slave.releaseRules.
 			Aph
 		<<case 2>>
 			Aph++
+		<<case -1>>
+			Anaph
 		<</switch>>
 	<</if>>
 	<<if _Slave.hormones > 1>>
@@ -1088,8 +1092,10 @@ Release rules: _Slave.releaseRules.
 	<<elseif _Slave.curatives == 1>>
 		On preventatives.
 	<</if>>
-	<<if _Slave.aphrodisiacs != 0>>
+	<<if _Slave.aphrodisiacs > 0>>
 		On <<if _Slave.aphrodisiacs > 1>>extreme <</if>>aphrodisiacs.
+	<<elseif _Slave.aphrodisiacs === -1>>
+		On anaphrodisiacs.
 	<</if>>
 	<<if _Slave.addict != 0>>
 		@@.cyan;Addict.@@
diff --git a/src/utility/assayWidgets.tw b/src/utility/assayWidgets.tw
index f0afd0c4194..21f56c7d12e 100644
--- a/src/utility/assayWidgets.tw
+++ b/src/utility/assayWidgets.tw
@@ -1197,7 +1197,7 @@
 
 <</if>> /* CLOSES FUCKDOLL CHECK */
 
-<<set $FResult += $args[0].aphrodisiacs*2>>
+<<set $FResult += Math.max(0, $args[0].aphrodisiacs)*2>>
 <<if $args[0].inflationType == "aphrodisiac">>
 	<<set $FResult += $args[0].inflation*4>>
 <</if>>
diff --git a/src/utility/raWidgets.tw b/src/utility/raWidgets.tw
index 1251d43ccb9..2fa09c3d1e5 100644
--- a/src/utility/raWidgets.tw
+++ b/src/utility/raWidgets.tw
@@ -2049,6 +2049,8 @@ Aphrodisiacs:
 	<<else>>
 		''standard.''
 	<</if>>
+<<elseif $currentRule.aphrodisiacs === -1>>
+	''anaphrodisiacs.''
 <<else>>
 	''none.''
 <</if>>
-- 
GitLab