Small cleanups, roll actual value first

This commit is contained in:
🐙PiperYxzzy
2024-03-10 11:32:27 +02:00
parent f70c713c5f
commit 0013559f3f

View File

@@ -89,6 +89,9 @@ func main() {
} }
func simulate(dieFunc func() int, bouncesMin int, bouncesMax int, critNeut []int, critGood []int, critBad []int) int { func simulate(dieFunc func() int, bouncesMin int, bouncesMax int, critNeut []int, critGood []int, critBad []int) int {
actualRoll := dieFunc()
// The following segment is just to animate a little dice roll
bounces := globalRand(bouncesMax-bouncesMin) + bouncesMin bounces := globalRand(bouncesMax-bouncesMin) + bouncesMin
fmt.Print("") fmt.Print("")
@@ -100,11 +103,11 @@ func simulate(dieFunc func() int, bouncesMin int, bouncesMax int, critNeut []int
rwait := globalRand(50) + 25 rwait := globalRand(50) + 25
time.Sleep(time.Millisecond * time.Duration(rwait)) time.Sleep(time.Millisecond * time.Duration(rwait))
} }
// End diceroll animation
actualRoll := dieFunc() colour := "\033[36m" // Cyan
colour := "\033[36m" // Blue
if isIn(critNeut, actualRoll) { if isIn(critNeut, actualRoll) {
colour += "\033[1m\033[35m" // Purple colour = "\033[1m\033[35m" // Purple
} else if isIn(critBad, actualRoll) { } else if isIn(critBad, actualRoll) {
colour = "\033[1m\033[31m" // Red colour = "\033[1m\033[31m" // Red
} else if isIn(critGood, actualRoll) { } else if isIn(critGood, actualRoll) {