diff --git a/main.go b/main.go index f18e024..6a44894 100644 --- a/main.go +++ b/main.go @@ -8,16 +8,22 @@ import ( ) func main() { - var surfaces, throws int + var surfaces, modifier, diceThrows int rand.Seed(time.Now().Unix()) - flag.IntVar(&surfaces, "s", 20, "Specify amount of die surfaces") - flag.IntVar(&throws, "t", 1, "Specify dice throws") + flag.IntVar(&diceThrows, "t", 1, "Specify dice diceThrows") + flag.IntVar(&modifier, "m", 0, "Stat modifier") flag.Parse() - Cast(surfaces, throws) + total := Cast(surfaces, diceThrows) + if modifier != 0 { + fmt.Println("Without modifier:", total) + fmt.Println("With modifier:", total+modifier) + } else { + fmt.Println(total) + } } -func Cast(dieSurfaces, castAmount int) { +func Cast(dieSurfaces, castAmount int) int { var ( casts []int cast, total int @@ -32,6 +38,5 @@ func Cast(dieSurfaces, castAmount int) { if castAmount > 1 { fmt.Println(casts) } - - fmt.Println(total) + return total }