blowup now locks out subsequent rolls, unit tests added

This commit is contained in:
Rory Hinnen
2026-09-07 10:27:56 -05:00
parent a4d1634df7
commit 025b006194
5 changed files with 381 additions and 39 deletions
+17
View File
@@ -150,6 +150,8 @@ class Roll: ObservableObject {
@Published var hitHasRerolled = false
@Published var woundHasRerolled = false
@Published var saveHasRerolled = false
@Published var blowupUsed = false
// calculated variables
var totalDigits: [Int] {
@@ -341,6 +343,7 @@ class Roll: ObservableObject {
self.total = save
self.state = .hit
hitHasRerolled = false
blowupUsed = false
}
self.dice.roll(howMany: self.total)
}
@@ -349,6 +352,20 @@ class Roll: ObservableObject {
func resetPool() {
dice.roll(howMany: total)
hitHasRerolled = false
blowupUsed = false
}
func applyBlowup(face: Dice.DiceType) {
guard !blowupUsed else { return }
switch face {
case .six:
dice.blowup(dice: .six)
case .five:
dice.blowup(dice: .five)
default:
break
}
blowupUsed = true
}
func applyReroll() {