From 0801b83580c4c386301033683b7e054b2aff9e32 Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Sat, 30 Dec 2017 18:13:14 -0500
Subject: [PATCH] Stamina pills and saServeYourOtherSlaves work

---
 devNotes/VersionChangeLog-Premod+LoliMod.txt |  5 ++
 devNotes/twine JS                            |  3 +
 src/js/economyJS.tw                          |  3 +
 src/pregmod/managePersonalAffairs.tw         |  8 ++
 src/uncategorized/costs.tw                   |  3 +
 src/uncategorized/costsReport.tw             |  5 +-
 src/uncategorized/endWeek.tw                 | 16 +++-
 src/uncategorized/saServeYourOtherSlaves.tw  | 35 +++++---
 src/utility/miscWidgets.tw                   | 86 ++++++++++++++++++++
 9 files changed, 150 insertions(+), 14 deletions(-)

diff --git a/devNotes/VersionChangeLog-Premod+LoliMod.txt b/devNotes/VersionChangeLog-Premod+LoliMod.txt
index 421ea249d74..69bf683fb64 100644
--- a/devNotes/VersionChangeLog-Premod+LoliMod.txt
+++ b/devNotes/VersionChangeLog-Premod+LoliMod.txt
@@ -2,6 +2,11 @@
 
 0.10.7.0/1
 
+12/30/17
+
+	244
+	-added stamina pills for player consumption
+
 12/29/17
 
 	243
diff --git a/devNotes/twine JS b/devNotes/twine JS
index 2fe85b60c75..99679bd12a8 100644
--- a/devNotes/twine JS	
+++ b/devNotes/twine JS	
@@ -2176,6 +2176,9 @@ window.getCost = function(array) {
 	} else if(State.variables.PC.preg >= 16) {
 		costs += 100;
 	}
+	if(State.variables.PC.staminaPills === 1) {
+		costs += 50;
+	}
 
 	if(State.variables.PC.career === 'servant') {
 		if(State.variables.personalAttention === PersonalAttention.MAID) {
diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw
index 8d16e0ad55f..0e792f8fd29 100644
--- a/src/js/economyJS.tw
+++ b/src/js/economyJS.tw
@@ -282,6 +282,9 @@ window.getCost = function(array) {
 	} else if(State.variables.PC.preg >= 16) {
 		costs += 100;
 	}
+	if(State.variables.PC.staminaPills === 1) {
+		costs += 50;
+	}
 
 	if(State.variables.PC.career === 'servant') {
 		if(State.variables.personalAttention === PersonalAttention.MAID) {
diff --git a/src/pregmod/managePersonalAffairs.tw b/src/pregmod/managePersonalAffairs.tw
index e8a3d9fdb9d..a8df00aaa7f 100644
--- a/src/pregmod/managePersonalAffairs.tw
+++ b/src/pregmod/managePersonalAffairs.tw
@@ -630,6 +630,14 @@ In total, you have given birth to:
 
 <</if>>
 
+<br><br>
+__Drugs__
+<<if $PC.staminaPills == 1>>
+	You are currently taking stamina enhancing pills in order to enjoy more slaves per week. [[Stop taking stamina enhancing drugs|Manage Personal Affairs][$PC.staminaPills = 0]]
+<<else>>
+	You are not on any stamina enhancers. [[More stamina means more sex|Manage Personal Affairs][$PC.staminaPills = 1]]
+<</if>>
+
 <<if $propOutcome == 1>>
 	<br><br>
 __Elite Breeder Qualifications__
diff --git a/src/uncategorized/costs.tw b/src/uncategorized/costs.tw
index b978f2e6eb6..c5afc23f3f7 100644
--- a/src/uncategorized/costs.tw
+++ b/src/uncategorized/costs.tw
@@ -481,6 +481,9 @@
 <<elseif $PC.preg >= 16>>
 	<<set $costs += 100>>
 <</if>>
+<<if PC.staminaPills == 1>>
+	<<set $costs += 50>>
+<</if>>
 
 <<if $PC.career == "servant">>
 	<<if $personalAttention == "upkeep">>
diff --git a/src/uncategorized/costsReport.tw b/src/uncategorized/costsReport.tw
index 1491a2c22ff..474d2e05ec9 100644
--- a/src/uncategorized/costsReport.tw
+++ b/src/uncategorized/costsReport.tw
@@ -21,7 +21,10 @@
 <<elseif $PC.fertDrugs == 1>>
 	<br>Your fertility regimen: <<print cashFormat(50)>>
 <<elseif $PC.preg >= 16>>
-	<br>Increased living expenses due to being pregnant : <<print cashFormat(100)>>
+	<br>Increased living expenses due to being pregnant: <<print cashFormat(100)>>
+<</if>>
+<<if PC.staminaPills == 1>>
+	<br>Your stamina pills: <<print cashFormat(50)>>
 <</if>>
 
 <<if $citizenOrphanageTotal+$privateOrphanageTotal > 0>>
diff --git a/src/uncategorized/endWeek.tw b/src/uncategorized/endWeek.tw
index ca115a5bb29..f173cb3ce73 100644
--- a/src/uncategorized/endWeek.tw
+++ b/src/uncategorized/endWeek.tw
@@ -30,7 +30,7 @@
 			<<set $inflatedSlavesCum++>>
 		<</if>>
 	<</if>>
-	<<if $slaves[_i].subTarget == 0>>
+	<<if $slaves[_i].assignment == "be a subordinate slave" && $slaves[_i].subTarget == 0>>
 		<<set $subSlaves++>>
 	<</if>>
 <</for>>
@@ -108,6 +108,8 @@
 	<<set $PC.sexualEnergy -= 2>>
 <<elseif $PC.physicalAge < 35>>
 	<<set $PC.sexualEnergy += 2>>
+<<elseif $PC.physicalAge < 21>>
+	<<set $PC.sexualEnergy += 4>>
 <</if>>
 <<if $PC.balls > 2>>
 	<<set $PC.sexualEnergy += 2>>
@@ -121,7 +123,17 @@
 		<<set $PC.sexualEnergy -= 3>>
 	<</if>>
 <<elseif $PC.preg > 0>>
-	<<set $PC.sexualEnergy -= 1>>	
+	<<set $PC.sexualEnergy -= 1>>
+<<else>>
+	<<if $PC.fertDrugs == 1>>
+		<<set $PC.sexualEnergy++>>
+	<</if>>
+	<<if $PC.forcedFertDrugs > 0>>
+		<<set $PC.sexualEnergy += 2>>
+	<</if>>
+<</if>>
+<<if $PC.staminaPills > 0>>
+	<<set $PC.sexualEnergy += 2>>
 <</if>>
 <<if $PC.preg > 0>>
 	<<set $PC.preg++>>
diff --git a/src/uncategorized/saServeYourOtherSlaves.tw b/src/uncategorized/saServeYourOtherSlaves.tw
index e5302bb231e..1291c2a4c64 100644
--- a/src/uncategorized/saServeYourOtherSlaves.tw
+++ b/src/uncategorized/saServeYourOtherSlaves.tw
@@ -114,7 +114,7 @@
 		<</if>>
 	<</if>>
 <</if>>
-<<set _fuckCount = Math.ciel((($dormitoryPopulation+$roomsPopulation)+random((($dormitoryPopulation+$roomsPopulation)*1),($dormitoryPopulation+$roomsPopulation)*7))/$subSlaves)>>
+<<set _fuckCount = Math.ceil((($dormitoryPopulation+$roomsPopulation)+random((($dormitoryPopulation+$roomsPopulation)*1),($dormitoryPopulation+$roomsPopulation)*7))/$subSlaves)>>
 <<SimpleSlaveFucking $slaves[$i] _fuckCount>>
 <<set $slaves[$i].need -= 2*_fuckCount>>
 
@@ -343,24 +343,37 @@ is serving ''$slaves[_dom].slaveName'' this week.
 	<</if>>
 	<<set _oralUse = random(9,12)>>
 	<<set $slaves[_dom].mammaryCount += _oralUse, $mammaryTotal += _oralUse>>
-<<elseif ($slaves[$i].dick > 0) && !canAchieveErection($slaves[$i]) && ($slaves[_dom].fetishKnown == 1) && ($slaves[_dom].fetishStrength > 60) && ($slaves[_dom].fetish == "cumslut")>>
-	Since $slaves[_dom].slaveName loves cum, and $slaves[$i].slaveName has a dick, $slaves[_dom].slaveName has her own private semen dispenser, even if it's rather limp. $slaves[_dom].slaveName sometimes gets tired of having to work hard for cum, so she spends the week making $slaves[$i].slaveName painstakingly bring her flaccid dick almost to orgasm before $slaves[_dom].slaveName wraps her <<if $seeRace == 1>>$slaves[_dom].race <</if>>lips around $slaves[$i].slaveName's <<if $seeRace == 1>>$slaves[$i].race <</if>>soft dickhead to suck down the cum. @@.hotpink;$slaves[_dom].slaveName enjoys having a servile dick on demand.@@
+<<elseif ($slaves[$i].dick > 0) && ($slaves[$i].balls != 0) && !canAchieveErection($slaves[$i]) && !["chastity", "combined chastity"].includes($slaves[$i].dickAccessory)>> && ($slaves[_dom].fetishKnown == 1) && ($slaves[_dom].fetishStrength > 60) && ($slaves[_dom].fetish == "cumslut")>>
+	Since $slaves[_dom].slaveName loves cum, and $slaves[$i].slaveName has a dick, $slaves[_dom].slaveName has her own private semen dispenser, even if it's rather limp. $slaves[_dom].slaveName sometimes gets tired of having to work hard for cum, so she spends the week making $slaves[$i].slaveName painstakingly bring her flaccid dick almost to orgasm before $slaves[_dom].slaveName wraps her _domRace lips around $slaves[$i].slaveName's _subRace soft dickhead to suck down the cum. @@.hotpink;$slaves[_dom].slaveName enjoys having a servile dick on demand.@@
 	<<set _penetrativeUse = random(9,12)>>
 	<<set $slaves[_dom].oralCount += _penetrativeUse, $oralTotal += _penetrativeUse>>
-<<elseif ($slaves[$i].dick > 0) && ($slaves[$i].balls != 0) && ($slaves[_dom].fetishKnown == 1) && ($slaves[_dom].fetishStrength > 60) && ($slaves[_dom].fetish == "cumslut")>>
-	Since $slaves[_dom].slaveName loves cum, and $slaves[$i].slaveName has a dick, $slaves[_dom].slaveName has her own private semen dispenser. $slaves[_dom].slaveName sometimes gets tired of having to work hard for cum, so she spends the week stimulating poor $slaves[$i].slaveName's prostate to force her to climax so $slaves[_dom].slaveName can wrap her <<if $seeRace == 1>>$slaves[_dom].race <</if>>lips around $slaves[$i].slaveName's <<if $seeRace == 1>>$slaves[$i].race <</if>>dickhead to suck down her cum. @@.hotpink;$slaves[_dom].slaveName enjoys having a servile dick on demand.@@
+<<elseif ($slaves[$i].dick > 0) && ($slaves[$i].balls != 0) && !["chastity", "combined chastity"].includes($slaves[$i].dickAccessory)>> && ($slaves[_dom].fetishKnown == 1) && ($slaves[_dom].fetishStrength > 60) && ($slaves[_dom].fetish == "cumslut")>>
+	Since $slaves[_dom].slaveName loves cum, and $slaves[$i].slaveName has a dick, $slaves[_dom].slaveName has her own private semen dispenser. $slaves[_dom].slaveName sometimes gets tired of having to work hard for cum, so she spends the week
+	<<if $slaves[_dom].amp != 1>>
+		stimulating poor $slaves[$i].slaveName's <<if $slaves[$i].prostate>>prostate<<else>>balls<</if>> to force
+	<<else>>
+		ordering $slaves[$i].slaveName to stimulate her own <<if $slaves[$i].prostate>>prostate<<else>>balls<</if>> to force
+	<</if>>
+	her to climax so $slaves[_dom].slaveName can wrap her _domRace lips around $slaves[$i].slaveName's _subRace dickhead to suck down her cum. @@.hotpink;$slaves[_dom].slaveName enjoys having a servile dick on demand.@@
 	<<set _penetrativeUse = random(9,12)>>
 	<<set $slaves[_dom].oralCount += _penetrativeUse, $oralTotal += _penetrativeUse>>
 <<elseif ($slaves[_dom].energy > 95)>>
 	<<if ($slaves[$i].devotion < -20)>>
-		Since $slaves[_dom].slaveName loves to fuck, $slaves[$i].slaveName spends the week getting fucked. $slaves[_dom].slaveName's <<if $seeRace == 1>>$slaves[_dom].race <</if>>body atop $slaves[$i].slaveName's resisting <<if $seeRace == 1>>$slaves[$i].race <</if>>form is a frequent sight as $slaves[_dom].slaveName takes her pleasure. @@.hotpink;$slaves[_dom].slaveName enjoys being able to use $slaves[$i].slaveName.@@
+		Since $slaves[_dom].slaveName loves to fuck, $slaves[$i].slaveName spends the week getting fucked. $slaves[_dom].slaveName's _domRace body atop $slaves[$i].slaveName's resisting _subRace form is a frequent sight as $slaves[_dom].slaveName takes her pleasure. @@.hotpink;$slaves[_dom].slaveName enjoys being able to use $slaves[$i].slaveName.@@
 	<<elseif ($slaves[$i].devotion <= 50)>>
-		Since $slaves[_dom].slaveName loves to fuck, $slaves[$i].slaveName spends the week getting fucked. $slaves[_dom].slaveName's <<if $seeRace == 1>>$slaves[_dom].race <</if>>body atop $slaves[$i].slaveName's compliant <<if $seeRace == 1>>$slaves[$i].race <</if>>form is a frequent sight as $slaves[_dom].slaveName takes her pleasure. @@.hotpink;$slaves[_dom].slaveName enjoys being able to use $slaves[$i].slaveName.@@
+		Since $slaves[_dom].slaveName loves to fuck, $slaves[$i].slaveName spends the week getting fucked. $slaves[_dom].slaveName's _domRace body atop $slaves[$i].slaveName's compliant _subRace form is a frequent sight as $slaves[_dom].slaveName takes her pleasure. @@.hotpink;$slaves[_dom].slaveName enjoys being able to use $slaves[$i].slaveName.@@
+	<<else>>
+		Since $slaves[_dom].slaveName loves to fuck, $slaves[$i].slaveName spends the week getting fucked. $slaves[_dom].slaveName's _domRace body atop $slaves[$i].slaveName's enthusiastic _subRace form is a frequent sight as the two of them share pleasure. @@.hotpink;$slaves[_dom].slaveName enjoys having an extra outlet for her sexual needs.@@
+	<</if>>
+	<<if canPenetrate($slaves[_dom])>>
+		<<set _fuckCount = random(9,12)>>
+		<<SimpleSlaveSlaveFucking $slaves[$i] $slaves[_dom] _fuckCount>>
+	<<elseif canPenetrate($slaves[$i]) && ((canDoVaginal($slaves[_dom]) && $slaves[_dom].vagina > 0) || (canDoAnal($slaves[_dom]) && $slaves[_dom].anus > 0))>> /* yes, that means she rides her */
+		<<set _fuckCount = random(9,12)>>
+		<<SimpleSlaveSlaveFucking $slaves[_dom] $slaves[$i] _fuckCount>>
 	<<else>>
-		Since $slaves[_dom].slaveName loves to fuck, $slaves[$i].slaveName spends the week getting fucked. $slaves[_dom].slaveName's <<if $seeRace == 1>>$slaves[_dom].race <</if>>body atop $slaves[$i].slaveName's enthusiastic <<if $seeRace == 1>>$slaves[$i].race <</if>>form is a frequent sight as the two of them share pleasure. @@.hotpink;$slaves[_dom].slaveName enjoys having an extra outlet for her sexual needs.@@
+		<<set _oralUse = random(9,12)>>
 	<</if>>
-	<<set _oralUse = random(9,12)>>
-	<<set $slaves[_dom].oralCount += _oralUse, $oralTotal += _oralUse>>
 <<elseif ($slaves[_dom].dick > 0) && canPenetrate($slaves[_dom])>>
 	<<if ($slaves[$i].devotion < -20)>>
 		$slaves[_dom].slaveName doesn't get to use her still-functional cock as much as she would like; it often stands stiff and untended while she's being used. Not this week: $slaves[$i].slaveName spends the week with $slaves[_dom].slaveName's <<if $seeRace == 1>>$slaves[_dom].race <</if>>dick between her <<if $seeRace == 1>>$slaves[$i].race <</if>>lips, whenever she feels like forcing it into $slaves[$i].slaveName's unwilling mouth. @@.hotpink;$slaves[_dom].slaveName loves having someone to facefuck whenever she wants.@@
@@ -587,6 +600,6 @@ is serving ''$slaves[_dom].slaveName'' this week.
 	<</if>>
 <</if>>
 
-<<set $slaves[$i].tired = 1>> /* why was this applied to the dom slave? Seems like a good way to hider them. */
+<<set $slaves[$i].tired = 1>> /* why was this applied to the dom slave? Seems like a good way to hinder them. */
 
 <</if>>
diff --git a/src/utility/miscWidgets.tw b/src/utility/miscWidgets.tw
index 4e5e29f15b4..5ca246da568 100644
--- a/src/utility/miscWidgets.tw
+++ b/src/utility/miscWidgets.tw
@@ -383,6 +383,92 @@
 <</if>>
 <</widget>>
 
+/%
+ Call as <<SimpleSlaveSlaveFucking subslave domslave 5>> or <<SimpleSlaveSlaveFucking subslave domslave>>
+ $arg[2] is how many times to increment either the Vaginal, Anal, or Oral counts, depending on availability on $arg[0].
+ If left undefined it will assume it to be 1.
+ Intended to be a simple "x got fucked y times by z and I don't want to keep coding it".
+%/
+<<widget "SimpleSlaveSlaveFucking">>
+<<if $args[2]>>
+	<<for _miscW = 0; _miscW < $args[2]; _miscW++>>
+		<<set _fuckTarget = random(1,100)>>
+		<<if canDoVaginal($args[0]) && $args[0].vagina > 0 && canPenetrate($args[1]) && _fuckTarget > 33>>
+			<<if passage() == "SA serve your other slaves">>
+				<<if $args[0].ID == $slaves[$i].ID>>
+					<<set _vaginalUse++>>
+					<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+				<<else>>
+					<<set _penetrativeUse++>>
+					<<set $vaginalTotal++, $args[0].vaginalCount++>>
+				<</if>>
+			<<else>>
+				<<set $vaginalTotal++, $args[0].vaginalCount++>>
+				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+			<</if>>
+			<<if canImpreg($args[0], $args[1])>>
+				<<KnockMeUp $args[0] 3 0 $args[1].ID 1>>
+			<</if>>
+		<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && canPenetrate($args[1]) && _fuckTarget > 10>>
+			<<if canImpreg($args[0], $args[1])>>
+				<<KnockMeUp $args[0] 3 1 $args[1].ID 1>>
+			<</if>>
+			<<if passage() == "SA serve your other slaves">>
+				<<if $args[0].ID == $slaves[$i].ID>>
+					<<set _analUse++>>
+					<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+				<<else>>
+					<<set _penetrativeUse++>>
+					<<set $analTotal++, $args[0].analCount++>>
+				<</if>>
+			<<else>>
+				<<set $analTotal++, $args[0].analCount++>>
+				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+			<</if>>
+		<<else>>
+			<<set $oralTotal++, $args[0].oralCount++>>
+		<</if>>
+	<</for>>
+<<else>>
+	<<set _fuckTarget = random(1,100)>>
+	<<if canDoVaginal($args[0]) && $args[0].vagina > 0 && canPenetrate($args[1]) && _fuckTarget > 33>>
+		<<if passage() == "SA serve your other slaves">>
+			<<if $args[0].ID == $slaves[$i].ID>>
+				<<set _vaginalUse++>>
+				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+			<<else>>
+				<<set _penetrativeUse++>>
+				<<set $vaginalTotal++, $args[0].vaginalCount++>>
+			<</if>>
+		<<else>>
+			<<set $vaginalTotal++, $args[0].vaginalCount++>>
+			<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+		<</if>>
+		<<if canImpreg($args[0], $args[1])>>
+			<<KnockMeUp $args[0] 3 0 $args[1].ID 1>>
+		<</if>>
+	<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && canPenetrate($args[1]) && _fuckTarget > 10>>
+		<<if passage() == "SA serve your other slaves">>
+			<<if $args[0].ID == $slaves[$i].ID>>
+				<<set _analUse++>>
+				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+			<<else>>
+				<<set _penetrativeUse++>>
+				<<set $analTotal++, $args[0].analCount++>>
+			<</if>>
+		<<else>>
+			<<set $analTotal++, $args[0].analCount++>>
+			<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
+		<</if>>
+		<<if canImpreg($args[0], $args[1])>>
+			<<KnockMeUp $args[0] 3 1 $args[1].ID 1>>
+		<</if>>
+	<<else>>
+		<<set $oralTotal++, $args[0].oralCount++>>
+	<</if>>
+<</if>>
+<</widget>>
+
 /%
  Call as <<SimpleVaginaFuck slave 5>> or <<SimpleVaginaFuck slave>>
  $arg[1] is how many times to increment either the Vaginal count.
-- 
GitLab