added modal reroll
This commit is contained in:
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user