Closed sigfriedmcwild closed 4 years ago
Yeah, I think the best way of handling rolling three different dice and only keeping specific ones is with the roll groups, as you mentioned. Once the roll group functionality is complete, the notation will likely look something like:
{d4, d6, d8}kh2dh1
Or (If the modifier uniqueness is changed as described below):
{d4, d6, d8}dl1dh1
Your example above; 3d6dh1dl1: [6, 4d, 6] = 12
is actually correct at the moment. Only one modifier of each type can be applied to a roll set, and only the last one will be kept. So the dh1
gets ignored.
As you thought though, a combination of d
and k
can (Or should be able to) be used to work around it. This is because they both function in the same way, by flagging rolls to drop - the keep modifier works out what it wants to keep and flags others as dropped.
The modifier name is used as a reference throughout, so it has to be unique. I will look into making the drop and keep modifier names also be pre-pended by h
or l
as relevant, so they can be used together, but I'm not sure how easy that would be without re-looking at that part of the code.
However, I can't see a way of it working properly with the keep modifier. I think you'll just end up with everything being dropped:
3d6kh1kl1: [6d, 4d, 2d] = 0
kh1
flags the lower two as dropped, then the kl1
flags the highest two as dropped, levaing none remaining.
Modifiers do indeed run in a particular order. Each modifier has an order
property, and it runs from lowest to highest. This is generally to esure that they run in the correct order, regardless of which order they've been specified in.
The "Keep" modifier has an order of 3
, and the "Drop" modifier has an order of 4
.
However, the order of these two shouldn't really matter here, as the result shoud be the same. I'd only expect different results if the values were modified.
So these two are, and should be, equivalent:
3d6kh2dh1: [5d, 3, 1d] = 3 // `k` first
3d6dh1kh2: [3, 1d, 5d] = 3 // `d` first
Bare in mind that, by default, all dice are "kept" unless explicitely flagged as dropped. The keep modifier works by blacklisting dice to drop. It doesn't flag any as "kept". So even if it ran after the drop modifier, it wouldn't "keep" a roll that has been dropped. I'm also unsure as to whether it should or not. If one modifier explicitely drops a dice, should another be able to "un-drop" it?
There do seem to be some issues with using both keep and drop together though.
I wouldn't expect to get either of these results, that you found (And I've replicated):
3d6kh2dl1: [4, 2d, 2d] = 4
should be
3d6kh2dl1: [4, 2d, 2] = 6
or 3d6kh2dl1: [4, 2, 2d] = 6
The kh
(keep highest) has means that the lowest value gets dropped, and so does the dl
(drop lowest). Unfortunately, we have two numbers both the lowest, and it's chosen a different roll to drop each time. Ideally, this should probably drop the same roll.3d6kh2dl1: [2dd, 4, 5] = 9
should be
3d6kh2dl1: [2d, 4, 5] = 9
The drop modifier has been added to the correct roll, but shouldn't be duplicated, even though it's applicable twice.I've raised tickets #130 and #131 to cover the issues with too many rolls being dropped, and a roll being dropped twice. Thought it best to sort them out seperately.
I'll leave this one open for looking into the modifier uniqueness.
Thanks for the details. I think it would be nice to have the specific interactions of k
and d
documented in the docs: I could see 3d6kh2dl1
always dropping 2 dice, since keep is executed first. But then again maybe order is not really a thing since the both operate on the full pool, ignoring what the previous modifier did.
And I agree given the definitions of k
as "drop all but n highest/lowest dice" having both kh
and kl
will not make sense.
I don't know if "undropping dice" is a concept that makes sense and it's definitely something that can be dealt with at a later time.
I've made it so that you can use dl
and dh
together like:
// roll a d10 4 times and drop the highest and lowest rolls
4d10dh1dl2: [5, 3d, 7, 8d] = 12
I've also updated the readme to explain using Keep and Drop together.
These changes are on the develop
branch, and will be going out in version 4.2.0.
I've just pushed this out in v4.1.1, rather than wait for the v4.2.0 release.
The sentinel comics rpg (https://www.kickstarter.com/projects/gtgames/sentinel-comics-the-roleplaying-game) uses a system where the player rolls 3 dice of different sizes and usually keeps the middle 1.
This could be expressed as
{d4+d6+d8}dh1dl1
once roll groups (#88) are implemented but currently only the lastd
modifier is kept.Some examples from the test site (using a 3d6 roll as a place holder):
3d6dh1: [1, 3, 4d] = 4
works as expected3d6dl1: [3, 1d, 5] = 8
also works as expected3d6dh1dl1: [6, 4d, 6] = 12
only 1 die is droppedAs I played around with this I noticed that
k
andd
modifiers can both be present but their stacking is not obvious3d6kh2dh1: [5d, 3, 1d] = 3
yay3d6dh1kh2: [3, 1d, 5d] = 3
isk
always resolved befored
? (can we have a priority list added to the docs?)3d6kh2dl1: [4, 2d, 2d] = 4
this is kind of what I'd expect3d6kh2dl1: [2dd, 4, 5] = 9
this is not what I'd expectAnyway, I feel that being able to use both
dh
anddl
would make writing formulas trimming some amount of max and min dice more intuitive than using a combo ofk
andd
especially in hypothetical scenarios where the pool size is unknown.And I see no reason not to allow this for
kh
andkl
, but I'm not sure I can provide any actual examples of games that would use the functionality.This does introduce a difference of behaviour from roll20, so I can understand if you think full compatibility is more important (but I wonder how many people would actually notice)