up
This commit is contained in:
parent
1213064569
commit
402d20109c
@ -70,22 +70,33 @@ func Entry(ctx *zero.Ctx) {
|
||||
result := ""
|
||||
playerHaveThirdCard := false
|
||||
if playerPoint == 8 || playerPoint == 9 {
|
||||
result = "闲家例牌, 闲赢"
|
||||
result = "闲家例牌, 闲赢\n"
|
||||
if bet == "闲" {
|
||||
result += fmt.Sprintf("恭喜你赢得了本局游戏, 你赢得了%d", round.Bet)
|
||||
redisrepo.AddUserBalance(ctx.Event.UserID, betAmount)
|
||||
} else {
|
||||
result += "很遗憾, 你输了本局游戏"
|
||||
redisrepo.SubUserBalance(ctx.Event.UserID, betAmount)
|
||||
}
|
||||
ctx.Send(fmt.Sprintf(EntryMsgTemplate, round.DealerHand, round.PlayerHand, result))
|
||||
return
|
||||
}
|
||||
if playerPoint == 0 || playerPoint == 1 || playerPoint == 2 || playerPoint == 3 || playerPoint == 4 || playerPoint == 5 {
|
||||
if dealerPoint == 8 || dealerPoint == 9 {
|
||||
result = "庄家例牌, 庄赢"
|
||||
if bet == "庄" {
|
||||
result += fmt.Sprintf("恭喜你赢得了本局游戏, 你赢得了%d", decimal.NewFromInt(round.Bet).Mul(decimal.NewFromFloat(0.95)).IntPart())
|
||||
redisrepo.AddUserBalance(ctx.Event.UserID, decimal.NewFromInt(round.Bet).Mul(decimal.NewFromFloat(0.95)).IntPart())
|
||||
} else {
|
||||
result += "很遗憾, 你输了本局游戏"
|
||||
redisrepo.SubUserBalance(ctx.Event.UserID, betAmount)
|
||||
}
|
||||
ctx.Send(fmt.Sprintf(EntryMsgTemplate, round.DealerHand, round.PlayerHand, result))
|
||||
return
|
||||
}
|
||||
if dealerPoint != 8 && dealerPoint != 9 {
|
||||
result = fmt.Sprintf("闲家%d点, 庄家%d点, 闲家补牌\n", playerPoint, dealerPoint)
|
||||
round.PlayerHand = append(round.PlayerHand, round.Deck.Pop())
|
||||
playerPoint = CalculateCardPoint(round.PlayerHand)
|
||||
playerHaveThirdCard = true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user