消除积分改累计值

This commit is contained in:
meixiongfeng 2023-10-25 14:15:43 +08:00
parent 86ea90004b
commit f406d53316
4 changed files with 8 additions and 41 deletions

View File

@ -48,22 +48,6 @@ func (this *apiComp) Match(session comm.IUserSession, req *pb.EntertainMatchReq)
} }
} }
// if users, err := this.module.ModuleUser.UserOnlineList(); err == nil {
// if len(users) > 0 {
// bMatch = true
// s2, bMatch = this.module.GetUserSession(users[0].Uid)
// p2 = &pb.PlayerData{
// Uid: s2.GetUserId(),
// Name: "",
// Score: 0,
// Ps: 0,
// Cardid: req.Idcard,
// }
// } else { // 测试用
// }
//
// }
roomid = this.module.gameMgr.CreateRoom(session, s2, p1, p2) roomid = this.module.gameMgr.CreateRoom(session, s2, p1, p2)
session.SendMsg(string(this.module.GetType()), "match", &pb.EntertainMatchResp{ session.SendMsg(string(this.module.GetType()), "match", &pb.EntertainMatchResp{
Maych: true, Maych: true,

View File

@ -101,25 +101,7 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
} }
} }
} }
// roomid := this.module.gameMgr.CreateRoom(session, s2, p1, p2) //roomid := this.module.gameMgr.CreateRoom(p1, p2)
// if leftnum > 0 {
// if ais, err = this.module.parkourComp.matcheAI(dan, leftnum); err != nil {
// this.module.Error("matcheAI err!", log.Field{Key: "key", Value: err.Error()})
// return
// }
// if len(red) < 3 {
// n = 3 - int32(len(red))
// red = append(red, ais[0:n]...)
// ais = ais[n:]
// }
// if len(bule) < 3 {
// bule = append(bule, ais[0:3-len(bule)]...)
// }
// }
// if err = this.module.createbattle(red, bule); err != nil {
// this.module.Error("createbattle err!", log.Field{Key: "key", Value: err.Error()})
// }
return return
} }

View File

@ -132,6 +132,7 @@ func (this *Room) AiOperator() {
if len(szMap) > 0 { if len(szMap) > 0 {
this.player2.Energy += szMap[len(szMap)-1].CurEnergy this.player2.Energy += szMap[len(szMap)-1].CurEnergy
this.player2.Score += szMap[len(szMap)-1].CurSocre
} }
if bAddPs { if bAddPs {
@ -319,8 +320,10 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
if len(szMap) > 0 { if len(szMap) > 0 {
if color == 1 { if color == 1 {
this.player1.Energy += szMap[len(szMap)-1].CurEnergy this.player1.Energy += szMap[len(szMap)-1].CurEnergy
this.player1.Score += szMap[len(szMap)-1].CurSocre
} else { } else {
this.player2.Energy += szMap[len(szMap)-1].CurEnergy this.player2.Energy += szMap[len(szMap)-1].CurEnergy
this.player2.Score += szMap[len(szMap)-1].CurSocre
} }
} }
if this.player1.Ps <= 0 { // 权限给下一个人 if this.player1.Ps <= 0 { // 权限给下一个人

View File

@ -445,21 +445,20 @@ func (this *MapData) CheckMap(color int32) (score int32, szMap []*pb.MapData, xc
var energy int32 var energy int32
for { for {
curScore = 0 curScore = 0
energy = 0
if bRet, s, c := this.Check5X(color); bRet { if bRet, s, c := this.Check5X(color); bRet {
fmt.Printf("=====检测消除5x===========\n") //fmt.Printf("=====检测消除5x===========\n")
curScore += s curScore += s
energy += c energy += c
xc = true // 只要有 4x 5x 就标记ture xc = true // 只要有 4x 5x 就标记ture
} }
if bRet, s, c := this.Check4X(color); bRet { if bRet, s, c := this.Check4X(color); bRet {
fmt.Printf("=====检测消除4x===========\n") //fmt.Printf("=====检测消除4x===========\n")
curScore += s curScore += s
energy += c energy += c
xc = true xc = true
} }
if bRet, s, c := this.Check3X(color); bRet { if bRet, s, c := this.Check3X(color); bRet {
fmt.Printf("=====检测消除3x===========\n") //fmt.Printf("=====检测消除3x===========\n")
curScore += s curScore += s
energy += c energy += c
} }
@ -468,7 +467,7 @@ func (this *MapData) CheckMap(color int32) (score int32, szMap []*pb.MapData, xc
if this.DropGirde() { if this.DropGirde() {
szMap = append(szMap, &pb.MapData{ szMap = append(szMap, &pb.MapData{
Data: this.GetPalatData(), Data: this.GetPalatData(),
CurSocre: curScore, CurSocre: score,
CurEnergy: energy, CurEnergy: energy,
}) })
} }
@ -479,7 +478,6 @@ func (this *MapData) CheckMap(color int32) (score int32, szMap []*pb.MapData, xc
break break
} }
} }
return return
} }