package room

import (
	"game/common/baseroom"
	"game/common/model/user"
	"game/common/proto/pb"
)

type ColorPlayer struct {
	*user.User
	*user.UserResources
	roomId int

	notBetCount int                // 不投注局数
	totalBet    int64              // 总下注金额
	totalBets   []int64            // 各个区域的下注
	settleMsg   *pb.NtfColorSettle // 本局结算消息
}

func NewColorPlayer(roomId int, u *user.User, res *user.UserResources) *ColorPlayer {
	return &ColorPlayer{
		User:          u,
		UserResources: res,
		roomId:        roomId,
	}
}

func (p *ColorPlayer) Id() int64 {
	return p.ID
}

func (p *ColorPlayer) Robot() baseroom.IRobot {
	return nil
}

func (p *ColorPlayer) IsRobot() bool {
	return false
}

func (p *ColorPlayer) RoomId() int {
	return p.roomId
}

// 没有投注的局数
func (p *ColorPlayer) addNotBetCount() {
	p.notBetCount++
}

// 游戏开始前，清理玩家上局数据
func (p *ColorPlayer) resetData() {
	p.settleMsg = &pb.NtfColorSettle{}
	p.totalBet = 0
	p.totalBets = p.totalBets[:0]
	for range pb.ColorBetArea_name {
		p.totalBets = append(p.totalBets, 0)
	}
}
