diff --git a/src/npc/removeActiveSlave.tw b/src/npc/removeActiveSlave.tw index 167d87d672e99950390e5a40ae1bbcda8ad27c8c..b510a25eeaa34b51254c7e1b94b107639124d38d 100644 --- a/src/npc/removeActiveSlave.tw +++ b/src/npc/removeActiveSlave.tw @@ -1,6 +1,6 @@ :: Remove activeSlave [nobr silently] -<<set _ID = $activeSlave.ID, _SL = $slaves.length, _x = $slaves.findIndex(function(s) { return s.ID == _ID; })>> +<<set _ID = $activeSlave.ID, _SL = $slaves.length, _x = $slaveIndices[_ID]>> <<set WombZeroID($PC, _ID)>> <<if $activeSlave.reservedChildren > 0>> diff --git a/src/uncategorized/schoolroomReport.tw b/src/uncategorized/schoolroomReport.tw index dcbb135bb45d0f2bfff1e65062edcc437b191f23..8f9ce6d7ea80893596e16da8549a41f4abf42a67 100644 --- a/src/uncategorized/schoolroomReport.tw +++ b/src/uncategorized/schoolroomReport.tw @@ -10,7 +10,7 @@ <</if>> <<if $Schoolteacher != 0>> - <<set _FLs = $slaves.findIndex(function(s) { return s.ID == $Schoolteacher.ID; })>> + <<set _FLs = $slaveIndices[$Schoolteacher.ID]>> <<if ($slaves[_FLs].health < -80)>> <<set $slaves[_FLs].health += 20>> diff --git a/src/uncategorized/seCoursing.tw b/src/uncategorized/seCoursing.tw index 5434abdcdf65c957aa1a8696b690ec23b3cfe2c1..cdfaaafab0043a4577c02ac21089d2152c7c5543 100644 --- a/src/uncategorized/seCoursing.tw +++ b/src/uncategorized/seCoursing.tw @@ -2,7 +2,7 @@ <<set $nextButton = "Continue", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event", $coursed = 1, _seed = 0>> -<<set $Lurcher = $slaves.find(function(s) { return s.ID == $Lurcher.ID; })>> +<<set $Lurcher = getSlave($Lurcher.ID)>> It's time to go coursing. You meet with fellow members of the Coursing Association while the automated maintenance drones clear the plaza and lay down the green, sharing a refine discussion of recent events over <<if $PC.refreshmentType == 0>>a $PC.refreshment<<elseif $PC.refreshmentType == 1>>glasses of $PC.refreshment<<elseif $PC.refreshmentType == 2>>plates of $PC.refreshment<<elseif $PC.refreshmentType == 3>>hits of $PC.refreshment<<elseif $PC.refreshmentType == 4>>shots of $PC.refreshment<<elseif $PC.refreshmentType == 5>>handfuls of $PC.refreshment<<elseif $PC.refreshmentType == 6>>tabs of $PC.refreshment<</if>>. Once the field is ready, the day's hares are led out and chained in a row along one side of the plaza, naked. You and the other members watch this process intently, since you won't get any more information on them than what you can learn by looking. <br><br> @@ -647,12 +647,7 @@ You place your hand on the leash's quick release and whisper your direction into <</if>> On the other side of the plaza, there is a scream of triumph followed by tears of joy as one of the hares successfully wins her freedom. This cheerful noise mixes strangely with screams of a very different sort and the slap of flesh on flesh as a more successful lurcher rapes her capture. <</if>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $Lurcher.ID>> - <<set $slaves[$i] = $Lurcher>> - <<break>> - <</if>> -<</for>> +<<set $slaves[$slaveIndices[$Lurcher.ID]] = $Lurcher>> <</replace>> <</link>> <br><<link "The second">> @@ -999,12 +994,7 @@ You place your hand on the leash's quick release and whisper your direction into <</if>> On the other side of the plaza, there is a scream of triumph followed by tears of joy as one of the hares successfully wins her freedom. This cheerful noise mixes strangely with screams of a very different sort and the slap of flesh on flesh as a more successful lurcher rapes her capture. <</if>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $Lurcher.ID>> - <<set $slaves[$i] = $Lurcher>> - <<break>> - <</if>> -<</for>> +<<set $slaves[$slaveIndices[$Lurcher.ID]] = $Lurcher>> <</replace>> <</link>> <br><<link "The third">> @@ -1351,12 +1341,7 @@ You place your hand on the leash's quick release and whisper your direction into <</if>> On the other side of the plaza, there is a scream of triumph followed by tears of joy as one of the hares successfully wins her freedom. This cheerful noise mixes strangely with screams of a very different sort and the slap of flesh on flesh as a more successful lurcher rapes her capture. <</if>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $Lurcher.ID>> - <<set $slaves[$i] = $Lurcher>> - <<break>> - <</if>> -<</for>> +<<set $slaves[$slaveIndices[$Lurcher.ID]] = $Lurcher>> <</replace>> <</link>> </span> \ No newline at end of file diff --git a/src/uncategorized/seExpiration.tw b/src/uncategorized/seExpiration.tw index fb4ed8ef761144d37643d94d090c0e3534315bb9..854f56d34876e11f26598c5708452a64645ac0a4 100644 --- a/src/uncategorized/seExpiration.tw +++ b/src/uncategorized/seExpiration.tw @@ -6,12 +6,7 @@ <<set $expired = 1>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $expiree.ID>> - <<set $activeSlave = $slaves[$i]>> - <<break>> - <</if>> -<</for>> +<<set $activeSlave = getSlave($expiree.ID)>> <<Enunciate $activeSlave>> diff --git a/src/uncategorized/seLethalPit.tw b/src/uncategorized/seLethalPit.tw index b6e3c7937d56bc31db459c675da3ca1ee2369b84..9374228d9a744a96090dc1e6110476fdfea935c1 100644 --- a/src/uncategorized/seLethalPit.tw +++ b/src/uncategorized/seLethalPit.tw @@ -2,43 +2,17 @@ <<nobr>> -<<set $nextButton = "Continue">> -<<set $nextLink = "Scheduled Event">> -<<set $returnTo = "Scheduled Event">> -<<set $pitFought = 1>> +<<set $nextButton = "Continue", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event", $pitFought = 1, $fighterOne = 0, $fighterTwo = 0>> -<<set $fighterOne = 0>> -<<set $fighterTwo = 0>> <<if $pitBG == 0>> - <<set $fighterOne = $fighterIDs.random()>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if ($slaves[$i].ID == $fighterOne)>> - <<set $fighterOne = $slaves[$i]>> - <<break>> - <</if>> - <</for>> + <<set $fighterOne = $fighterIDs.pluck()>> /* .pluck() removes the element from the array, preventing $fighterTwo from also choosing this ID */ + <<set $fighterOne = getSlave($fighterOne)>> <<else>> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if ($slaves[$i].ID == $Bodyguard.ID)>> - <<set $fighterOne = $slaves[$i]>> - <<break>> - <</if>> - <</for>> + <<set $fighterOne = getSlave($Bodyguard.ID)>> <</if>> -<<set $fighterIDs = $fighterIDs.shuffle()>> -<<for $i = 0; $i < $fighterIDs.length; $i++>> - <<if ($fighterIDs[$i] != $fighterOne.ID)>> - <<set $fighterTwo = $fighterIDs[$i]>> - <<break>> - <</if>> -<</for>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if ($slaves[$i].ID == $fighterTwo)>> - <<set $fighterTwo = $slaves[$i]>> - <<break>> - <</if>> -<</for>> -<<if ($fighterOne == 0) || ($fighterTwo == 0)>> +<<set $fighterTwo = $fighterIDs.pluck()>> +<<set $fighterTwo = getSlave($fighterTwo)>> +<<if ndef $fighterOne || ndef $fighterTwo || ($fighterOne == 0) || ($fighterTwo == 0)>> <<goto "Nonrandom Event">> <</if>> @@ -656,18 +630,8 @@ You let the winner _winner.slaveName, shaking as she comes off the adrenaline, d <<set $fighterTwo = 0>> <</if>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if _winner.ID == $slaves[$i].ID>> - <<set $slaves[$i] = _winner>> - <<break>> - <</if>> -<</for>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if _loser.ID == $slaves[$i].ID>> - <<set $activeSlave = $slaves[$i]>> - <<include "Remove activeSlave">> - <<break>> - <</if>> -<</for>> +<<set $slaves[$slaveIndices[_winner.ID]] = _winner>> +<<set $activeSlave = getSlave(_loser.ID)>> +<<include "Remove activeSlave">> <</nobr>>\ \ No newline at end of file diff --git a/src/uncategorized/seNonlethalPit.tw b/src/uncategorized/seNonlethalPit.tw index ea9adc9d76f954644d5d3646951d90b3d84d9f10..7ef541583bde94cb9237686875207046c65a24c0 100644 --- a/src/uncategorized/seNonlethalPit.tw +++ b/src/uncategorized/seNonlethalPit.tw @@ -5,19 +5,13 @@ <<set $nextButton = "Continue", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event", $pitFought = 1, $fighterOne = 0, $fighterTwo = 0>> <<if $pitBG == 0>> - <<set $fighterOne = $fighterIDs.random()>> - <<set $fighterOne = $slaves.find(function(s) { return s.ID == $fighterOne; })>> + <<set $fighterOne = $fighterIDs.pluck()>> /* .pluck() removes the element from the array, preventing $fighterTwo from also choosing this ID */ + <<set $fighterOne = getSlave($fighterOne)>> <<else>> - <<set $fighterOne = $slaves.find(function(s) { return s.ID == $Bodyguard.ID; })>> + <<set $fighterOne = getSlave($Bodyguard.ID)>> <</if>> -<<set $fighterIDs = $fighterIDs.shuffle()>> -<<for $i = 0; $i < $fighterIDs.length; $i++>> - <<if ($fighterIDs[$i] != $fighterOne.ID)>> - <<set $fighterTwo = $fighterIDs[$i]>> - <<break>> - <</if>> -<</for>> -<<set $fighterTwo = $slaves.find(function(s) { return s.ID == $fighterTwo; })>> +<<set $fighterTwo = $fighterIDs.pluck()>> +<<set $fighterTwo = getSlave($fighterTwo)>> <<if ndef $fighterOne || ndef $fighterTwo || ($fighterOne == 0) || ($fighterTwo == 0)>> <<goto "Nonrandom Event">> <</if>> @@ -645,7 +639,7 @@ You throw the victor's strap-on down to _winner.slaveName. <<set _winner.devotion -= 10>> <</if>> <<if _winner.fetish == "sadist" && _winner.fetishStrength > 90 && _winner.sexualFlaw != "malicious" && _winner.devotion >= 20>> - She noticed something while she was raping _loser.slaveName; watching the way she writhed in pain was strangely satisfying, as was making her suffer. _winner.slaveName cums powerfully at the mere thought; she has become @@.yellow;sexually addicted to inflicting pain and anguish.@@ + She noticed something while she was raping _loser.slaveName; watching the way she writhed in pain was strangely satisfying, as she was making her suffer. _winner.slaveName cums powerfully at the mere thought; she has become @@.yellow;sexually addicted to inflicting pain and anguish.@@ <<set _winner.sexualFlaw = "malicious">> <<elseif _winner.fetish == "masochist" && _winner.fetishStrength > 90 && _winner.sexualFlaw != "self hating" && _winner.devotion < 20>> She feels horrible after forcing herself on _loser.slaveName; she is the one that should suffer, not her. _winner.slaveName has @@.yellow;descended into true self hatred.@@ @@ -773,13 +767,7 @@ You throw the victor's strap-on down to _winner.slaveName. <</if>> <</if>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if _winner.ID == $slaves[$i].ID>> - <<set $slaves[$i] = _winner>> - <</if>> - <<if _loser.ID == $slaves[$i].ID>> - <<set $slaves[$i] = _loser>> - <</if>> -<</for>> +<<set $slaves[$slaveIndices[_winner.ID]] = _winner>> +<<set $slaves[$slaveIndices[_loser.ID]] = _loser>> <</nobr>>\ \ No newline at end of file diff --git a/src/uncategorized/seRetirement.tw b/src/uncategorized/seRetirement.tw index 5ac8d7a3af6163cac2fd37a5e4de8f0cd5a06e91..e14ae7838d093bf11124a24377f6b9a3df5fe0f8 100644 --- a/src/uncategorized/seRetirement.tw +++ b/src/uncategorized/seRetirement.tw @@ -6,12 +6,7 @@ <<set $retired = 1>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $retiree.ID>> - <<set $activeSlave = $slaves[$i]>> - <<break>> - <</if>> -<</for>> +<<set $activeSlave = getSlave($retiree.ID)>> <<set _playerName = $PC.name, _playerName = nameReplace(_playerName)>> <<Enunciate $activeSlave>> @@ -24,12 +19,9 @@ in a way that will fill the rest of your property with envy and @@.mediumaquamar <<set $slaves[$i].trust += 3>> <</for>> <<if $activeSlave.relationship > 3>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $activeSlave.relationshipTarget>> - ($slaves[$i].slaveName, for her part, is @@.hotpink;overjoyed,@@ though also a bit sad. She looks forward to joining $activeSlave.slaveName one day.) - <<set $slaves[$i].devotion += 10>> - <</if>> -<</for>> + <<set _sr = $slaveIndices[$activeSlave.relationshipTarget]>> + $slaves[_sr].slaveName, for her part, is @@.hotpink;overjoyed,@@ though also a bit sad. She looks forward to joining $activeSlave.slaveName one day. + <<set $slaves[_sr].devotion += 10>> <</if>> <br><br> @@ -179,14 +171,10 @@ When you return to your desk you realize something. <<if $activeSlave.relationship >= 4>> <<link "Send her girl into retirement with her">> <<replace "#result">> - <<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $activeSlave.relationshipTarget>> - She doesn't get far before she hears a desperate pursuit behind her. It's her <<if $activeSlave.relationship >= 5>>wife<<else>>lover<</if>>, $slaves[$i].slaveName, hurrying to catch up. Watching on the monitors, you see $activeSlave.slaveName's mixed pleasure and pain at seeing her again so soon, followed by a tearful explanation and an embrace so heartfelt that the pair of ex-slaves collapse to the floor together, sobbing. - <<set $activeSlave = $slaves[$i]>> - <<include "Remove activeSlave">> - <<break>> - <</if>> - <</for>> + <<set _sr = $slaveIndices[$activeSlave.relationshipTarget]>> + She doesn't get far before she hears a desperate pursuit behind her. It's her <<if $activeSlave.relationship >= 5>>wife<<else>>lover<</if>>, $slaves[_sr].slaveName, hurrying to catch up. Watching on the monitors, you see $activeSlave.slaveName's mixed pleasure and pain at seeing her again so soon, followed by a tearful explanation and an embrace so heartfelt that the pair of ex-slaves collapse to the floor together, sobbing. + <<set $activeSlave = $slaves[_sr]>> + <<include "Remove activeSlave">> <br><br> <<if $arcologies[0].FSPaternalist != "unset">> Of course, your paternalistic arcology thinks this @@.green;almost too romantic,@@ and there are jesting suggestions that outcomes this adorable ought to be illegal. The pair becomes celebrated citizens immediately. @@ -214,10 +202,9 @@ in a way that will inevitably fill the rest of your property with @@.gold;fear.@ <<set $slaves[$i].trust -= 3>> <</for>> <<if $activeSlave.relationship > 3>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $activeSlave.relationshipTarget>> - ($slaves[$i].slaveName, for her part, is @@.mediumorchid;horrified.@@) - <<set $slaves[$i].devotion -= 20>> + <<set _sr = $slaveIndices[$activeSlave.relationshipTarget]>> + $slaves[_sr].slaveName, for her part, is @@.mediumorchid;horrified.@@ + <<set $slaves[_sr].devotion -= 20>> <</if>> <</for>> <</if>> @@ -257,12 +244,9 @@ in a way that will inevitably fill the rest of your property with @@.gold;fear.@ <<set $slaves[$i].trust -= 3>> <</for>> <<if $activeSlave.relationship > 3>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $activeSlave.relationshipTarget>> - ($slaves[$i].slaveName, for her part, is @@.mediumorchid;horrified.@@) - <<set $slaves[$i].devotion -= 20>> - <</if>> -<</for>> + <<set _sr = $slaveIndices[$activeSlave.relationshipTarget]>> + $slaves[_sr].slaveName, for her part, is @@.mediumorchid;horrified.@@ + <<set $slaves[_sr].devotion -= 20>> <</if>> <br><br> @@ -331,12 +315,9 @@ You have @@.yellowgreen;gained a fuckdoll.@@ into a life of menial drudgery. This has little impact on your other human property. <<if $activeSlave.relationship > 3>> -<<for $i = 0; $i < $slaves.length; $i++>> - <<if $slaves[$i].ID == $activeSlave.relationshipTarget>> - ($slaves[$i].slaveName, for her part, is @@.mediumorchid;saddened,@@ but not seriously affected. She knew this was coming.) - <<set $slaves[$i].devotion -= 5>> - <</if>> -<</for>> + <<set _sr = $slaveIndices[$activeSlave.relationshipTarget]>> + $slaves[_sr].slaveName, for her part, is @@.mediumorchid;saddened,@@ but not seriously affected. She knew this was coming. + <<set $slaves[_sr].devotion -= 5>> <</if>> There are a thousand things a slave like her can usefully do around the arcology, and she'll do them. But she's reached the age where it's time for you and the arcology's citizens to fuck younger girls. diff --git a/src/uncategorized/seWedding.tw b/src/uncategorized/seWedding.tw index d65b0143f6412bcead0b3923cc15beec9c4c341d..4ec6fc4b24faeac101b47dd368b51fae7954590b 100644 --- a/src/uncategorized/seWedding.tw +++ b/src/uncategorized/seWedding.tw @@ -5,7 +5,7 @@ <<if $activeSlave.relationship != 0>> <<if $activeSlave.relationship > 0>> - <<set _m = $slaves.findIndex(function(s) { return s.ID == $activeSlave.relationshipTarget; })>> + <<set _m = $slaveIndices[$activeSlave.relationshipTarget]>> <<set $activeSlave.relationshipTarget = 0>> <<set $slaves[_m].relationship = 0, $slaves[_m].relationshipTarget = 0>> <</if>> diff --git a/src/uncategorized/servantsQuartersReport.tw b/src/uncategorized/servantsQuartersReport.tw index 797268ee1ea43023a0bf220352a33d97bddd7a72..9fb01cbd8719a764a98d363c1cb0d44dec8f31c8 100644 --- a/src/uncategorized/servantsQuartersReport.tw +++ b/src/uncategorized/servantsQuartersReport.tw @@ -10,7 +10,7 @@ <</if>> <<if ($Stewardess != 0)>> - <<set _FLs = $slaves.findIndex(function(s) { return s.ID == $Stewardess.ID; })>> + <<set _FLs = $slaveIndices[$Stewardess.ID]>> <<set $slaves[_FLs].devotion += _devBonus>> <<if ($slaves[_FLs].health < -80)>>