Rolisteam/DiceParser

New Feature Request - partial adds

Closed this issue · 3 comments

In the game World in Flames and a few other similar wargames there are die roll modifiers that are referred to as "fractional". That is, instead of the die roll modifier being a simple +4 or +6 or similar, it may be something like +4.3

The meaning of "+4.3" is that there is a 30% chance that the modifier is =5, otherwise it is +4. Similarly +4.9 would be a 90% chance of +5 but otherwise (10%) +4.

On our current server we handle this with making 2 separate die rolls -- one to determine whether the modifier goes up, and one to make the actual roll with the "modified" modifier.

It would be a nice feature to be able to type:

!2d10+4.5 # test roll

... and have DiceParser understand the "+4.5" modifier, making a separate roll for the percentage "roll up" and then adding that rolled up modifier to the result..

Current output:

`Warning: Unexpected character at 6 - end of command was ignored ".5 # test roll"

. # 12
Details:[2d10+4.5 # test roll (6 2)]`

Desired output:

`test roll

. # 0.5/1 chance of +4 becoming +5 ---> 0.9, modifier remains +4
. # 12
Details:[2d10+4.5 # (6 2)]`

Hello,
As far as I understood there is no need for new feature.
In your formula, the .5 it is just a way to write the parameter which is in reality 50%.
An macro can solve that. Yes, DiceParser does not manage float number but in it not the case, here.

First, we have to create a formula that can do the right operations.

let say the bonus is 4 and the chance threshold is 50%. (just like your example: !2d10+4.5 # test roll)

What we do:

  1. Roll 2d10
  2. Roll 1d100
  3. compute the bonus
  4. display final result (and intermediate result to check everything is working well.

!2d10;1d100;$2i[<=50]{5}{4};$1+$3;"Score: $4 [@1 - @2 - $3]"

Now, we have a command which is working.

Now, we want to be able to set some parameter in this command:

  1. The number of dice,
  2. The face count of dice (May not be useful but)
  3. The threshold
  4. The bonus base

!\1d\2;1d100;$2i[<=\40]{\3+1}{\3};$1+$3;"Score: $4 [@1 - @2 - $3]"

now, we can define an macro with the proper parameter to solve

!macro add (\d+)d(\d+)\+(\d+).(\d+) \1d\2;1d100;$2i[<=\40]{\3+1}{\3};$1+$3;"Score: $4 [@1 - @2 - $3]" True

This macro can transform command of the shape:
!2d10+4.5 into !2d10;1d100;$2i[<=50]{4+1}{4};$1+$3;"Score: $4 [@1 - @2 - $3]"

image

Thanks very much for your help. I will test this out.

I have testedd this and added the macro and it does indeed work. I discovered some extra features as well that are very helpful for WiF. Thanks again for your help and your software.