From 4bc3a7cb52686825eb1038d514d6dba1522dbd25 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Sun, 22 Mar 2020 17:58:26 -0700 Subject: [PATCH] Port RE devotees to the event framework as a multi-slave demonstration, and get rid of its old global arrays. --- src/events/jsRandomEvent.tw | 2 + src/events/randomEvent.js | 1 + src/events/reDevotees.js | 69 +++++++++++++++++++ src/events/ressLazyEvening.js | 2 + src/uncategorized/nextWeek.tw | 2 +- src/uncategorized/randomNonindividualEvent.tw | 11 --- src/uncategorized/reDevotees.tw | 56 --------------- 7 files changed, 75 insertions(+), 68 deletions(-) create mode 100644 src/events/reDevotees.js delete mode 100644 src/uncategorized/reDevotees.tw diff --git a/src/events/jsRandomEvent.tw b/src/events/jsRandomEvent.tw index ea038bac347..727de908152 100644 --- a/src/events/jsRandomEvent.tw +++ b/src/events/jsRandomEvent.tw @@ -1,3 +1,5 @@ :: JS Random Event [nobr] +<<set $nextButton = "Continue">> + <<run html5passage(n => $event.execute(n))>> diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js index c463f31dc47..c5d2fa1b8c3 100644 --- a/src/events/randomEvent.js +++ b/src/events/randomEvent.js @@ -135,6 +135,7 @@ App.Events.getNonindividualEvents = function() { return [ // instantiate all possible random nonindividual events here // example: new App.Events.TestEvent(), + new App.Events.REDevotees(), ] .filter(e => (e.eventPrerequisites().every(p => p()) && e.castActors(null))) .reduce((res, cur) => res.concat(Array(cur.weight).fill(cur)), []); diff --git a/src/events/reDevotees.js b/src/events/reDevotees.js new file mode 100644 index 00000000000..588cf915418 --- /dev/null +++ b/src/events/reDevotees.js @@ -0,0 +1,69 @@ +App.Events.REDevotees = class REDevotees extends App.Events.BaseEvent { + constructor(actors, params) { + super(actors, params); + } + + eventPrerequisites() { + return []; // always valid if sufficient actors can be cast successfully + } + + actorPrerequisites() { + const devoteeRequirements = [ + s => s.devotion > 50, + canWalk, + isSlaveAvailable + ]; + return [ // total of four actors, identical requirements for each + devoteeRequirements, + devoteeRequirements, + devoteeRequirements, + devoteeRequirements + ]; + } + + execute(node) { + let devotees = this.actors.map(a => getSlave(a)); // for this event, they're fine as an array + + V.nextLink = "RIE Eligibility Check"; + + App.Events.drawEventArt(node, devotees); + + const slaveList = devotees.map(s => s.slaveName).reduce((res, ch, i, arr) => res + (i === arr.length - 1 ? ' and ' : ', ') + ch); + + let t = []; + t.push(`You have a mature, well-trained household of slaves. ${slaveList} are all devoted to you. There are all manner of ways you could display this coterie of loyal sex slaves to show off your wealth and power.`); + App.Events.addParagraph(node, t); + + App.Events.addResponses(node, [ + new App.Events.Result("See an operetta with four attendants", opera), + new App.Events.Result("Visit a casino in good company", casino), + ]); + + function opera() { + PCTitle(); + let t = []; + t.push(`You reserve a box at an upcoming operetta; classical Italian music is enjoying a renaissance these days. The doormen at the fashionable opera house promptly widen the velvet ropes so that you and your party may proceed unimpeded. Their quick thinking is necessary, since there are five of you walking sedately up the steps: you in the middle, impeccable in`); + if (V.PC.title === 1) { + t.push(`gentleman's evening wear, complete with gloves and cane;`); + } else { + t.push(`a fine and noble lady's tuxedo;`); + } + t.push(`and ${slaveList}, all dressed in the gorgeous fashion of the seventeenth century, all plunging necklines, piled hair, and ruffled petticoats. The splendid master of ceremonies clears his throat and announces in a sonorous voice, "${V.PCTitle}." The ostentation <span class="reputation inc">turns every head and catches every eye.</span>`); + for (const s of devotees) { + repX(600, "event", s); + } + return t; + } + + function casino() { + let t = []; + t.push(`The croupiers, bouncers and regulars down at the nearest casino hardly know what to think when you appear with a chit full of cash and twice as many partners as you have arms. You live the night big, starting at the poker table with so many tits and asses on display behind you that, <span class="cash inc">baby, you make a killing.</span> ${slaveList} quickly catch the rhythm of the place: slaves can get away with a little more in the smoky, whiskey soaked, money tinted atmosphere, and they <span class="devotion inc">enjoy themselves immensely.</span> They flirt, flash, giggle, kiss each other, and generally destroy the concentration of everyone within twenty ${V.showInches === 2 ? "yards" : "meters"} — except you. Ring-a-ding-ding.`); + const _cashX = random(30, 100)*3; + for (const s of devotees) { + cashX(_cashX, "event", s); + s.devotion += 4; + } + return t; + } + } +}; diff --git a/src/events/ressLazyEvening.js b/src/events/ressLazyEvening.js index 68c3c8cf0c3..2c9223306d5 100644 --- a/src/events/ressLazyEvening.js +++ b/src/events/ressLazyEvening.js @@ -26,6 +26,8 @@ App.Events.RESSLazyEvening = class RESSLazyEvening extends App.Events.BaseEvent } = getPronouns(eventSlave); Enunciate(eventSlave); + V.nextLink = "Next Week"; + function getSceneClothes(slave) { if (getLimbCount(slave, 102) > 2) { return "an oversized t-shirt"; diff --git a/src/uncategorized/nextWeek.tw b/src/uncategorized/nextWeek.tw index 654aea45b97..3f966080aad 100644 --- a/src/uncategorized/nextWeek.tw +++ b/src/uncategorized/nextWeek.tw @@ -350,7 +350,7 @@ <<set $boobsID = -1, $boobsInterestTargetID = -1, $buttslutID = -1, $buttslutInterestTargetID = -1, $cumslutID = -1, $cumslutInterestTargetID = -1, $humiliationID = -1, $humiliationInterestTargetID = -1, $sadistID = -1, $sadistInterestTargetID = -1, $masochistID = -1, $masochistInterestTargetID = -1, $domID = -1, $dominantInterestTargetID = -1, $subID = -1, $submissiveInterestTargetID = -1>> /% Other arrays %/ -<<set $events = [], $RESSevent = [], $RESSTRevent = [], $RETSevent = [], $RECIevent = [], $RecETSevent = [], $REFIevent = [], $REFSevent = [], $PESSevent = [], $PETSevent = [], $FSAcquisitionEvents = [], $FSNonconformistEvents = [], $REAnalCowgirlSubIDs = [], $REButtholeCheckinIDs = [], $recruit = [], $RETasteTestSubIDs = [], $devotedSlaves = [], $rebelSlaves = [], $REBoobCollisionSubIDs = [], $REIfYouEnjoyItSubIDs = [], $RESadisticDescriptionSubIDs = [], $REShowerForceSubIDs = [], $RESimpleAssaultIDs = [], $RECockmilkInterceptionIDs = [], $REInterslaveBeggingIDs = [], $bedSlaves = [], $eligibleSlaves = []>> +<<set $events = [], $RESSevent = [], $RESSTRevent = [], $RETSevent = [], $RECIevent = [], $RecETSevent = [], $REFIevent = [], $REFSevent = [], $PESSevent = [], $PETSevent = [], $FSAcquisitionEvents = [], $FSNonconformistEvents = [], $REAnalCowgirlSubIDs = [], $REButtholeCheckinIDs = [], $recruit = [], $RETasteTestSubIDs = [], $rebelSlaves = [], $REBoobCollisionSubIDs = [], $REIfYouEnjoyItSubIDs = [], $RESadisticDescriptionSubIDs = [], $REShowerForceSubIDs = [], $RESimpleAssaultIDs = [], $RECockmilkInterceptionIDs = [], $REInterslaveBeggingIDs = [], $bedSlaves = [], $eligibleSlaves = []>> /% Slave Objects using 0 instead of null. Second most memory eaten up. %/ <<set $activeSlave = 0, $eventSlave = 0, $slaveWithoutBonuses = 0, $subSlave = 0, $milkTap = 0, $relation = 0, $relative = 0, $relative2 = 0>> diff --git a/src/uncategorized/randomNonindividualEvent.tw b/src/uncategorized/randomNonindividualEvent.tw index 6a509930cf4..fed74bc6481 100644 --- a/src/uncategorized/randomNonindividualEvent.tw +++ b/src/uncategorized/randomNonindividualEvent.tw @@ -333,17 +333,6 @@ /* Multislave Events */ - <<set $devotedSlaves = $slaves.filter(function(s) { return s.devotion > 50 && canWalk(s) && s.assignment != "be your agent" && s.assignment != "live with your agent"; })>> - <<if def $devotedSlaves[3]>> - <<set $devotedSlaves = $devotedSlaves.shuffle()>> - <<set $devotedSlaves.length = 4>> - <<set $devotedSlaves[0] = $devotedSlaves[0].ID>> - <<set $devotedSlaves[1] = $devotedSlaves[1].ID>> - <<set $devotedSlaves[2] = $devotedSlaves[2].ID>> - <<set $devotedSlaves[3] = $devotedSlaves[3].ID>> - <<set $events.push("RE devotees")>> - <</if>> - <<if $fuckSlaves > 1>> <<set $bedSlaves = $slaves.filter(function(s) { return s.devotion > 50 && (s.assignment == "please you" || s.assignment == "serve in the master suite" || s.assignment == "be your Concubine") && !isAmputee(s) && canDoAnal(s); })>> <<if def $bedSlaves[1]>> diff --git a/src/uncategorized/reDevotees.tw b/src/uncategorized/reDevotees.tw deleted file mode 100644 index b38013428b2..00000000000 --- a/src/uncategorized/reDevotees.tw +++ /dev/null @@ -1,56 +0,0 @@ -:: RE devotees [nobr] - -<<set $nextButton = "Continue">> -<<set $nextLink = "RIE Eligibility Check">> -<<set _red1 = $slaveIndices[$devotedSlaves[0]]>> -<<set _red2 = $slaveIndices[$devotedSlaves[1]]>> -<<set _red3 = $slaveIndices[$devotedSlaves[2]]>> -<<set _red4 = $slaveIndices[$devotedSlaves[3]]>> - -/* 000-250-006 */ -<<if $seeImages == 1>> - <div class="imageColumn"> - <div class="imageRef medImg"> - <<= SlaveArt($slaves[_red1], 2, 0)>> - </div> - <div class="imageRef medImg"> - <<= SlaveArt($slaves[_red2], 2, 0)>> - </div> - <div class="imageRef medImg"> - <<= SlaveArt($slaves[_red3], 2, 0)>> - </div> - <div class="imageRef medImg"> - <<= SlaveArt($slaves[_red4], 2, 0)>> - </div> - </div> -<</if>> -/* 000-250-006 */ - -You have a mature, well-trained household of slaves. $slaves[_red1].slaveName, $slaves[_red2].slaveName, $slaves[_red3].slaveName, and $slaves[_red4].slaveName are all devoted to you. There are all manner of ways you could display this coterie of loyal sex slaves to show off your wealth and power. -<br><br> -<span id="result"> -<<link "See an operetta with four attendants">> - <<replace "#result">> - <<run PCTitle()>> - You reserve a box at an upcoming operetta; classical Italian music is enjoying a renaissance these days. The doormen at the fashionable opera house promptly widen the velvet ropes so that you and your party may proceed unimpeded. Their quick thinking is necessary, since there are five of you walking sedately up the steps: you in the middle, impeccable in <<if $PC.title == 1>>gentleman's evening wear, complete with gloves and cane<<else>>a fine and noble lady's tuxedo<</if>>; and $slaves[_red1].slaveName, $slaves[_red2].slaveName, $slaves[_red3].slaveName, and $slaves[_red4].slaveName, all dressed in the gorgeous fashion of the seventeenth century, all plunging necklines, piled hair, and ruffled petticoats. The splendid master of ceremonies clears his throat and announces in a sonorous voice, "$PCTitle." The ostentation @@.green;turns every head and catches every eye.@@ - <<run repX(600, "event", $slaves[_red1])>> - <<run repX(600, "event", $slaves[_red2])>> - <<run repX(600, "event", $slaves[_red3])>> - <<run repX(600, "event", $slaves[_red4])>> - <</replace>> -<</link>> -<br><<link "Visit a casino in good company">> - <<replace "#result">> - The croupiers, bouncers and regulars down at the nearest casino hardly know what to think when you appear with a chit full of cash and twice as many partners as you have arms. You live the night big, starting at the poker table with so many tits and asses on display behind you that, @@.yellowgreen;baby, you make a killing.@@ $slaves[_red1].slaveName, $slaves[_red2].slaveName, $slaves[_red3].slaveName, and $slaves[_red4].slaveName quickly catch the rhythm of the place: slaves can get away with a little more in the smoky, whiskey soaked, money tinted atmosphere, and they @@.hotpink;enjoy themselves immensely.@@ They flirt, flash, giggle, kiss each other, and generally destroy the concentration of everyone within twenty <<if $showInches == 2>>yards<<else>>meters<</if>> — except you. Ring-a-ding-ding. - <<set _cashX = random(30,100)*3>> - <<set $slaves[_red1].devotion += 4>> - <<run cashX(_cashX, "event", $slaves[_red1])>> - <<set $slaves[_red2].devotion += 4>> - <<run cashX(_cashX, "event", $slaves[_red2])>> - <<set $slaves[_red3].devotion += 4>> - <<run cashX(_cashX, "event", $slaves[_red3])>> - <<set $slaves[_red4].devotion += 4>> - <<run cashX(_cashX, "event", $slaves[_red4])>> - <</replace>> -<</link>> -</span> -- GitLab