From 852bd4c906c799c307e7d3e3bed23b344336f5b7 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Fri, 29 Jul 2022 13:30:48 +0200 Subject: [PATCH] Yet more string foermatting --- main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 010c5a9..6fba463 100644 --- a/main.go +++ b/main.go @@ -47,11 +47,6 @@ func main() { } default: - if diceThrows <= 1 { - fmt.Println(string(ColorYellow), "Rolling die...:", string(ColorReset)) - } else{ - fmt.Println(string(ColorYellow), "Rolling",diceThrows,"dice...:", string(ColorReset)) - } Cast(surfaces, diceThrows) } } @@ -91,6 +86,12 @@ func Cast(dieSurfaces, castAmount int) { fmt.Println(string(ColorBlue), "\tIndividual rolls:", casts, string(ColorReset)) } + if modifier != 0 { + fmt.Printf("%sRolling %dd%d + %d...\n%s", ColorYellow, diceThrows, surfaces, modifier, ColorReset) + } else { + fmt.Printf("%sRolling %dd%d...\n%s", ColorYellow, diceThrows, surfaces, ColorReset) + } + if modifier != 0 { fmt.Println("\tWithout modifier:", total) fmt.Println(string(ColorGreen), "\tWith modifier:", total+modifier, string(ColorReset))