From 055a53ee5315ee20166bf618d0333a3cb32754bf Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Mon, 7 Sep 2020 16:53:18 -0400
Subject: [PATCH] Pit BC

---
 js/003-data/gameVariableData.js               |  1 +
 src/002-config/fc-version.js                  |  2 +-
 src/arcologyBuilding/markets.js               |  2 +-
 .../backwardsCompatibility.js                 |  6 +++++
 src/facilities/farmyard/farmyard.js           |  4 ++--
 src/facilities/pit/pit.js                     |  2 +-
 src/interaction/budgets/recordTemplates.js    |  4 ++--
 src/js/DefaultRules.js                        |  2 +-
 src/js/assignJS.js                            |  2 +-
 src/js/rulesAssistantOptions.js               |  4 ++--
 src/pregmod/killSlave.tw                      |  4 ++--
 src/uncategorized/pePitFightInvite.tw         |  2 +-
 src/uncategorized/scheduledEvent.tw           |  4 ++--
 src/uncategorized/seLethalPit.tw              | 18 +++++++-------
 src/uncategorized/seNonlethalPit.tw           | 24 +++++++++----------
 15 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index c99a864ddf7..3ccd92ea069 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -794,6 +794,7 @@ App.Data.resetOnNGPlus = {
 	HGSuiteName: "the Head Girl Suite",
 	HGSuiteNameCaps: "The Head Girl Suite",
 
+	// Pit Subsection
 	fighterIDs: [],
 	pitBG: false,
 	pitAnimal: false,
diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js
index 80ff391fac2..f24ee049f0c 100644
--- a/src/002-config/fc-version.js
+++ b/src/002-config/fc-version.js
@@ -2,5 +2,5 @@ App.Version = {
 	base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed.
 	pmod: "3.7.1",
 	commitHash: null,
-	release: 1094
+	release: 1095
 };
diff --git a/src/arcologyBuilding/markets.js b/src/arcologyBuilding/markets.js
index 1c1e7bb8c63..8358d53c919 100644
--- a/src/arcologyBuilding/markets.js
+++ b/src/arcologyBuilding/markets.js
@@ -101,7 +101,7 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell {
 			));
 		}
 
-		if (V.pit === 0) {
+		if (!V.pit) {
 			fragment.append(this._makeUpgrade(
 				"Build a pit to host proper slave fights",
 				() => {
diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js
index 7f113d09d67..cfb482a8f57 100644
--- a/src/data/backwardsCompatibility/backwardsCompatibility.js
+++ b/src/data/backwardsCompatibility/backwardsCompatibility.js
@@ -299,6 +299,12 @@ App.Update.globalVariables = function(node) {
 	}
 
 	// Pit
+	if (typeof V.pitVirginities !== "string") {
+		const virginities = ["none", "vaginal", "anal", "all"];
+
+		V.pitVirginities = virginities[V.pitVirginities];
+	}
+
 	if (V.pitBG === 1 && V.fighterIDs.includes(V.BodyguardID)) {
 		V.fighterIDs.delete(V.BodyguardID);
 	}
diff --git a/src/facilities/farmyard/farmyard.js b/src/facilities/farmyard/farmyard.js
index cb5035a9e8f..fd100afc09d 100644
--- a/src/facilities/farmyard/farmyard.js
+++ b/src/facilities/farmyard/farmyard.js
@@ -145,8 +145,8 @@ App.Facilities.Farmyard.farmyard = function() {
 			V.activeHooved = 0;
 			V.activeFeline = 0;
 
-			V.pitAnimal = 0;
-			V.pitAnimalType = 0;
+			V.pitAnimal = false;
+			V.pitAnimalType = null;
 
 			V.canines = [];
 			V.hooved = [];
diff --git a/src/facilities/pit/pit.js b/src/facilities/pit/pit.js
index 4e634e3b3ee..33028ecae82 100644
--- a/src/facilities/pit/pit.js
+++ b/src/facilities/pit/pit.js
@@ -73,7 +73,7 @@ App.Facilities.Pit.pit = function() {
 		}
 
 		link.append(App.UI.DOM.passageLink(`Decommission ${V.pitName}`, "Main", () => {
-			V.pit = false;
+			V.pit = null;
 			V.pitAnimal = false;
 			V.pitAnimalType = null;
 			V.fighterIDs = [];
diff --git a/src/interaction/budgets/recordTemplates.js b/src/interaction/budgets/recordTemplates.js
index 9876f622f5a..7b6b1856bb6 100644
--- a/src/interaction/budgets/recordTemplates.js
+++ b/src/interaction/budgets/recordTemplates.js
@@ -95,7 +95,7 @@ App.Data.Records.LastWeeksCash = function() {
 	this.incubator = 0;
 	this.incubatorSlaves = 0;
 	this.nursery = 0;
-	this.pit = 0;
+	this.pit = null;
 	this.lab = 0;
 	this.labResearch = 0;
 	this.school = 0;
@@ -169,7 +169,7 @@ App.Data.Records.LastWeeksRep = function() {
 	this.club = 0;
 	this.publicServantClub = 0;
 	this.clubAds = 0;
-	this.pit = 0;
+	this.pit = null;
 	this.servantsQuarters = 0;
 	this.spa = 0;
 
diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js
index 73f5bd397f9..a09015b33d9 100644
--- a/src/js/DefaultRules.js
+++ b/src/js/DefaultRules.js
@@ -1541,7 +1541,7 @@ globalThis.DefaultRules = (function() {
 
 	function ProcessPit(slave, rule) {
 		if (rule.pitRules !== undefined && rule.pitRules !== null) {
-			if (V.pit > 0) {
+			if (V.pit) {
 				if (rule.pitRules === 0) {
 					removeJob(slave, Job.PIT, true);
 					r += `<br>${slave.slaveName} has been removed from the pit.`;
diff --git a/src/js/assignJS.js b/src/js/assignJS.js
index 9551ecb13cc..73a72f9daba 100644
--- a/src/js/assignJS.js
+++ b/src/js/assignJS.js
@@ -386,7 +386,7 @@ globalThis.assignJob = function(slave, job) {
 			if (V.dojo > 1) {
 				slave.rules.living = LivingRule.LUXURIOUS;
 			}
-			if (V.pitBG === 1 && V.fighterIDs.includes(slave.ID)) { V.fighterIDs.delete(slave.ID); }
+			if (V.pitBG && V.fighterIDs.includes(slave.ID)) { V.fighterIDs.delete(slave.ID); }
 			break;
 
 		case Job.AGENT.toLowerCase():
diff --git a/src/js/rulesAssistantOptions.js b/src/js/rulesAssistantOptions.js
index 5492bc3082d..84127594ddb 100644
--- a/src/js/rulesAssistantOptions.js
+++ b/src/js/rulesAssistantOptions.js
@@ -1647,8 +1647,8 @@ globalThis.rulesAssistantOptions = (function() {
 		constructor(tabButtons) {
 			super("behavior", "Behavior", tabButtons);
 			this.appendChild(new AutomaticAssignmentList());
-			if (V.pit === 1) {
-			this.appendChild(new PitAssignmentList());
+			if (V.pit) {
+				this.appendChild(new PitAssignmentList());
 			}
 			this.appendChild(new LivingStandardList());
 			this.appendChild(new RestList());
diff --git a/src/pregmod/killSlave.tw b/src/pregmod/killSlave.tw
index 9711d44f9be..cf77936bb06 100644
--- a/src/pregmod/killSlave.tw
+++ b/src/pregmod/killSlave.tw
@@ -227,7 +227,7 @@ you <<if canHear($activeSlave)>>quietly <</if>>reach behind your desk and pull o
 		<<set $killChoice = -1>>
 	<</replace>><</link>>
 	<<if $activeSlave.assignment != "guard you" && $pit && _S.Bodyguard && $activeSlave.fuckdoll <= 0 && $activeSlave.fetish != "mindbroken">>
-		<<if ($pitLethal == 1)>>
+		<<if ($pitLethal)>>
 			<br><<link "Let $him win $his life in combat">><<set $killChoice = 2>>
 			<<replace "#killScene">>
 				&nbsp;&nbsp;&nbsp;&nbsp;You tell $him that you'll let your bodyguard _S.Bodyguard.slaveName decide $his fate — if $he wants to live, $he'll have to beat _him2 in hand-to-hand combat in $pitName.
@@ -237,7 +237,7 @@ you <<if canHear($activeSlave)>>quietly <</if>>reach behind your desk and pull o
 					$He nods $his head and straightens up, as though mentally preparing $himself for the fight for $his life.
 				<</if>>
 
-				<<set $slaveFightingBG = $activeSlave, $pitAnimal = 0, $killChoice = -1>>
+				<<set $slaveFightingBG = $activeSlave, $pitAnimal = false, $killChoice = -1>>
 			<</replace>><</link>>
 		<<else>>
 			<br>//You must allow lethal fights in $pitName to have $activeSlave.slaveName fight your bodyguard for $his life//
diff --git a/src/uncategorized/pePitFightInvite.tw b/src/uncategorized/pePitFightInvite.tw
index 0ea1fc396df..4dae247fdab 100644
--- a/src/uncategorized/pePitFightInvite.tw
+++ b/src/uncategorized/pePitFightInvite.tw
@@ -11,7 +11,7 @@
 <p>Gladiatorial combat between slaves has not yet reached the level of social acceptability it once enjoyed in Rome, but it's growing in popularity. For now, most fights are discreet affairs limited to select guests. Displaying a slave bodyguard is an excellent way to get yourself invited to participate, and $assistant.name has just passed on an invitation to a private fight next week, should you be willing to hazard a bodyguard.</p>
 
 <<if $pit === 1>>
-	<p>Of course, $pitNameCaps in $arcologies[0].name sees regular fights<<if $pitLethal === 1>> to the death<</if>>, but there's something extra special about attending these outside fights<<if $pitLethal === 0>>, especially with the very real risk of violent death<</if>>.</p>
+	<p>Of course, $pitNameCaps in $arcologies[0].name sees regular fights<<if $pitLethal>> to the death<</if>>, but there's something extra special about attending these outside fights<<if !$pitLethal>>, especially with the very real risk of violent death<</if>>.</p>
 <</if>>
 
 <span id="result">
diff --git a/src/uncategorized/scheduledEvent.tw b/src/uncategorized/scheduledEvent.tw
index b1dfb9abd6f..9236d895b7c 100644
--- a/src/uncategorized/scheduledEvent.tw
+++ b/src/uncategorized/scheduledEvent.tw
@@ -148,8 +148,8 @@
 	<<goto "SE coursing">>
 <<elseif $policies.raidingMercenaries == 1 && ($week > ($raided + 6))>>
 	<<goto "SE raiding">>
-<<elseif ((($fighterIDs.length > 1) && ($pitBG == 0)) || (($fighterIDs.length > 0) && ($BodyguardID != 0) && ($pitBG == 1)) || (($pitAnimal > 0) && ($fighterIDs.length > 0)) || ($killChoice == 2)) && ($pitFought == 0)>>
-	<<if $pitLethal == 1>><<goto "SE lethal pit">><<else>><<goto "SE nonlethal pit">><</if>>
+<<elseif ((($fighterIDs.length > 1) && (!$pitBG)) || (($fighterIDs.length > 0) && ($BodyguardID != 0) && ($pitBG)) || (($pitAnimal) && ($fighterIDs.length > 0)) || ($killChoice == 2)) && ($pitFought == 0)>>
+	<<if $pitLethal>><<goto "SE lethal pit">><<else>><<goto "SE nonlethal pit">><</if>>
 <<elseif ($bioreactorPerfectedID != 0) && ($bioreactorsAnnounced != 1)>>
 	<<goto "P bioreactor perfected">>
 <<elseif ($TSS.schoolPresent == 1) && ($TSS.schoolProsperity <= -10)>>
diff --git a/src/uncategorized/seLethalPit.tw b/src/uncategorized/seLethalPit.tw
index 2ba327c1459..e465d6b0432 100644
--- a/src/uncategorized/seLethalPit.tw
+++ b/src/uncategorized/seLethalPit.tw
@@ -9,7 +9,7 @@
 	<<setLocalPronouns _fighterOne>>
 	<<setLocalPronouns _fighterTwo 2>>
 <<else>>
-	<<if $pitBG == 0>>
+	<<if !$pitBG>>
 		<<set _fighterOne = $fighterIDs.pluck()>> /* .pluck() removes the element from the array, preventing _fighterTwo from also choosing this ID */
 		<<set _fighterOne = getSlave(_fighterOne)>>
 	<<else>>
@@ -18,7 +18,7 @@
 		<<set _fighterOne = _S.Bodyguard>>
 	<</if>>
 	<<setLocalPronouns _fighterOne>>
-	<<if $pitAnimal == 0>>
+	<<if !$pitAnimal>>
 		<<set _fighterTwo = $fighterIDs.pluck()>>
 		<<set _fighterTwo = getSlave(_fighterTwo)>>
 		<<if ndef _fighterOne || ndef _fighterTwo || (_fighterOne == 0) || (_fighterTwo == 0)>>
@@ -62,7 +62,7 @@
 	<</if>>
 <</if>>
 
-This week's pit fight is between _fighterOne.slaveName and <<if $pitAnimal == 0>>_fighterTwo.slaveName<<else>>a _animal.species<</if>>.
+This week's pit fight is between _fighterOne.slaveName and <<if !$pitAnimal>>_fighterTwo.slaveName<<else>>a _animal.species<</if>>.
 <<if $pitAudience == "none">>
 	You are alone above the pit, left to watch them kill and die in private.
 <<elseif $pitAudience == "free">>
@@ -81,7 +81,7 @@ This week's pit fight is between _fighterOne.slaveName and <<if $pitAnimal == 0>
 	<<set $arcologies[0].FSAztecRevivalist += 0.2*$FSSingleSlaveRep>>
 <</if>>
 
-You review the rules — the <<if $pitAnimal == 0>>combatants<<else>>slave<</if>> will use their choice of swords, and the fight will be to the death<<if $pitAnimal == 0>>, with both combatants executed if no decision is reached<</if>>. <<if $pitAnimal == 0>>The winner<<else>>If $he wins, $he<</if>> will earn two complete days of rest, not to mention continued life. You take a moment to look over your <<if $pitAnimal == 0>>fighters<<else>>slave<</if>> before giving the word. After all, it<<if $pitAnimal == 0>>'s<<else>> might be<</if>> the last time you'll be seeing <<if $pitAnimal == 0>>one of them<<else>>$him<</if>> alive.
+You review the rules — the <<if !$pitAnimal>>combatants<<else>>slave<</if>> will use their choice of swords, and the fight will be to the death<<if !$pitAnimal>>, with both combatants executed if no decision is reached<</if>>. <<if !$pitAnimal>>The winner<<else>>If $he wins, $he<</if>> will earn two complete days of rest, not to mention continued life. You take a moment to look over your <<if !$pitAnimal>>fighters<<else>>slave<</if>> before giving the word. After all, it<<if !$pitAnimal>>'s<<else>> might be<</if>> the last time you'll be seeing <<if !$pitAnimal>>one of them<<else>>$him<</if>> alive.
 
 <br><br>
 
@@ -244,7 +244,7 @@ You review the rules — the <<if $pitAnimal == 0>>combatants<<else>>slave<</if>
 <</if>>
 
 <br><br>
-<<if $pitAnimal == 0>>
+<<if !$pitAnimal>>
 	<<set _fighterTwoDeadliness = Deadliness(_fighterTwo)>>
 
 	<<if _fighterTwo.fetish == "mindbroken">>
@@ -415,7 +415,7 @@ You review the rules — the <<if $pitAnimal == 0>>combatants<<else>>slave<</if>
 	<</switch>>
 <</if>>
 
-In any case, <<if $pitAnimal == 0>>both of the slaves have<<else>>the slave and the _animal.species have both<</if>> been dosed with aggression enhancers and inhibition blockers; they'll fight to kill.
+In any case, <<if !$pitAnimal>>both of the slaves have<<else>>the slave and the _animal.species have both<</if>> been dosed with aggression enhancers and inhibition blockers; they'll fight to kill.
 
 <br><br>
 
@@ -441,7 +441,7 @@ In any case, <<if $pitAnimal == 0>>both of the slaves have<<else>>the slave and
 	<<set _winnerDeadliness = _fighterOneDeadliness>>
 <</if>>
 
-<<if $pitAnimal == 0>>
+<<if !$pitAnimal>>
 	<<setLocalPronouns _winner>>
 	<<setLocalPronouns _loser 2>>
 	<<if !canSee(_winner) && !canSee(_loser)>>
@@ -811,10 +811,10 @@ In any case, <<if $pitAnimal == 0>>both of the slaves have<<else>>the slave and
 	<<set $pitKillsTotal += 1>>
 
 	<<set $slaves[$slaveIndices[_winner.ID]] = _winner>>
-	<<if $pitBG == 0 || ($BodyguardID != _winner.ID)>>
+	<<if !$pitBG || ($BodyguardID != _winner.ID)>>
 		<<set $fighterIDs.push(_winner.ID)>>
 	<</if>>
-	<<if $pitAnimal == 0>>
+	<<if !$pitAnimal>>
 		<<set $activeSlave = getSlave(_loser.ID)>>
 		<<= removeActiveSlave() >>
 	<</if>>
diff --git a/src/uncategorized/seNonlethalPit.tw b/src/uncategorized/seNonlethalPit.tw
index f2681f855a0..a92c35ef860 100644
--- a/src/uncategorized/seNonlethalPit.tw
+++ b/src/uncategorized/seNonlethalPit.tw
@@ -2,7 +2,7 @@
 
 <<set $nextButton = "Continue", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event", $pitFought = 1, _fighterOne = 0, _fighterTwo = 0>>
 
-<<if $pitBG == 0>>
+<<if !$pitBG>>
 	<<set _fighterOne = $fighterIDs.pluck()>> /* .pluck() removes the element from the array, preventing _fighterTwo from also choosing this ID */
 	<<set _fighterOne = getSlave(_fighterOne)>>
 <<else>>
@@ -11,7 +11,7 @@
 	<<set _fighterOne = _S.Bodyguard>>
 <</if>>
 <<setLocalPronouns _fighterOne>>
-<<if $pitAnimal == 0>>
+<<if !$pitAnimal>>
 	<<set _fighterTwo = $fighterIDs.pluck()>>
 	<<set _fighterTwo = getSlave(_fighterTwo)>>
 	<<if ndef _fighterOne || ndef _fighterTwo || (_fighterOne == 0) || (_fighterTwo == 0)>>
@@ -54,19 +54,19 @@
 	</span>
 <</if>>
 
-<<if $pitAnimal == 0>>
+<<if !$pitAnimal>>
 	This week's pit fight is between _fighterOne.slaveName and _fighterTwo.slaveName.
 <<elseif $pitAnimal == 1>>
 	This week a _animal.species is going to try to use _fighterOne.slaveName.
 <<else>>
 	This week, _fighterOne.slaveName was scheduled to be used by an animal, but is spared because no animal has been chosen.
 	<<set $slaves[$slaveIndices[_fighterOne.ID]] = _fighterOne>>
-	<<if $pitBG == 0 || ($BodyguardID != _fighterOne.ID)>>
+	<<if !$pitBG || ($BodyguardID != _fighterOne.ID)>>
 		<<set $fighterIDs.push(_fighterOne.ID)>>
 	<</if>>
 <</if>>
 
-<<if $pitAnimal == 0>>
+<<if !$pitAnimal>>
 	<<if $pitAudience == "none">>You are alone above $pitName, left to watch them square off in private.<<elseif $pitAudience == "free">>Your guests line the rim of $pitName, joking and betting.<<else>>The attendees line the rim of $pitName, betting and arguing.<</if>>
 
 	<<if $arcologies[0].FSRomanRevivalist != "unset">>
@@ -76,13 +76,13 @@
 	<</if>>
 
 	You review the rules — the combatants are wearing light gloves, and the fight will be nonlethal, with you as the judge. The winner will have the right to do anything they wish to the loser,
-	<<if $pitVirginities == 0>>
+	<<if $pitVirginities == "neither">>
 		even take virginities,
-	<<elseif $pitVirginities == 1>>
+	<<elseif $pitVirginities == "virginity">>
 		except take their virginity,
-	<<elseif $pitVirginities == 2>>
+	<<elseif $pitVirginities == "anal">>
 		except take their anal virginity,
-	<<elseif $pitVirginities == 3>>
+	<<elseif $pitVirginities == "all">>
 		except take virginities,
 	<</if>>
 	and earn two complete days of rest. You take a moment to look over your fighters before giving the word.
@@ -952,10 +952,10 @@
 
 	<<set $slaves[$slaveIndices[_winner.ID]] = _winner>>
 	<<set $slaves[$slaveIndices[_loser.ID]] = _loser>>
-	<<if $pitBG == 0 || ($BodyguardID != _winner.ID)>>
+	<<if !$pitBG || ($BodyguardID != _winner.ID)>>
 		<<set $fighterIDs.push(_winner.ID)>>
 	<</if>>
-	<<if $pitBG == 0 || ($BodyguardID != _loser.ID)>>
+	<<if !$pitBG || ($BodyguardID != _loser.ID)>>
 		<<set $fighterIDs.push(_loser.ID)>>
 	<</if>>
 
@@ -1031,7 +1031,7 @@
 		/* TODO: write an ending / post-fight message */
 	<</if>>
 	<<set $slaves[$slaveIndices[_fighterOne.ID]] = _fighterOne>>
-	<<if $pitBG == 0 || ($BodyguardID != _fighterOne.ID)>>
+	<<if !$pitBG || ($BodyguardID != _fighterOne.ID)>>
 		<<set $fighterIDs.push(_fighterOne.ID)>>
 	<</if>>
 <</if>>
-- 
GitLab