From c359aefedbb6554c21425595c4461d6c61488bf6 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Mon, 30 Nov 2020 15:59:02 -0500
Subject: [PATCH] remove more globals

---
 .../bodyModification/bodyModification.js      | 48 ++++++++++---------
 src/interaction/siModify.js                   |  1 -
 src/js/modification.js                        |  2 -
 3 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/src/facilities/bodyModification/bodyModification.js b/src/facilities/bodyModification/bodyModification.js
index 990048a3568..7c95cdad7f2 100644
--- a/src/facilities/bodyModification/bodyModification.js
+++ b/src/facilities/bodyModification/bodyModification.js
@@ -15,6 +15,8 @@ App.UI.bodyModification = function(slave, cheat = false) {
 	let modReaction;
 	let scarApplied;
 	let tattooChoice;
+	let brandApplied;
+	let degradation;
 
 	container.append(createPage());
 	return container;
@@ -45,7 +47,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 	function reaction() {
 		const el = new DocumentFragment();
 		let r = [];
-		if (V.brandApplied || V.degradation || scarApplied || modReaction) {
+		if (brandApplied || degradation || scarApplied || modReaction) {
 			if (slave.fuckdoll === 0) {
 				if (canSee(slave)) {
 					r.push(`There's a mirror on the ceiling, so ${he} can see`);
@@ -59,10 +61,10 @@ App.UI.bodyModification = function(slave, cheat = false) {
 				}
 				r.push(`${his} new appearance.`);
 			}
-			if (V.brandApplied) {
+			if (brandApplied) {
 				r.push(`The smell of burnt flesh hangs in the air. Being branded <span class="health.dec">has hurt ${his} health a little.</span>`);
 				healthDamage(slave, 10);
-				V.brandApplied = 0;
+				brandApplied = false;
 			}
 			if (scarApplied) {
 				if (V.scarTarget.local === "entire body") {
@@ -151,8 +153,8 @@ App.UI.bodyModification = function(slave, cheat = false) {
 				scarApplied = false;
 			}
 			if (slave.fetish !== "mindbroken" && slave.fuckdoll === 0) {
-				if (V.degradation > 1) {
-					if (V.degradation > 5) {
+				if (degradation > 1) {
+					if (degradation > 5) {
 						if (slave.devotion <= 50 && slave.trust < -50) {
 							r.push(`${He} is appalled by the whorish spectacle you have made of ${him}. ${He} <span class="gold">fears</span> you all the more for this but is so terrified of you it does not affect ${his} submission.`);
 							slave.trust -= 10;
@@ -183,7 +185,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							slave.devotion += 2;
 						}
 					}
-					V.degradation = 0;
+					degradation = 0;
 				}
 				if (modReaction) {
 					r.push(modReaction);
@@ -281,7 +283,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							if (slave[`${location}Piercing`] !== piercingLevel) {
 								modReaction += App.Medicine.Modification.setPiercing(slave, location, piercingLevel);
 								if (piercingLevel > 1) {
-									V.degradation += 1;
+									degradation += 1;
 								}
 							}
 						}
@@ -300,7 +302,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 								modReaction = "";
 								modReaction += App.Medicine.Modification.setPiercing(slave, location, piercingLevel);
 								if (piercingLevel > 1) {
-									V.degradation += 1;
+									degradation += 1;
 								}
 								refresh();
 							}
@@ -320,7 +322,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							() => {
 								modReaction = App.Medicine.Modification.setPiercing(slave, "clit", 3);
 								slave.clitSetting = "all";
-								V.degradation += 1;
+								degradation += 1;
 								refresh();
 							},
 							[],
@@ -513,7 +515,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 			tattooChoice = (location === "lips" && tattooChoice === "scenes") ? "permanent makeup" : tattooChoice;
 			modReaction += App.Medicine.Modification.setTattoo(slave, tattooLocations.get(location), tattooChoice);
 			if (!["flowers", "paternalist", "tribal patterns", 0].includes(tattooChoice)) {
-				V.degradation += 1;
+				degradation += 1;
 			}
 		}
 
@@ -609,7 +611,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 						scarApplied = 0;
 						delete slave.scar[_scarName];
 						cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave);
-						V.degradation -= 10;
+						degradation -= 10;
 						refresh();
 					}
 				)
@@ -772,7 +774,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							scarApplied = 1;
 							App.Medicine.Modification.addScar(slave, _leftTarget, V.scarDesign.local);
 							cashX(forceNeg(V.modCost), "slaveMod", slave);
-							V.degradation += 10;
+							degradation += 10;
 							refresh();
 						}
 					)
@@ -794,7 +796,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							scarApplied = 1;
 							App.Medicine.Modification.addScar(slave, _rightTarget, V.scarDesign.local);
 							cashX(forceNeg(V.modCost), "slaveMod", slave);
-							V.degradation += 10;
+							degradation += 10;
 							refresh();
 						}
 					)
@@ -844,12 +846,12 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							}
 							for (const scar of _scarArray) {
 								App.Medicine.Modification.addScar(slave, scar, V.scarDesign.local);
-								V.degradation += 10;
+								degradation += 10;
 							}
 						}
 						cashX(forceNeg(V.modCost), "slaveMod", slave);
 						scarApplied = 1;
-						V.degradation += 10;
+						degradation += 10;
 						refresh();
 					}
 				)
@@ -882,10 +884,10 @@ App.UI.bodyModification = function(slave, cheat = false) {
 					App.UI.DOM.link(
 						"Remove Brand",
 						() => {
-							V.brandApplied = 0;
+							brandApplied = false;
 							delete slave.brand[brandPlace];
 							cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave);
-							V.degradation -= 10;
+							degradation -= 10;
 							refresh();
 						},
 					)
@@ -989,10 +991,10 @@ App.UI.bodyModification = function(slave, cheat = false) {
 						App.UI.DOM.link(
 							"left",
 							() => {
-								V.brandApplied = 1;
+								brandApplied = true;
 								slave.brand[leftTarget] = check(V.brandDesign.local);
 								cashX(forceNeg(V.modCost), "slaveMod", slave);
-								V.degradation += 10;
+								degradation += 10;
 								refresh();
 							},
 						)
@@ -1021,10 +1023,10 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							App.UI.DOM.link(
 								"right",
 								() => {
-									V.brandApplied = 1;
+									brandApplied = true;
 									slave.brand[rightTarget] = check(V.brandDesign.local);
 									cashX(forceNeg(V.modCost), "slaveMod", slave);
-									V.degradation += 10;
+									degradation += 10;
 									refresh();
 								},
 							)
@@ -1056,10 +1058,10 @@ App.UI.bodyModification = function(slave, cheat = false) {
 						App.UI.DOM.link(
 							"Brand",
 							() => {
-								V.brandApplied = 1;
+								brandApplied = true;
 								slave.brand[V.brandTarget.local] = V.brandDesign.local;
 								cashX(forceNeg(V.modCost), "slaveMod", slave);
-								V.degradation += 10;
+								degradation += 10;
 								refresh();
 							},
 						)
diff --git a/src/interaction/siModify.js b/src/interaction/siModify.js
index 5cd0a327c8d..5d603360c88 100644
--- a/src/interaction/siModify.js
+++ b/src/interaction/siModify.js
@@ -34,7 +34,6 @@ App.UI.SlaveInteract.modify = function(slave) {
 
 	makeRoomLink(el, "Body mod studio", "Body Modification", ' Mark your slave with piercings, tattoos, brands or even scars.',
 		() => {
-			V.degradation = 0;
 			V.tattooChoice = undefined;
 		},
 	);
diff --git a/src/js/modification.js b/src/js/modification.js
index 7fbad8112b4..ea240fbf910 100644
--- a/src/js/modification.js
+++ b/src/js/modification.js
@@ -8,7 +8,6 @@
 App.Medicine.Modification.addScar = function(slave, scar, design, weight) {
 	/*
 	V.scarApplied = 1;
-	V.degradation += 10;
 	surgeryDamage(slave, 10); // dangerous to uncomment this as sometimes many scars are applied at once.
 	cashX(forceNeg(surgery.costs), "slaveSurgery", slave);
 	surgeryDamage(slave, (V.PC.skill.medicine >= 100) ? Math.round(surgery.healthCosts / 2) : surgery.healthCosts);*/
@@ -33,7 +32,6 @@ App.Medicine.Modification.addScar = function(slave, scar, design, weight) {
 App.Medicine.Modification.removeScar = function(slave, scar, design) {
 	/*
 	V.scarApplied = 1;
-	V.degradation += 10;
 	surgeryDamage(slave, 10); //dangerous to uncomment this as sometimes many scars are applied at once.
 	cashX(forceNeg(surgery.costs), "slaveSurgery", slave);
 	surgeryDamage(slave, (V.PC.skill.medicine >= 100) ? Math.round(surgery.healthCosts / 2) : surgery.healthCosts);*/
-- 
GitLab