Some settings and/or house rules might want a more fluid amount of Major and Minor Hindrances. Instead of requiring a set number you can base it on a targeted maximum Reward Point value.
To get this to work I used a replace Thing ID for valHinders, which is a Simple called Hindrances.
In the first Eval Rule script, I changed the equations for the
~RDS SWD Max Major and Max Minor are now dynamic values
In this example I decided on a maximum of 10, which can be 5 Major Hindrances, 10 Minor Hindrances, or any combination that equals 10 Reward Points.
Code:
var major as number
var minor as number
~iterate through all hindrances and tally up the number of majors and minors
~Note: We must only tally hindrances that are user added and not an advance.
foreach pick in hero from Hindrance
if (eachpick.isuser + !eachpick.tagis[Advance.?] >= 2) then
if (eachpick.field[hinMajor].value = 0) then
minor += 1
else
major += 2
endif
endif
nexteach
~determine our maximum number of major and minor hindrances
var max_major as number
var max_minor as number
~RDS SWD Max Major and Max Minor are now dynamic values
max_major = minimum(major, 10)
max_minor = minimum(minor, 10 - max_major)
~if we have no more than our maximum major and minor hindrances, we're good
if (major <= max_major) then
validif (minor <= max_minor)
endif
~synthesize our validation message appropriately
@message="Maximum of " & max_major & " points worth of major and " & max_minor & " points worth of minor hindrances allowed"
~mark associated tabs as invalid
container.panelvalid[edges] = 0
~assign a tag to the hero to indicate the invalid state
~Note: This is used to color highlight the title above hindrances on the tab.
perform hero.assign[Hero.BadHinders]
The effect is that as Major are selected, it will diminish the number of possible Minor Hindrances. For a more by-the-book value you might want to put 4 instead of my 10 above.