@@ -32,6 +32,13 @@ struct mod {
int value;
};
+/**
+ * In some cases, the roller is not interested in the actual value of the dice
+ * rolled, but only if they pass some metric.
+ * This object allows us to perform that check, and then conveniently obfuscate
+ * the numbers rolled so that the player cannot intuit their odds of success in
+ * the short term.
+ */
struct difficulty_class {
enum class test { None, Less, LessOrEqual, Greater, GreaterOrEqual };
@@ -20,17 +20,20 @@ namespace dice {
*
* dice-string:
* dice-expression
- * positive-integer { dice-expression }
- *
- * positive-integer: Any integer number >= 0
+ * positive-integer '{' dice-expression '}'
* dice-expression:
* die-expression
- * die-expression + dice-expression
- * die-expression - dice-expression
+ * die-expression {'+'|'-'} dice-expression-rec
+ *
+ * dice-expression-rec:
+ * {die-expression|modifier}
+ * {die-expression|modifier} {'+'|'-'} dice-expression-rec
+ * modifier:
+ * positive-integer
* die-expression:
- * integer
* positive-integer 'd' positive-integer
* positive-integer 'D' positive-integer
*/