blowup now locks out subsequent rolls, unit tests added
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user