From 978096d98eeb8e84ac5158aaef54ef71ebe70d09 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Tue, 8 Sep 2020 00:57:42 -0400
Subject: [PATCH] no it probably shouldn't.

---
 js/003-data/gameVariableData.js |  1 -
 src/js/slaveCostJS.js           | 19 ++++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 133a49e073b..045b9036fdc 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -852,7 +852,6 @@ App.Data.resetOnNGPlus = {
 	shelterAbuse: 0,
 	shelterSlaveGeneratedWeek: 0,
 
-	specialSlavesPriceOverride: 0,
 	pregAccessibility: 0,
 	dickAccessibility: 0,
 	ballsAccessibility: 0,
diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js
index a9b89655ef5..3ef9b8a009e 100644
--- a/src/js/slaveCostJS.js
+++ b/src/js/slaveCostJS.js
@@ -2281,11 +2281,12 @@ globalThis.FResultTooltip = function(slave, forSale = 0) {
  * @param {App.Entity.SlaveState} slave
  * @param {boolean} [isStartingSlave=false] is the slave a "starting slave"
  * @param {boolean} [followLaws=false] Apply cost variations from enacted Slave Market Regulations
+ * @param {boolean} [isSpecial=false] is this slave a special/hero slave
  * @returns {number}
  */
-globalThis.slaveCost = function(slave, isStartingSlave = false, followLaws = false) {
+globalThis.slaveCost = function(slave, isStartingSlave = false, followLaws = false, isSpecial = false) {
 	const milked = App.SlaveAssignment.getMilked(slave, true);
-	const beauty = slaveCostBeauty(slave, isStartingSlave, followLaws);
+	const beauty = slaveCostBeauty(slave, isStartingSlave, followLaws, isSpecial);
 	if ((milked * 52) > beauty && !isStartingSlave) { // Arbitrarily, let's say their milk worth is what they would make in a year. Blocking starting slave for now because milk makes so much money, the estimation makes game start impossible.
 		return milked * 52;
 	} else {
@@ -2304,15 +2305,16 @@ globalThis.slaveCostBeauty = (function() {
 	 * @param {App.Entity.SlaveState} slave
 	 * @param {boolean} isStartingSlave is the slave a "starting slave"
 	 * @param {boolean} followLaws Apply cost variations from enacted Slave Market Regulations
+	 * @param {boolean} isSpecial is this slave a special/hero slave
 	 * @returns {number}
 	 */
-	function slaveCost(slave, isStartingSlave, followLaws) {
+	function slaveCost(slave, isStartingSlave, followLaws, isSpecial) {
 		arcology = V.arcologies[0];
 		multiplier = V.slaveCostFactor;
 		cost = Beauty(slave) * FResult(slave, 1);
 
 		calcGenitalsCost(slave);
-		calcDevotionTrustCost(slave);
+		calcDevotionTrustCost(slave, isSpecial);
 		calcPreferencesCost(slave);
 		calcPregCost(slave);
 		if (slave.prestige + slave.porn.prestige > 0) {
@@ -2373,9 +2375,10 @@ globalThis.slaveCostBeauty = (function() {
 
 	/**
 	 * @param {App.Entity.SlaveState} slave
+	 * @param {boolean} isSpecial
 	 */
-	function calcDevotionTrustCost(slave) {
-		if (V.specialSlavesPriceOverride === 1) {
+	function calcDevotionTrustCost(slave, isSpecial) {
+		if (isSpecial === true) {
 			if (slave.devotion > 50) {
 				multiplier += slave.devotion / 200;
 			}
@@ -2811,9 +2814,7 @@ globalThis.startingSlaveCost = function(slave) {
  * @returns {number}
  */
 globalThis.heroSlaveCost = function(slave, costFloor) {
-	V.specialSlavesPriceOverride = 1; // TODO: this probably shouldn't be a global
-	let cost = (10 * Math.trunc((slaveCost(slave) / 10) * 2));
-	V.specialSlavesPriceOverride = 0;
+	let cost = (10 * Math.trunc((slaveCost(slave, false, false, true) / 10) * 2));
 	if (cost < costFloor) {
 		cost += jsRandom(Math.trunc(costFloor / 2000), Math.trunc((costFloor * 3) / 2000)) * 1000;
 	}
-- 
GitLab