diff --git a/src/Mods/DinnerParty/dinnerPartyExecution.tw b/src/Mods/DinnerParty/dinnerPartyExecution.tw index 92cec1cbe427a6e9e89b3430fa3d0adbcde71e14..4e6c863d5ad70d2f9e9bd1e057bdebdb698d393f 100644 --- a/src/Mods/DinnerParty/dinnerPartyExecution.tw +++ b/src/Mods/DinnerParty/dinnerPartyExecution.tw @@ -557,11 +557,8 @@ /*<br style="clear:both" />*/ <br> - <<if $activeSlave.origin != 0>> - <<set $toSearch = $activeSlave.origin>> - <<if $toSearch.indexOf("Slave Shelter") != -1>> - <<set $shelterAbuse += 1>> - <</if>> + <<if isShelterSlave($activeSlave)>> + <<set $shelterAbuse += 1>> <</if>> <<= removeActiveSlave() >> diff --git a/src/js/assayJS.js b/src/js/assayJS.js index 4190785dd6ba934a70aef69c497288a650fd8c81..2333008aae8e1822e05ff258608aba080874c5fd 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -1815,3 +1815,11 @@ window.retirementReady = function RetirementReady(slave) { // no retirement for you return false; }; + +/** Is the slave a shelter slave? + * @param {SlaveState} slave + * @returns {boolean} + */ +window.isShelterSlave = function isShelterSlave(slave) { + return (typeof slave.origin === "string" && slave.origin.includes("Slave Shelter")); +}; diff --git a/src/pregmod/newChildIntro.tw b/src/pregmod/newChildIntro.tw index cfb1917caea79307c0a683789951c950c2c93689..923a1d9f05e23d86f2744359f8dd4ffb6acaacbc 100644 --- a/src/pregmod/newChildIntro.tw +++ b/src/pregmod/newChildIntro.tw @@ -1180,8 +1180,7 @@ You slowly strip down, gauging $his reactions to your show, until you are fully <</link>> <</if>> -<<set $toSearch = $activeSlave.hStyle>> -<<if ($toSearch.indexOf("shaved") == -1)>> +<<if ($activeSlave.hStyle.indexOf("shaved") == -1)>> <br><<link "Shave $his hair">> <<set $activeSlave.devotion -= 25>> <<set $activeSlave.hStyle = "shaved">> diff --git a/src/uncategorized/futureSociety.tw b/src/uncategorized/futureSociety.tw index 10451f259c24538c7b5caa3d6521f25f49bcb0dd..556d17cd2410f25d397ce74663600b7e5477cd43 100644 --- a/src/uncategorized/futureSociety.tw +++ b/src/uncategorized/futureSociety.tw @@ -626,10 +626,10 @@ You are spending <<print cashFormat($FSSpending)>> each week to support your soc <<link "Rename your obedient slaves according to Paternalist custom">> <<for $i = 0; $i < $slaves.length; $i++>> <<if ($slaves[$i].devotion > 20) || (($slaves[$i].devotion >= -20) && ($slaves[$i].trust < -20))>> - <<set $toSearch = $slaves[$i].slaveName>> - <<if ($toSearch.indexOf("Miss") == -1)>> - <<if ($toSearch.indexOf("Ms.") == -1)>> - <<if ($toSearch.indexOf("Mrs.") == -1)>> + <<set _toSearch = $slaves[$i].slaveName>> + <<if (_toSearch.indexOf("Miss") == -1)>> + <<if (_toSearch.indexOf("Ms.") == -1)>> + <<if (_toSearch.indexOf("Mrs.") == -1)>> <<if ($slaves[$i].relationship > 4)>> /* <<for $j = 0; $j < $slaves.length; $j++>> diff --git a/src/uncategorized/newSlaveIntro.tw b/src/uncategorized/newSlaveIntro.tw index 95985e80fc454625a4d194d63e79d75926efb290..fc72395e59ec7a6298090f9ad37d1a1737970e51 100644 --- a/src/uncategorized/newSlaveIntro.tw +++ b/src/uncategorized/newSlaveIntro.tw @@ -1089,8 +1089,7 @@ The legalities completed, <span class='slave-name'><<= SlaveFullName($activeSlav <br> <<default>> <<if $activeSlave.origin>> - <<set $toSearch = $activeSlave.origin>> - <<if ($toSearch.includes("enslavement for the attempted rape of a free"))>> + <<if ($activeSlave.origin.includes("enslavement for the attempted rape of a free"))>> //and since $he tried to rape you...// <br> <<link "Show $him how a professional does it">> @@ -1155,8 +1154,7 @@ The legalities completed, <span class='slave-name'><<= SlaveFullName($activeSlav <</if>> -<<set $toSearch = $activeSlave.hStyle>> -<<if ($toSearch.indexOf("shaved") == -1)>> +<<if ($activeSlave.hStyle.indexOf("shaved") == -1)>> <br> <<link "Shave $his hair">> <<replace "#introResult">> diff --git a/src/uncategorized/nonRandomEvent.tw b/src/uncategorized/nonRandomEvent.tw index 71d6335e10664faa06dce7691734d19c00d11158..03e15d6c1b64a4472ead706b4802e34792adf4e1 100644 --- a/src/uncategorized/nonRandomEvent.tw +++ b/src/uncategorized/nonRandomEvent.tw @@ -5,8 +5,7 @@ <<if $plot>> <<set _effectiveWeek = $week-$nationHate>> -<<set $toSearch = $arcologies[0].name>> -<<if (_effectiveWeek == 4) && ($toSearch.indexOf("Arcology ") != -1)>> +<<if (_effectiveWeek == 4) && ($arcologies[0].name.indexOf("Arcology ") != -1)>> <<set $Event = "arcology naming">> <<goto "Generic Plot Events">> <<elseif (_effectiveWeek >= 5 && $receiverAvailable == 0)>> diff --git a/src/uncategorized/randomNonindividualEvent.tw b/src/uncategorized/randomNonindividualEvent.tw index dd4804cf31744ff66b8f7ca70b67990a8c78796f..9eb5b09156549f54a51a2b3c846ca8ecd042a1d2 100644 --- a/src/uncategorized/randomNonindividualEvent.tw +++ b/src/uncategorized/randomNonindividualEvent.tw @@ -30,10 +30,9 @@ <<if $nicknamesAllowed == 1>> <<if $eventSlave.assignment != "be confined in the arcade">> - <<set $toSearch = $eventSlave.slaveName.toLowerCase()>> - <<if ($toSearch.indexOf("'") == -1)>> - <<if ($week-$eventSlave.weekAcquired >= 4)>> - <<if ($eventSlave.devotion >= -20)>> + <<if ($eventSlave.slaveName.indexOf("'") == -1)>> + <<if ($week-$eventSlave.weekAcquired >= 4)>> + <<if ($eventSlave.devotion >= -20)>> <<set $events.push("RE nickname")>> <<set $events.push("RE nickname")>> <<set $events.push("RE nickname")>> diff --git a/src/uncategorized/reNickname.tw b/src/uncategorized/reNickname.tw index 98f1a4ad9774a395617ec44e8e1840e2aa59cce5..9335e3222a83ad02fc282f2f431c3d7905cd12a6 100644 --- a/src/uncategorized/reNickname.tw +++ b/src/uncategorized/reNickname.tw @@ -1256,8 +1256,7 @@ <br><br> <span id="result"> -<<set $toSearch = $activeSlave.slaveName.toLowerCase()>> -<<if ($toSearch.indexOf("'") == -1)>> +<<if ($activeSlave.slaveName.indexOf("'") == -1)>> <<link "Encourage use of the nickname">> <<EventNameDelink $activeSlave>> <<replace "#result">> diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw index 8038416d56b9213553b9a6a007b13681983d9021..fd4d52667a02fbac49e3a664c2b1602253bae8bc 100644 --- a/src/uncategorized/saLongTermEffects.tw +++ b/src/uncategorized/saLongTermEffects.tw @@ -5966,24 +5966,21 @@ <<if $slaves[$i].fuckdoll == 0>> <<if $slaves[$i].fetish != "mindbroken">> - <<if typeof $slaves[$i].origin == "string">> - <<set $toSearch = $slaves[$i].origin>> - <<if $toSearch.indexOf("Slave Shelter") != -1>> - <<if ["serve in the club", "serve the public", "whore", "work in the brothel"].includes($slaves[$i].assignment)>> - <<if ($slaves[$i].trust > 20) && ($slaves[$i].health.condition > 40)>> - <<if $arcologies[0].FSPaternalist != "unset">> - Society @@.green;strongly approves@@ of how you've brought a shelter $girl health and happiness. - <<= FutureSocieties.ChangePorn("Paternalist", 2)>> - <<switch $slaves[$i].assignment>> - <<case "work in the brothel">><<run getSlaveStatisticData($slaves[$i], $facility.brothel).rep += 2*$FSSingleSlaveRep*($arcologies[0].FSPaternalist/$FSLockinLevel)>> - <</switch>> - <<elseif $arcologies[0].FSDegradationist == "unset">> - The public knows $he's a shelter $girl you took in, and is @@.green;touched@@ that $he now seems happy and healthy. - <<run repX(10, "futureSocieties", $slaves[$i])>> - <<switch $slaves[$i].assignment>> - <<case "work in the brothel">><<run getSlaveStatisticData($slaves[$i], $facility.brothel).rep += 10>> - <</switch>> - <</if>> + <<if isShelterSlave($slaves[$i])>> + <<if ["serve in the club", "serve the public", "whore", "work in the brothel"].includes($slaves[$i].assignment)>> + <<if ($slaves[$i].trust > 20) && ($slaves[$i].health.condition > 40)>> + <<if $arcologies[0].FSPaternalist != "unset">> + Society @@.green;strongly approves@@ of how you've brought a shelter $girl health and happiness. + <<= FutureSocieties.ChangePorn("Paternalist", 2)>> + <<switch $slaves[$i].assignment>> + <<case "work in the brothel">><<run getSlaveStatisticData($slaves[$i], $facility.brothel).rep += 2*$FSSingleSlaveRep*($arcologies[0].FSPaternalist/$FSLockinLevel)>> + <</switch>> + <<elseif $arcologies[0].FSDegradationist == "unset">> + The public knows $he's a shelter $girl you took in, and is @@.green;touched@@ that $he now seems happy and healthy. + <<run repX(10, "futureSocieties", $slaves[$i])>> + <<switch $slaves[$i].assignment>> + <<case "work in the brothel">><<run getSlaveStatisticData($slaves[$i], $facility.brothel).rep += 10>> + <</switch>> <</if>> <</if>> <</if>> diff --git a/src/uncategorized/seRetirement.tw b/src/uncategorized/seRetirement.tw index 8a3f643ad5c5df783b0ba2dcda56da76a4edf19f..332901687204206d68c45e99e48495636aba5076 100644 --- a/src/uncategorized/seRetirement.tw +++ b/src/uncategorized/seRetirement.tw @@ -82,16 +82,16 @@ $He's certainly going to have some adjustments to make. <</if>> <<if $activeSlave.prestigeDesc == 0>> - <<set $toSearch = "">> + <<set _toSearch = "">> <<else>> - <<set $toSearch = $activeSlave.prestigeDesc>> + <<set _toSearch = $activeSlave.prestigeDesc>> <</if>> <<if $activeSlave.porn.prestigeDesc == 0>> - <<set $toSearchAlt = "">> + <<set _toSearchAlt = "">> <<else>> - <<set $toSearchAlt = $activeSlave.porn.prestigeDesc>> + <<set _toSearchAlt = $activeSlave.porn.prestigeDesc>> <</if>> -<<if ($toSearch.indexOf("Head Girl") != -1) || ($HeadGirl.ID == $activeSlave.ID)>> +<<if (_toSearch.indexOf("Head Girl") != -1) || ($HeadGirl.ID == $activeSlave.ID)>> <br><br> $He has a reputation from $his long service as your Head Girl. To $his bemusement, and considerable satisfaction, $he has multiple job offers from slaving operations without even having to circulate $his resume. <<if $activeSlave.fetish == "sadist">> @@ -101,7 +101,7 @@ $He's certainly going to have some adjustments to make. <<else>> $His annuity means that $he doesn't have to work, but $he's inclined to do so. $His skills command reasonable wages in the slave training field, and between those prospects and $his annuity, $he stands to become wealthy. <</if>> -<<elseif ($toSearchAlt.indexOf("is world famous for") != -1)>> +<<elseif (_toSearchAlt.indexOf("is world famous for") != -1)>> <br><br> <<set _pornFame = $activeSlave.porn.prestigeDesc>> <<set _pornFame = _pornFame.replace("$He is world famous for $his career in slave pornography. Millions are intimately familiar with", "enjoy")>> diff --git a/src/uncategorized/slaveAssignmentsReport.tw b/src/uncategorized/slaveAssignmentsReport.tw index db320ebf475fb1c50d704d28b09c8f6838be4618..ad1631c7a1d06936fa2aa8a9059c61f178154bc0 100644 --- a/src/uncategorized/slaveAssignmentsReport.tw +++ b/src/uncategorized/slaveAssignmentsReport.tw @@ -820,7 +820,7 @@ $sexDemandResult.topClass = Math.trunc((($NPCSexSupply.topClass + $slaveJobValue <</if>> <</if>> -<<if $slaves[$i].origin && $slaves[$i].origin.includes("Slave Shelter")>> +<<if isShelterSlave($slaves[$i])>> <<set $shelterGirlsIDs.push($slaves[$i].ID)>> <</if>> diff --git a/src/uncategorized/slaveSold.tw b/src/uncategorized/slaveSold.tw index fb0d0139d4f1b3daa26c636554a9daf9a860fe62..82413da028bc353304a9bb8c7a39526d32a9b297 100644 --- a/src/uncategorized/slaveSold.tw +++ b/src/uncategorized/slaveSold.tw @@ -1256,11 +1256,8 @@ <</switch>> -<<if $activeSlave.origin != 0>> - <<set $toSearch = $activeSlave.origin>> - <<if $toSearch.indexOf("Slave Shelter") != -1>> - <<set $shelterAbuse += 1>> - <</if>> +<<if isShelterSlave($activeSlave)>> + <<set $shelterAbuse += 1>> <</if>> <<= removeActiveSlave() >>