From 84a478c56b8594323b2a73b85e5e9ac335c46a90 Mon Sep 17 00:00:00 2001 From: kopareigns <kopareigns@gmail.com> Date: Fri, 13 Apr 2018 21:37:45 -0400 Subject: [PATCH] slaveIndices Conversion --- src/uncategorized/pRivalInitiation.tw | 6 ++-- src/uncategorized/pSchoolSuggestion.tw | 2 +- src/uncategorized/ptWorkaround.tw | 4 +-- src/uncategorized/reLegendaryBalls.tw | 2 +- src/uncategorized/reLegendaryCow.tw | 2 +- src/uncategorized/reLegendaryEntertainer.tw | 2 +- src/uncategorized/reLegendaryWhore.tw | 2 +- src/uncategorized/reMalefactor.tw | 2 +- src/uncategorized/reMilfTourist.tw | 2 +- src/uncategorized/reRelationshipAdvice.tw | 30 ++++--------------- src/uncategorized/reRelativeRecruiter.tw | 4 +-- src/uncategorized/reShelterInspection.tw | 2 +- src/uncategorized/reShowerPunishment.tw | 32 +++++++-------------- src/uncategorized/reSlaveMarriage.tw | 20 ++----------- src/uncategorized/rename.tw | 23 ++++++--------- 15 files changed, 42 insertions(+), 93 deletions(-) diff --git a/src/uncategorized/pRivalInitiation.tw b/src/uncategorized/pRivalInitiation.tw index 8333e4fc24a..48fe81be160 100644 --- a/src/uncategorized/pRivalInitiation.tw +++ b/src/uncategorized/pRivalInitiation.tw @@ -3,7 +3,7 @@ <<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "Scheduled Event", $rivalOwner = 0, $rivalOwnerEnslaved = 1>> <<if $hostageRescued == 1>><<set $nextButton = "See to the hostage", $returnTo = "P hostage acquisition">><</if>> -<<set $activeSlave = $slaves.find(function(s) { return s.ID == $rivalID; })>> +<<set $activeSlave = getSlave($rivalID)>> <<set $rivalID = 0>> <<if ndef $activeSlave>> /* rival slave is gone */ @@ -27,9 +27,7 @@ This is a special week, the week of your victory. <<EventNameLink $activeSlave>> <<replace "#result">> $slaves[0].slaveName leads her out into the arcology's largest atrium, forces her to her knees, and in full view of the whole arcology, orally rapes someone who was until this week a slaveowner herself. Behind her, $slaves[1].slaveName is standing ready for her turn, and all your other slaves are behind. Public opinion is divided; the precedent is universally agreed to be bad, but the punishment is generally thought to be terrible and deserved. Your slaves, however, are almost insufferably @@.hotpink;pleased with you@@ for forcing $activeSlave.slaveName, whom they still view as a slaveowner, to pleasure them. <<set $activeSlave.oralCount += $slaves.length*2, $oralTotal += $slaves.length*2>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<set $slaves[$i].devotion += 10>> - <</for>> + <<run $slaves.forEach(function(s) { s.devotion += 10; })>> <</replace>> <</link>> <<if $activeSlave.anus == 0>> diff --git a/src/uncategorized/pSchoolSuggestion.tw b/src/uncategorized/pSchoolSuggestion.tw index d14a858fac8..26537192329 100644 --- a/src/uncategorized/pSchoolSuggestion.tw +++ b/src/uncategorized/pSchoolSuggestion.tw @@ -28,7 +28,7 @@ An older woman standing across from him sniffs. "St. Claver's knows how to do bo The unusually competent young heiress standing next to him snickers. "If you're going to bring up refinement, um, hello, the Futanari Sisters. I have four futas in my apartment having sex with each other right now. How do I know? Because they're always having sex with each other. They never stop." Her eyes take on a faraway look and she pauses. "Um, haha, I know what I'm doing later." <</if>> <br><br> -"If you like them soft and mellow, you got to go with The Cattle Ranch," a buff man blurts loudly while slamming down his emtpy mug. "I've got a pair of 'em for my bedroom; they are so loving after a good milking. Taste good too." His drinking budy retorts, "Too much work is what they are. They might as well be animals with how they act.<<if $seePreg == 0>> In addition, hope you like pregnant pussies cause you need to keep them gravid or their milk dries up.<</if>>" +"If you like them soft and mellow, you got to go with The Cattle Ranch," a buff man blurts loudly while slamming down his empty mug. "I've got a pair of 'em for my bedroom; they are so loving after a good milking. Taste good too." His drinking buddy retorts, "Too much work is what they are. They might as well be animals with how they act.<<if $seePreg == 0>> In addition, hope you like pregnant pussies cause you need to keep them gravid or their milk dries up.<</if>>" <br><br> "I see good taste is scarce within this walls" suddenly stated a young man previously quiet in his corner. "I say quality and strength is where the game should be played and there's nothing better than the girls from the Hippolyta Academy. <br><br> diff --git a/src/uncategorized/ptWorkaround.tw b/src/uncategorized/ptWorkaround.tw index 94509f65810..6ec5f0a668b 100644 --- a/src/uncategorized/ptWorkaround.tw +++ b/src/uncategorized/ptWorkaround.tw @@ -1127,8 +1127,8 @@ <<if $activeSlave.ID == $slaves[$i].ID>> <<set $slaves[$i] = $activeSlave>> <<else>> - <<set _I = $slaves.findIndex(function(s) { return $activeSlave.ID == s.ID; })>> - <<if _I != -1>> + <<set _I = $slaveIndices[$activeSlave.ID]>> + <<if def _I>> <<set $slaves[_I] = $activeSlave>> <</if>> <</if>> diff --git a/src/uncategorized/reLegendaryBalls.tw b/src/uncategorized/reLegendaryBalls.tw index c17472753a6..476daa560bd 100644 --- a/src/uncategorized/reLegendaryBalls.tw +++ b/src/uncategorized/reLegendaryBalls.tw @@ -1,6 +1,6 @@ :: RE legendary balls [nobr] -<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? $slaves.find(function(s) { return s.ID == $legendaryBallsID; }) : $eventSlave>> +<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? getSlave($legendaryBallsID) : $eventSlave>> <<if (ndef $activeSlave)>> /* not found - reset variable and stop event */ <<set $legendaryBallsID = 0>> diff --git a/src/uncategorized/reLegendaryCow.tw b/src/uncategorized/reLegendaryCow.tw index cbddb092fb8..45a9b46cd48 100644 --- a/src/uncategorized/reLegendaryCow.tw +++ b/src/uncategorized/reLegendaryCow.tw @@ -1,6 +1,6 @@ :: RE legendary cow [nobr] -<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? $slaves.find(function(s) { return s.ID == $legendaryCowID; }) : $eventSlave>> +<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? getSlave($legendaryCowID) : $eventSlave>> <<if (ndef $activeSlave)>> /* not found - reset variable and stop event */ <<set $legendaryCowID = 0>> diff --git a/src/uncategorized/reLegendaryEntertainer.tw b/src/uncategorized/reLegendaryEntertainer.tw index 04b69e8ec49..641ea80634f 100644 --- a/src/uncategorized/reLegendaryEntertainer.tw +++ b/src/uncategorized/reLegendaryEntertainer.tw @@ -1,6 +1,6 @@ :: RE legendary entertainer [nobr] -<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? $slaves.find(function(s) { return s.ID == $legendaryEntertainerID; }) : $eventSlave>> +<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? getSlave($legendaryEntertainerID) : $eventSlave>> <<if (ndef $activeSlave)>> /* not found - reset variable and stop event */ <<set $legendaryEntertainerID = 0>> diff --git a/src/uncategorized/reLegendaryWhore.tw b/src/uncategorized/reLegendaryWhore.tw index 4b2d9283b8f..76abc2c057e 100644 --- a/src/uncategorized/reLegendaryWhore.tw +++ b/src/uncategorized/reLegendaryWhore.tw @@ -1,6 +1,6 @@ :: RE legendary whore [nobr] -<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? $slaves.find(function(s) { return s.ID == $legendaryWhoreID; }) : $eventSlave>> +<<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check", $activeSlave = ($legendaryFacility == 1) ? getSlave($legendaryWhoreID) : $eventSlave>> <<if (ndef $activeSlave)>> /* not found - reset variable and stop event */ <<set $legendaryWhoreID = 0>> diff --git a/src/uncategorized/reMalefactor.tw b/src/uncategorized/reMalefactor.tw index 7073e492f5e..873366659c0 100644 --- a/src/uncategorized/reMalefactor.tw +++ b/src/uncategorized/reMalefactor.tw @@ -363,7 +363,7 @@ <<elseif $malefactor == "whore">> You complete the legalities and biometric scanning quickly and cautiously. The condemned resists installation in $dairyName with energy born of desperation. The public @@.green;accepts@@ this as an appropriate punishment, especially when you release footage of the criminal's <<if ($dairyPregSetting > 1) && ($activeSlave.vagina > 0)>>discomfort as her well-traveled pussy adapts to industrial reproduction<<elseif $dairyStimulatorsSetting > 1>>discomfort as her well-traveled anus adapts to accommodate rectal dildo hydration<<else>>breasts as they are roughly milked<</if>>. <<elseif $malefactor == "rapist">> - You complete the legalities and biometric scanning quickly and cautiously. The condemned resists installation in $dairyName with energy born of desperation. The public @@.green;accepts@@ this as an appropriate punishment, especially when you release footage of the rapists's <<if $dairyStimulatorsSetting > 1>>agony as her anus adapts to accommodate rectal dildo hydration<<else>>newly growing breasts as they are roughly milked<</if>>. + You complete the legalities and biometric scanning quickly and cautiously. The condemned resists installation in $dairyName with energy born of desperation. The public @@.green;accepts@@ this as an appropriate punishment, especially when you release footage of the rapist's <<if $dairyStimulatorsSetting > 1>>agony as her anus adapts to accommodate rectal dildo hydration<<else>>newly growing breasts as they are roughly milked<</if>>. <<else>> You complete the legalities and biometric scanning quickly and cautiously. The condemned resists installation in $dairyName with energy born of desperation. The public @@.green;accepts@@ this as an appropriate punishment, especially when you release footage of the criminal's <<if ($dairyPregSetting > 1) && ($activeSlave.vagina > 0)>>discomfort as her pussy adapts to industrial reproduction<<elseif $dairyStimulatorsSetting > 1>>discomfort as her anus adapts to accommodate rectal dildo hydration<<else>>breasts as they are roughly milked<</if>>, together with a report on the likely productivity of such a fit body capable of withstanding the stress of high throughput. <</if>> diff --git a/src/uncategorized/reMilfTourist.tw b/src/uncategorized/reMilfTourist.tw index 8118e99d8b4..3660ecbd841 100644 --- a/src/uncategorized/reMilfTourist.tw +++ b/src/uncategorized/reMilfTourist.tw @@ -4,7 +4,7 @@ <<Enunciate $milfSlave>> -<<set _milfed = $slaves.findIndex(function(s) { return s.ID == $milfSlave.ID; })>> +<<set _milfed = $slaveIndices[$milfSlave.ID]>> <<set $activeSlaveOneTimeMinAge = 36>> <<set $activeSlaveOneTimeMaxAge = 42>> diff --git a/src/uncategorized/reRelationshipAdvice.tw b/src/uncategorized/reRelationshipAdvice.tw index ed2bc6975ef..c5d0e67e1ae 100644 --- a/src/uncategorized/reRelationshipAdvice.tw +++ b/src/uncategorized/reRelationshipAdvice.tw @@ -3,11 +3,8 @@ <<set $nextButton = "Continue", $nextLink = "AS Dump", $returnTo = "Next Week", $activeSlave = $eventSlave>> <<Enunciate $activeSlave>> -<<for _i = 0; _i < $slaves.length; _i++>> - <<if $slaves[_i].ID == $activeSlave.relationshipTarget>> - <<set $subSlave = $slaves[_i]>> - <</if>> -<</for>> +<<set _i = $slaveIndices[$activeSlave.relationshipTarget]>> +<<set $subSlave = $slaves[_i]>> <<EventNameLink $activeSlave>> is standing for an inspection. She's a good girl, and is cooperating, but she seems preoccupied. After ignoring it for a while, you give in to curiosity and flatly ask her what's going on. "I'm <<s>>orry, <<Master>>," she <<if SlaveStatsChecker.checkForLisp($activeSlave)>>lisp<<else>>mutter<</if>>s, biting her lip. "It'<<s>> $subSlave.slaveName." She hesitates, so you prompt her, asking if she's having trouble with her @@ -40,13 +37,8 @@ She nods her head quickly, still staring at her feet. She shuts her eyes tight a <<set $activeSlave.devotion -= 5>> <<set $activeSlave.relationship = 0>> <<set $activeSlave.relationshipTarget = 0>> - <<for _i = 0; _i < $slaves.length; _i++>> - <<if $slaves[_i].ID == $subSlave.ID>> - <<set $slaves[_i].relationship = 0>> - <<set $slaves[_i].relationshipTarget = 0>> - <<break>> - <</if>> - <</for>> + <<set $slaves[_i].relationship = 0>> + <<set $slaves[_i].relationshipTarget = 0>> <</replace>> <</link>> <br><<link "Build her confidence">> @@ -74,12 +66,7 @@ She nods her head quickly, still staring at her feet. She shuts her eyes tight a <<set $activeSlave.devotion += 5>> <<set $activeSlave.relationship += 1>> - <<for _i = 0; _i < $slaves.length; _i++>> - <<if $slaves[_i].ID == $subSlave.ID>> - <<set $slaves[_i].relationship += 1>> - <<break>> - <</if>> - <</for>> + <<set $slaves[_i].relationship += 1>> <</replace>> <</link>> <br><<link "Bring the other girl in">> @@ -148,12 +135,7 @@ She nods her head quickly, still staring at her feet. She shuts her eyes tight a <<set $activeSlave.trust += 10>> <<set $activeSlave.relationship += 1>> - <<for _i = 0; _i < $slaves.length; _i++>> - <<if $slaves[_i].ID == $subSlave.ID>> - <<set $slaves[_i].relationship += 1>> - <<break>> - <</if>> - <</for>> + <<set $slaves[_i].relationship += 1>> <</replace>> <</link>> </span> diff --git a/src/uncategorized/reRelativeRecruiter.tw b/src/uncategorized/reRelativeRecruiter.tw index 35a3d870627..10972065e5f 100644 --- a/src/uncategorized/reRelativeRecruiter.tw +++ b/src/uncategorized/reRelativeRecruiter.tw @@ -4,7 +4,7 @@ <<if $familyTesting == 1>> -<<set $eventSlave = $slaves.find(function(s) { return s.ID == $recruiterSlave.ID; })>> +<<set $eventSlave = getSlave($recruiterSlave.ID)>> <<set $activeSlave = clone($genePool.find(function(o) { return o && o.ID == $eventSlave.ID; }))>> /* 000-250-006 */ @@ -747,7 +747,7 @@ You look up the _relationType. She costs <<print cashFormat($slaveCost)>>, a bar <<else>> /* vanilla */ -<<set $i = $slaves.findIndex(function(o) { return o.ID == $recruiterSlave.ID; })>> +<<set $i = $slaveIndices[$recruiterSlave.ID]>> <<set $j = $genePool.findIndex(function(o) { return o.ID == $slaves[$i].ID; })>> <<set $eventSlave = $slaves[$i]>> diff --git a/src/uncategorized/reShelterInspection.tw b/src/uncategorized/reShelterInspection.tw index d93d3102b9f..2befd983500 100644 --- a/src/uncategorized/reShelterInspection.tw +++ b/src/uncategorized/reShelterInspection.tw @@ -33,7 +33,7 @@ <<set $activeSlave.sexualQuirk = either("apathetic", "idealistic")>> <<set $seed = $shelterGirlsIDs.random()>> -<<set $subSlave = $slaves.find(function(s) { return s.ID == $seed; })>> +<<set $subSlave = getSlave($seed)>> /* * this check is currently unnecessary but if in the future the shelter girl IDs list is changed to updated only when acquiring shelter girls, this should be enabled * diff --git a/src/uncategorized/reShowerPunishment.tw b/src/uncategorized/reShowerPunishment.tw index ea0820d1ff2..03f544ff3c1 100644 --- a/src/uncategorized/reShowerPunishment.tw +++ b/src/uncategorized/reShowerPunishment.tw @@ -49,14 +49,10 @@ $activeSlave.slaveName is being very thorough. When you first appeared, she was $activeSlave.slaveName stays in the shower to clean herself, so $HeadGirl.slaveName exits to see you watching the denouement. She @@.hotpink;smiles,@@ murmuring a greeting, and hurries over to give you a peck on the cheek, leaning in as best she can to keep her moist body away from your suit. "Thi<<s>> i<<s>> the life, <<Master>>," she whispers. <<set $activeSlave.oralCount += 1>> <<set $oralTotal += 1>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $HeadGirl.ID>> - <<set $slaves[$i].devotion += 4>> - <<set $slaves[$i].penetrativeCount += 1>> - <<set $penetrativeTotal += 1>> - <<break>> - <</if>> - <</for>> + <<set $i = $slaveIndices[$HeadGirl.ID]>> + <<set $slaves[$i].devotion += 4>> + <<set $slaves[$i].penetrativeCount += 1>> + <<set $penetrativeTotal += 1>> <</nobr>> <</replace>> <</link>> @@ -80,13 +76,9 @@ $activeSlave.slaveName is being very thorough. When you first appeared, she was <<set $activeSlave.oralCount += 1>> <<set $oralTotal += 1>> <<set $activeSlave.trust += 4>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $HeadGirl.ID>> - <<set $slaves[$i].penetrativeCount += 1>> - <<set $penetrativeTotal += 1>> - <<break>> - <</if>> - <</for>> + <<set $i = $slaveIndices[$HeadGirl.ID]>> + <<set $slaves[$i].penetrativeCount += 1>> + <<set $penetrativeTotal += 1>> <</nobr>> <</replace>> <</link>> @@ -111,13 +103,9 @@ $activeSlave.slaveName is being very thorough. When you first appeared, she was <<set $activeSlave.oralCount += 1>> <<set $oralTotal += 1>> <<set $activeSlave.devotion += 4>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $HeadGirl.ID>> - <<set $slaves[$i].oralCount += 1>> - <<set $oralTotal += 1>> - <<break>> - <</if>> - <</for>> + <<set $i = $slaveIndices[$HeadGirl.ID]>> + <<set $slaves[$i].oralCount += 1>> + <<set $oralTotal += 1>> <</nobr>> <</replace>> <</link>> diff --git a/src/uncategorized/reSlaveMarriage.tw b/src/uncategorized/reSlaveMarriage.tw index 6f4fbaccf3f..6f53e824799 100644 --- a/src/uncategorized/reSlaveMarriage.tw +++ b/src/uncategorized/reSlaveMarriage.tw @@ -10,11 +10,7 @@ <</if>> <<if $brideSlave == 0>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $groomSlave.relationshipTarget == $slaves[$i].ID>> - <<set $brideSlave = $slaves[$i]>> - <</if>> - <</for>> + <<set $brideSlave = getSlave($groomSlave.relationshipTarget)>> <</if>> <<Enunciate $groomSlave>> <</nobr>>\ @@ -38,18 +34,8 @@ <<set $groomSlave.relationship = 5>> <<set $brideSlave.relationship = 5>> <<set $oralTotal += 2>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $brideSlave.ID == $slaves[$i].ID>> - <<set $slaves[$i] = $brideSlave>> - <<break>> - <</if>> - <</for>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $groomSlave.ID == $slaves[$i].ID>> - <<set $slaves[$i] = $groomSlave>> - <<break>> - <</if>> - <</for>> + <<set $slaves[$slaveIndices[$brideSlave.ID]] = $brideSlave>> + <<set $slaves[$slaveIndices[$groomSlave.ID]] = $groomSlave>> <</replace>> <</link>> <br><<link "No">> diff --git a/src/uncategorized/rename.tw b/src/uncategorized/rename.tw index 473d4809395..7b76964abd7 100644 --- a/src/uncategorized/rename.tw +++ b/src/uncategorized/rename.tw @@ -74,21 +74,16 @@ /* Wife's surname reaction */ <<if $oldSurname != $activeSlave.slaveSurname>> <<if $activeSlave.relationship >= 5>> - <<for _i = 0; _i < $slaves.length; _i++>> - <<if $activeSlave.relationshipTarget == $slaves[_i].ID>> - <<if $slaves[_i].slaveSurname>> - <<if $activeSlave.slaveSurname == $slaves[_i].slaveSurname>> - She's touched that she now shares a surname with her wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.mediumaquamarine;more confident than ever@@ that you intend to keep them together in marital bliss. - <<set $activeSlave.trust += 5>> - <<break>> - <<elseif $oldSurname == $slaves[_i].slaveSurname>> - She's concerned that she no longer shares a surname her wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.gold;very worried@@ that you might be considering splitting them up. - <<set $activeSlave.trust -= 5>> - <<break>> - <</if>> - <</if>> + <<set _i = $slaveIndices[$activeSlave.relationshipTarget]>> + <<if $slaves[_i].slaveSurname>> + <<if $activeSlave.slaveSurname == $slaves[_i].slaveSurname>> + She's touched that she now shares a surname with her wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.mediumaquamarine;more confident than ever@@ that you intend to keep them together in marital bliss. + <<set $activeSlave.trust += 5>> + <<elseif $oldSurname == $slaves[_i].slaveSurname>> + She's concerned that she no longer shares a surname her wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.gold;very worried@@ that you might be considering splitting them up. + <<set $activeSlave.trust -= 5>> + <</if>> <</if>> - <</for>> <</if>> <</if>> -- GitLab