This is a package that will with the various random aspects of Table Top Roll Play Games
To install:
]add https://github.com/btaidm/RPGHelper.jl.gitDice rolling is very simple:
Single Die:
using RPGHelper
result = roll(d10)
sumOfRoll = result[]Multiple of the same type of die:
using RPGHelper
result = roll(2d4)
sumOfRoll = result[]
Multiple different types of dice:
using RPGHelper
# Add the results
result = roll(d4 + d8)
sumOfRoll = result[]
# Subtract the results
result = roll(d8 - d4)
sumOfRoll = result[]
# Any Combination
result = roll(2d10 - d4 + d8)
sumOfRoll = result[]Other simple operators: *, /, ^, %, abs, floor, ceil, abs
Add Integer Constants:
using RPGHelper
# Add a constant
result = roll(d4 + 2)
sumOfRoll = result[]
# Subtract a constant
result = roll(d10 - 3)
sumOfRoll = result[]Each of the standard dice have been defined:
d2d4d8d10d12d20d100dF
To create a die of any side count, N:
const weirdDie = RPGHelper.Die(15)To create non-uniform dies:
const dNonUnifrom = NonUniformDie(1,2,2,3,3,0)A standard set of roll modifiers are available. Modifiers only affect Single Dies or multiples of the Same Die Type
Explode:
# Explode on highest roll
results = 3d6 |> Explode() |> roll
sumOfRoll = results[]
# Explode on number
results = 3d8 |> Explode(5) |> roll
# Explode on condition
results = 3d10 |> Explode(x->3 <= x <= 5) |> roll
# Explode Chaining
results = 3d20 |> Explode(1) |> Explode(2) |> roll
# Explode Once
results = 3d4 |> Explode(once = true) |> rollThere are explode variants:
- Compounding:
Explode(compounding = true) - Penetrating:
Explode(penetrating = true)
They variants can be combined
Reroll:
# Reroll on lowest roll
results = 3d6 |> Reroll() |> roll
sumOfRoll = results[]
# Reroll on number
results = 3d8 |> Reroll(5) |> roll
# Reroll on condition
results = 3d10 |> Reroll(x->3 <= x <= 5) |> roll
# Reroll Chaining
results = 3d20 |> Reroll(1) |> Reroll(2) |> roll
# Reroll Once
results = 3d4 |> Reroll(once = true) |> rollKeep:
# Keep the 4 highest rolls
results = 8d6 |> Keep(4) |> roll
results = 8d6 |> Keep(:high, 4) |> roll
# Keep the 4 lowest rolls
results = 8d6 |> Keep(:low, 4) |> rollDrop:
# Drop the 4 lowest rolls
results = 8d6 |> Drop(4) |> roll
results = 8d6 |> Drop(:low, 4) |> roll
# Drop the 4 highest rolls
results = 8d6 |> Drop(:high, 4) |> rollModifiers can be chained together. They follow the order of:
- Explode, Penetrating, Compounding
- Reroll
- Keep
- Drop
To be created.