added modal reroll

This commit is contained in:
Rory Hinnen
2026-09-07 10:07:07 -05:00
parent 17f2b0a288
commit a4d1634df7
5 changed files with 153 additions and 18 deletions
+19 -1
View File
@@ -278,6 +278,25 @@ struct Dice {
self.add(pool: rerolls)
}
}
mutating func rerollBelow(cutoff: Int) {
var count = 0
for faceValue in 1..<cutoff {
guard let face = DiceType(rawValue: faceValue) else { continue }
count += value(which: face)
switch face {
case .one: one = 0
case .two: two = 0
case .three: three = 0
case .four: four = 0
case .five: five = 0
case .six: six = 0
}
}
var rerolls = Dice()
rerolls.roll(howMany: count)
add(pool: rerolls)
}
mutating func blowup(dice: DiceType) {
var rolls = Dice()
@@ -291,4 +310,3 @@ struct Dice {
}
}