package thirteen

import (
	"mongo.games.com/goserver/core/logger"

	"mongo.games.com/game/gamerule/thirteen"
	"mongo.games.com/game/gamesrv/base"
)

type PlayerEx struct {
	*base.Player                          //玩家信息
	cards         [13]int                 //手牌信息
	allGroup      map[int]*thirteen.Group //玩家所有牌型
	cardsO        *thirteen.Group         //确定的牌型信息
	isDP          bool                    // 是否倒排
	gainCoin      int64                   //本局赢的金币
	taxCoin       int64                   //本局税收
	deterMine     bool                    //玩家是否确定牌
	score         [7]int64                //玩家每墩的得分 0:头 1中 2尾 3:特殊牌型分数 4打枪 5全垒打 6离场补偿分
	winThreePos   map[int]int64           //只包含打枪玩家位置和总赢分
	winAllPlayers map[int]int64           //玩家位置和输赢分
	isStand       bool                    //玩家站起 true打开 本局结束后自动离开房间 false未打开
	tableScore    [6]int64
	odds          int32
	totalScore    int64
	defGroup      *thirteen.Group
}

func (this *PlayerEx) Clear() {
	this.UnmarkFlag(base.PlayerState_WaitNext)
	this.UnmarkFlag(base.PlayerState_GameBreak)
	this.MarkFlag(base.PlayerState_Ready)
	for i := 0; i < 13; i++ {
		this.cards[i] = -1
	}
	this.allGroup = make(map[int]*thirteen.Group)
	this.cardsO = &thirteen.Group{Head: [3]int{-1, -1, -1}, Mid: [5]int{-1, -1, -1, -1, -1}, End: [5]int{-1, -1, -1, -1, -1}, PokerType: -1}
	this.isDP = false
	this.gainCoin = 0
	this.taxCoin = 0
	this.deterMine = false
	this.score = [7]int64{0, 0, 0, 0, 0, 0, 0}
	this.tableScore = [6]int64{}
	this.winThreePos = make(map[int]int64)
	this.winAllPlayers = make(map[int]int64)
	this.odds = 0
	this.totalScore = 0
	this.defGroup = nil
	this.TestLog = this.TestLog[:0]
}

func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
	if !this.IsGameing() {
		logger.Logger.Trace("(this *PlayerEx) CanOp return false ", this.SnId)
		return false
	}
	return true
}
