# Basic rules

Scenarios
Roll dice
Given
the parameters are input
And
an initial roll of initial_roll
When
I submit a roll
Then
I should see result
Examples:
input initial_roll result
2d10 2, 3 [2, 3] = 5
4d10 4, 3, 2, 4 [4, 3, 2, 4] = 13
3d12 3, 2, 12 [3, 2, 12] = 17
Reroll dice
Given
the parameters are input
And
an initial roll of initial_roll
And
the sequence of dice rolled is sequence
When
I submit a roll
Then
I should see result
Examples:
input initial_roll sequence result
1d10.reroll(1) 1 1, 3 [3] = 3
2d10.reroll(1) 1, 3 4 [4, 3] = 7
2d10.reroll(1) 1, 3 1, 4 [4, 3] = 7
Explode dice
Given
the parameters are input
And
an initial roll of initial_roll
And
the sequence of dice rolled is sequence
When
I submit a roll
Then
I should see result
Examples:
input initial_roll sequence result
1d10.explode(10) 10 1 [[10, 1] (11)] = 11
2d10.explode(10) 10, 3 4 [[10, 4] (14), 3] = 17
2d10.explode(10) 10, 4 10, 5 [[10, 10, 5] (25), 4] = 29
Add or subtract a constant value
Given
the parameters are input
And
an initial roll of initial_roll
When
I submit a roll
Then
I should see result
Examples:
input initial_roll result
2d10 + 2 2, 3 [2, 3, 2] = 7
4d10 + 5 4, 3, 2, 4 [4, 3, 2, 4, 5] = 18
4d10 - 3 4, 3, 2, 4 [4, 3, 2, 4, -3] = 10

Last published almost 7 years ago by Edward Monical-Vuylsteke.