diff --git a/src/js/storyJS.tw b/src/js/storyJS.tw index 91b356581deb1a33003655863c0d8c402a24e4d6..c36b56399a8b0d27caf8a7481bd2e7b94fe8489c 100644 --- a/src/js/storyJS.tw +++ b/src/js/storyJS.tw @@ -703,6 +703,20 @@ window.ruleSlaveExcluded = function(slave, rule) { return rule.excludedSlaves.includes(slave.ID); }; +window.ruleAssignmentSelected = function(slave, rule) { + if (!slave || !rule || (!rule.assignment && !rule.facility)) + return false; + var assignment = rule.assignment.concat(expandFacilityAssignments(rule.facility)); + return assignment.includes(slave.assignment); +} + +window.ruleAssignmentExcluded = function(slave, rule) { + if (!slave || !rule || (!rule.excludeAssignment && !rule.excludeFacility)) + return false; + var excludeAssignment = rule.excludeAssignment.concat(expandFacilityAssignments(rule.excludeFacility)); + return excludeAssignment.includes(slave.assignment); +} + window.hasSurgeryRule = function(slave, rules) { if (!slave || !rules || !slave.currentRules) return false; @@ -980,4 +994,14 @@ window.nippleColor = function(slave) { return 'brown'; } } -} \ No newline at end of file +} + +window.jsAlert = function(obj) +{ + alert(obj); +} + +window.jsConsoleInfo = function(obj) +{ + console.info(obj); +} diff --git a/src/uncategorized/rulesAssistant.tw b/src/uncategorized/rulesAssistant.tw index e36b9f9aecc55f161cf7fc92fd6d0b50f95aefa6..b94a8b970b6857a30d2de31c450667764753a55b 100644 --- a/src/uncategorized/rulesAssistant.tw +++ b/src/uncategorized/rulesAssistant.tw @@ -1185,12 +1185,12 @@ Contraceptives for fertile slaves: <br> <<if $pregSpeedControl > 0 >> Pregnancy control agents for pregnant slaves: <span id = "pregSpeedControl"></span> -No changes <<rbutton "$currentRule.pregSpeed" "nds">> | -None <<rbutton "$currentRule.pregSpeed" "none">> | -Fast gestation <<rbutton "$currentRule.pregSpeed" "fast">> | -Slow gestation <<rbutton "$currentRule.pregSpeed" "slow">> | -Birth supressors <<rbutton "$currentRule.pregSpeed" "supress">> | -Birth stimulators <<rbutton "$currentRule.pregSpeed" "stimulate">> +<<rbutton "$currentRule.pregSpeed" "nds">> No changes | +<<rbutton "$currentRule.pregSpeed" "none">> None | +<<rbutton "$currentRule.pregSpeed" "fast">> Fast gestation | +<<rbutton "$currentRule.pregSpeed" "slow">> Slow gestation | +<<rbutton "$currentRule.pregSpeed" "supress">> Birth supressors | +<<rbutton "$currentRule.pregSpeed" "stimulate">> Birth stimulators <br> <</if>> diff --git a/src/utility/raWidgets.tw b/src/utility/raWidgets.tw index 3e9ed1c3bacb141d92e072726329b357518e1ace..98d14853d34bae98b98369f87234f0252ce54880 100644 --- a/src/utility/raWidgets.tw +++ b/src/utility/raWidgets.tw @@ -144,7 +144,7 @@ % Call as <<RACommonAssignmentVariables>> %/ <<widget "RACommonAssignmentVariables">> - <<set _assignments = [ + <<set _penthouseAssignments = [ "rest", "whore", "please you", @@ -154,7 +154,7 @@ "stay confined", "serve the public", "work a glory hore", - "be a subordinate slave", + "be a subordinate slave" ]>> <<set _facilityAssignments = [ @@ -168,7 +168,7 @@ "be confined in the arcade", "serve in the master suite", "get treatment in the clinic", - "be confined in the cellblock", + "be confined in the cellblock" ]>> <</widget>> @@ -610,6 +610,20 @@ <<RANormalizeAssignments "excludeAssignment">> <</link>> <</if>> +| +<<link "Exclude all">> + <<set $currentRule.excludeAssignment.push("work a glory hole")>> + <<set $currentRule.excludeAssignment.push("get milked")>> + <<set $currentRule.excludeAssignment.push("take classes")>> + <<set $currentRule.excludeAssignment.push("serve the public")>> + <<set $currentRule.excludeAssignment.push("whore")>> + <<set $currentRule.excludeAssignment.push("stay confined")>> + <<set $currentRule.excludeAssignment.push("be a servant")>> + <<set $currentRule.excludeAssignment.push("be a subordinate slave")>> + <<set $currentRule.excludeAssignment.push("please you")>> + <<set $currentRule.excludeAssignment.push("rest")>> + <<RANormalizeAssignments "excludeAssignment">> +<</link>> <</replace>> <</widget>> @@ -987,6 +1001,21 @@ <</link>> <</if>> <</if>> +| +<<link "Exclude all">> + <<set $currentRule.excludeFacility.push("be confined in the cellblock")>> + <<set $currentRule.excludeFacility.push("get treatment in the clinic")>> + <<set $currentRule.excludeFacility.push("rest in the spa")>> + <<set $currentRule.excludeFacility.push("learn in the schoolroom")>> + <<set $currentRule.excludeFacility.push("serve in the master suite")>> + <<set $currentRule.excludeFacility.push("work as a servant")>> + <<set $currentRule.excludeFacility.push("work in the dairy")>> + <<set $currentRule.excludeFacility.push("be confined in the arcade")>> + <<set $currentRule.excludeFacility.push("serve in the club")>> + <<set $currentRule.excludeFacility.push("work in the brothel")>> + <<set $currentRule.excludeFacility.push("live with your Head Girl")>> + <<RANormalizeAssignments "excludeFacility">> +<</link>> <</if>> <</replace>> <</widget>> @@ -1002,7 +1031,7 @@ <<replace #setassignment>> <br><br> -<<if _assignments.includes($currentRule.setAssignment)>> +<<if _penthouseAssignments.includes($currentRule.setAssignment)>> Automatically set assignment: <<link "None">> <<set $currentRule.setAssignment = "no default setting">> @@ -4467,48 +4496,28 @@ is now _combinedRule.hLength cm long. <<if _ruleAppliesToThisSlave && _currentRule.excludeSpecialSlaves>> <<for _L = 0; _L < _leaders.length; _L++>> - <<if (def _leaders[_L].ID) && (_leaders[_L].ID == $args[0].ID)>> + <<if (def _leaders[_L].ID && _leaders[_L].ID == $args[0].ID)>> <<set _ruleAppliesToThisSlave = false>> <<break>> <</if>> <</for>> <</if>> - /% facility and excludeFacility only include some of the - % assignments we're searching for; namely, they don't include - % the leader roles, so we fill these out temporarily - %/ - <<if (def _currentRule.facility)>> - <<set _facility = expandFacilityAssignments(_currentRule.facility)>> - <</if>> - <<if (def _currentRule.excludeFacility)>> - <<set _excludeFacility = expandFacilityAssignments(_currentRule.excludeFacility)>> - <</if>> - /% check exclusion/inclusion %/ <<if _ruleAppliesToThisSlave>> - /% first we check if a slave is in a facility she shouldn't be in %/ - <<if (_facility.length > 0)>> - <<set _ruleAppliesToThisSlave = _facility.includes($args[0].assignment)>> - <<elseif (_excludeFacility.length > 0)>> - <<set _ruleAppliesToThisSlave = !_excludeFacility.includes($args[0].assignment)>> + <<if (_currentRule.assignment.length > 0 || _currentRule.facility.length > 0)>> + <<set _ruleAppliesToThisSlave = ruleAssignmentSelected($args[0], _currentRule)>> + <<elseif (_currentRule.excludeAssignment.length > 0 || _currentRule.excludeFacility.length > 0)>> + <<set _ruleAppliesToThisSlave = !ruleAssignmentExcluded($args[0], _currentRule)>> <</if>> - /% and same thing with the assignments; since actual - % assignments and facility assignments are different - % either the previous if was executed or this one will - % be but not both + /% We then check if a slave is specifically included or + % excluded. This takes precedence over any assignment + % checks. %/ - <<if (def _currentRule.assignment && _currentRule.assignment.length > 0)>> - <<set _ruleAppliesToThisSlave = _currentRule.assignment.includes($args[0].assignment)>> - <<elseif (def _currentRule.excludeAssignment && _currentRule.excludeAssignment.length > 0)>> - <<set _ruleAppliesToThisSlave = !_currentRule.excludeAssignment.includes($args[0].assignment)>> - <</if>> - - /% last but not least, we make sure the slave herself is not excluded %/ - <<if (def _currentRule.selectedSlaves && _currentRule.selectedSlaves.length > 0)>> + <<if (_currentRule.selectedSlaves.length > 0)>> <<set _ruleAppliesToThisSlave = ruleSlaveSelected($args[0], _currentRule)>> - <<elseif (def _currentRule.excludedSlaves && _currentRule.excludedSlaves.length > 0)>> + <<elseif (_currentRule.excludedSlaves.length > 0)>> <<set _ruleAppliesToThisSlave = !ruleSlaveExcluded($args[0], _currentRule)>> <</if>> <</if>>