From 85ff6578e812248367b75c574e55dd19ec472087 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 22 Sep 2019 10:56:10 +0100 Subject: fixes #8 --- wat/game.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'wat') diff --git a/wat/game.go b/wat/game.go index e401a72..b46707b 100644 --- a/wat/game.go +++ b/wat/game.go @@ -204,12 +204,19 @@ func (g *WatGame) Roll(player *Player, fields []string) string { dieSize = int64(userDieSize) } } + lotteryNum := int64(-1) + if dieSize > 100 { + lotteryNum = int64(g.RandInt(dieSize)) + 1 + } if amount > player.Coins { return "wat? brokeass" } n := int64(g.RandInt(dieSize)) + 1 ret := fmt.Sprintf("%s rolls the %d sided die... %d! ", player.Nick, dieSize, n) - if n < dieSize/2 { + if n == lotteryNum { + player.Coins += player.Coins + ret += fmt.Sprintf("You won the wattery! Your bet was ignored, but your bank balance was doubled!") + } else if n < dieSize/2 { player.Coins += amount ret += fmt.Sprintf("You win! ◕ ◡ ◕ total: %d %s", player.Coins, currency) } else { -- cgit v1.2.3