-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DiceRoll with provided rolls are not being computed by notation with modifiers #230
Comments
The import process is very simple; it takes what you give it, and assumes that it's correct. It doesn't run any modifiers or alter the data, as the assumption is that the data has already been modified (Generally by exporting the data from an existing So, using your second example, you would also need to modify the value of the Note: The // passing `false` as the third parameter sets it to be "ignored" when calculating roll totals
new Results.RollResult(2, ['drop'], false); So, your example would look something like: const data = {
notation: '4d6dl1',
rolls: new Results.ResultGroup([
new Results.RollResults([
3, 6, 4,
new Results.RollResult(2, ['drop'], false),
]),
])
};
const roll = new DiceRoll(data);
console.log("roll result", roll) // roll.total = 13 Although you may also be able to do something like this, as an array gets cast to a const data = {
notation: '4d6dl1',
rolls: [
3,
6,
2,
new Results.RollResult(2, ['drop'], false),
],
}; I think that should work for you. Let me know if not. |
Yes, setting the I am building a 3D dice roller. I was hoping I could use the parsed results to determine what dice to roll and then send back the 3D roll results with the original notation to be computed. I don't want to handle the computing of notations manually. That's probably out of scope for this library. Perhaps a future feature? |
Hm interesting. I can see that being able to pass through "raw" values, with the notation, and having them passed could be good. Maybe as something like Out of interest, and knowing nothing about the 3D roller your building; would it be feasible to reverse the logic? |
I did look into forcing the dice to show a specific face, but it looks very unnatural and janky. |
It seems supplying rolls to a DiceRoll class only results in those rolls being added together. Modifiers are not being handled.
I would expect the total of this roll (4d6 drop lowest 1) to be 13, but it is 15.
A more complex example using RollResult yields the same result
This second example will almost match a plain
new DiceRoll('4d6dl1')
except that the lowest die is not dropped from the total.Am I doing something wrong?
The text was updated successfully, but these errors were encountered: