Browse Source

过牌逻辑

master
tangmingyou 4 years ago
parent
commit
00cc478803
  1. 1
      api/poker.proto
  2. 2
      internal/game/player.go
  3. 1
      internal/game/table.go
  4. 5
      internal/service/table.go

1
api/poker.proto

@ -147,7 +147,6 @@ message TablePlayer {
string avatar = 4; string avatar = 4;
int32 chip = 5; // int32 chip = 5; //
int32 status = 6; // : 1,2,(3,4,5,6,7) int32 status = 6; // : 1,2,(3,4,5,6,7)
int32 lastStatus = 7; // TODO ,
bool master = 8; // bool master = 8; //
int32 roundBetTimes = 11; // int32 roundBetTimes = 11; //
int32 totalBetChip = 13; // int32 totalBetChip = 13; //

2
internal/game/player.go

@ -20,7 +20,6 @@ type Player struct {
Chip int32 // 玩家筹码 Chip int32 // 玩家筹码
TotalBetChip int32 // 本次游戏已下注筹码 TotalBetChip int32 // 本次游戏已下注筹码
Status int32 // 状态: 1待准备开始,2已准备开始,3等待其他玩家动作,[4第一回合小盲注跟注,5待大盲注,5待小盲注,] 6待跟注,7已弃牌,8结算中 Status int32 // 状态: 1待准备开始,2已准备开始,3等待其他玩家动作,[4第一回合小盲注跟注,5待大盲注,5待小盲注,] 6待跟注,7已弃牌,8结算中
LastStatus int32 // 变化前一个状态
BetOpts []int32 // status=[4,6]时下注可操作按钮: 1跟注,2加注(-[0]+),3All-In,4弃牌,5过牌 BetOpts []int32 // status=[4,6]时下注可操作按钮: 1跟注,2加注(-[0]+),3All-In,4弃牌,5过牌
BetMin int32 // 最低下注额 BetMin int32 // 最低下注额
BetMax int32 // 最高下注额 -1不限 BetMax int32 // 最高下注额 -1不限
@ -81,6 +80,5 @@ func (p *Player) SetStatus(status int32) {
} }
} }
p.LastStatus = p.Status
p.Status = status p.Status = status
} }

1
internal/game/table.go

@ -160,7 +160,6 @@ func (t *Table) BuildResGameFullStatus() *api.ResGameFullStatus {
Avatar: p.Avatar, Avatar: p.Avatar,
Chip: p.Chip, Chip: p.Chip,
Status: p.Status, Status: p.Status,
LastStatus: p.LastStatus,
Master: t.MasterId == p.Id, Master: t.MasterId == p.Id,
RoundBetTimes: p.RoundBetTimes, RoundBetTimes: p.RoundBetTimes,
TotalBetChip: p.TotalBetChip, TotalBetChip: p.TotalBetChip,

5
internal/service/table.go

@ -58,7 +58,6 @@ func HandleReqCreateTable(account *session.NetAccount, msg *api.ReqCreateTable)
Username: account.UserName, Username: account.UserName,
Avatar: account.Avatar, Avatar: account.Avatar,
Status: 1, Status: 1,
LastStatus: 0,
Chip: table.LimitInAmount, Chip: table.LimitInAmount,
TotalBetChip: 0, TotalBetChip: 0,
Cards: [2]*game.Card{}, Cards: [2]*game.Card{},
@ -156,7 +155,6 @@ func HandleReqJoinTable(account *session.NetAccount, msg *api.ReqJoinTable) (pro
Username: account.UserName, Username: account.UserName,
Avatar: account.Avatar, Avatar: account.Avatar,
Status: 1, Status: 1,
LastStatus: 0,
Chip: 0, Chip: 0,
TotalBetChip: 0, TotalBetChip: 0,
Cards: [2]*game.Card{nil, nil}, Cards: [2]*game.Card{nil, nil},
@ -534,7 +532,7 @@ func HandleReqBetting(player *game.Player, msg *api.ReqBetting) (proto.Message,
} }
case 5: // 过牌 case 5: // 过牌
table.LastPosBetType = 5 table.LastPosBetType = 5
player.RoundBetTimes++ // player.RoundBetTimes++
betNotice.Line2 = "过牌" betNotice.Line2 = "过牌"
default: default:
@ -559,6 +557,7 @@ func HandleReqBetting(player *game.Player, msg *api.ReqBetting) (proto.Message,
//} //}
if !raise { if !raise {
// 当前玩家未加注, 判断是否结束本轮下注 // 当前玩家未加注, 判断是否结束本轮下注
if nextPlayer.RoundBetTimes == player.RoundBetTimes { if nextPlayer.RoundBetTimes == player.RoundBetTimes {
// 开启下一轮 // 开启下一轮

Loading…
Cancel
Save