fix: replace DiceRoll sentinel value (-1) with nullable Int? (Closes #78) #120

Merged
shahondin1624 merged 1 commits from feature/issue-78-diceroll-sentinel-value-fix into main 2026-04-04 21:46:24 +02:00
Owner

Summary

  • Changed DiceRoll.numberOfSuccesses from Int = -1 to Int? = null to make the un-rolled state type-safe
  • Updated all UI components (DiceRollResultDialog, OpposedTestResultDialog, ExtendedTestResultDialog, HealingDialog) to handle nullable successes with ?: 0
  • Updated business logic (performSimpleTest, performOpposedTest, performExtendedTest, DiceRollHistory, HealingSystem) for null-safety
  • Updated tests to reflect the new nullable type

Test plan

  • All dice-related tests pass (DiceTest, DiceRollResultDialogTest, DiceRollHistoryTest, RollTypeTest)
  • Build compiles successfully
  • Un-rolled DiceRoll now has null instead of -1 — no negative number can display
  • UI dialogs display 0 for un-rolled state instead of -1

Closes #78

## Summary - Changed `DiceRoll.numberOfSuccesses` from `Int = -1` to `Int? = null` to make the un-rolled state type-safe - Updated all UI components (DiceRollResultDialog, OpposedTestResultDialog, ExtendedTestResultDialog, HealingDialog) to handle nullable successes with `?: 0` - Updated business logic (performSimpleTest, performOpposedTest, performExtendedTest, DiceRollHistory, HealingSystem) for null-safety - Updated tests to reflect the new nullable type ## Test plan - [x] All dice-related tests pass (DiceTest, DiceRollResultDialogTest, DiceRollHistoryTest, RollTypeTest) - [x] Build compiles successfully - [x] Un-rolled DiceRoll now has `null` instead of `-1` — no negative number can display - [x] UI dialogs display `0` for un-rolled state instead of `-1` Closes #78
shahondin1624 added 1 commit 2026-04-04 21:46:17 +02:00
Replace the -1 sentinel value for numberOfSuccesses with null (Int?)
to make the un-rolled state type-safe and prevent negative numbers
from ever displaying in the UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
shahondin1624 merged commit c94341df62 into main 2026-04-04 21:46:24 +02:00
shahondin1624 deleted branch feature/issue-78-diceroll-sentinel-value-fix 2026-04-04 21:46:24 +02:00
Sign in to join this conversation.