-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
improvementUpdate of the existing functionalityUpdate of the existing functionalityrefactoringCode style changesCode style changes
Description
Problem
Current evaluator evaluates nested modifiers independently, losing dice pool state.
Industry standard (Roll20, RPG Dice Roller): Each modifier sees ALL dice (including previously dropped ones) and can override previous modifiers.
Example: 4d6dl1kh3
Expected (Roll20/RPG Dice Roller):
- Roll 4d6:
[3, 5, 2, 6] dl1examines all 4 dice, drops lowest (2):[3(k), 5(k), 2(d), 6(k)]kh3examines all 4 dice, keeps highest 3:[3(k), 5(k), 2(d), 6(k)]- Result: 3 + 5 + 6 = 14
Current implementation:
- Roll 4d6:
[3, 5, 2, 6] dl1evaluates completely, produces resultkh3sees only the evaluated result, not original dice pool- Modifiers cannot override each other
Reference
RPG Dice Roller Documentation:
"The keep and drop modifiers work really well together, but there are some caveats. They both look at the entire dice pool."
Solution
Refactor evaluator to pass dice pools through modifier chain instead of evaluating to totals.
Location: src/evaluator/evaluator.ts:184 - evalModifier() function
Complexity: Medium-High
- Requires architectural change to how modifiers work
- Need to preserve dice state through evaluation chain
- Backward compatibility considerations
Stage
Stage 2/3 enhancement - deferred from parser bug fix PR.
Related
- PR fixing parser bug for modifier chaining
- Code comment at
src/evaluator/evaluator.ts:185-189
Metadata
Metadata
Assignees
Labels
improvementUpdate of the existing functionalityUpdate of the existing functionalityrefactoringCode style changesCode style changes