Jump to content
Sheet Folders in Testing ×

Die roller bug for TOR system


Suzuki Stumpy

Recommended Posts

Eric, one for you I suspect.

We've come across a bug in the TOR system function for the die roller.

When rolling favoured skills, the roller rolls 2d12 as the Feat dice and is supposed to take the highest result.  However, under the TOR system, 11 is the Eye of Sauron and is the worst roll that can be made [i.e. counts as zero] and 12 is the Gandalf rune [the best roll that can be made].

We've just had a favoured roll that's selected the eye as the highest roll of the 2d12 as shown below:

image.png.92bbb1f091b86eb9706d3ef8745a9797.png

The actual result should have been:  [5] (0, 4)  since in this case, the five is a better roll than the Eye.

Here's a linky to the actual post so you can see: https://test.myth-weavers.com/index.php?/topic/683-year-2950-those-who-tarry-no-longer/&do=findComment&comment=34895

Link to comment
Share on other sites

Old code:

            if (d.rolls[0] > d.rolls[1] && d.rolls[0] != 11)
                roll = d.rolls[0];
            else
                roll = d.rolls[1];

New code:

            if (d.rolls[0] == 11) // Eye, use the other one (hopefully not also an eye!)
                roll = d.rolls[1];
            else if (d.rolls[1] == 11) // Eye, use the other one (hopefully not also an eye!)
                roll = d.rolls[0];
            else if (d.rolls[0] >= d.rolls[1])
                roll = d.rolls[0];
            else
                roll = d.rolls[1];

As you can probably see, the old code has a weakness if the second roll (d.rolls[1]) is 11 and the first roll is anything less. The new code is (very slightly) less efficient but also very explicit to avoid 11s if at all possible 😄

Link to comment
Share on other sites

×
×
  • Create New...