This commit is contained in:
liwei1dao 2024-02-05 18:18:06 +08:00
commit f569f249dc
3 changed files with 38 additions and 9 deletions

View File

@ -1002,6 +1002,7 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid s
conf *cfg.GamePlayerSkillData
err error
szMap []*pb.MapData
bAddps bool
)
if curid >= int32(len(this.chessboard.Plat)) {
return
@ -1018,10 +1019,7 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid s
if conf.Skilltouch == 101 { // 技能类型为1
szMap = this.chessboard.HitElem(color, curid)
} else if conf.Skilltouch == 102 {
this.chessboard.ShuffleElem()
szMap = append(szMap, &pb.MapData{
Data: this.chessboard.Plat,
})
szMap, bAddps = this.chessboard.ShuffleElem()
} else if conf.Skilltouch == 103 {
this.chessboard.HitCrossElem(color, curid) // 消除十字
szMap = append(szMap, &pb.MapData{
@ -1035,11 +1033,23 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid s
v.CurSocre = this.player1.Score
this.player1.Energy += v.CurEnergy
v.CurEnergy = this.player1.Energy
if bAddps {
this.player1.Ps++
if this.player1.Ps > 2 {
this.player1.Ps = 2
}
}
} else {
this.player2.Score += v.CurSocre
v.CurSocre = this.player2.Score
this.player2.Energy += v.CurEnergy
v.CurEnergy = this.player2.Energy
if bAddps {
this.player2.Ps++
if this.player2.Ps > 2 {
this.player2.Ps = 2
}
}
}
v.ChangeType = 1
}

View File

@ -1143,8 +1143,9 @@ func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
return
}
func (this *MapData) ShuffleElem() {
// 刷新
func (this *MapData) ShuffleElem() (szMap []*pb.MapData, bAddPs bool) {
var ()
for i := 0; i < Total; i++ {
n1, _ := rand.Int(rand.Reader, big.NewInt(Total))
newId := n1.Int64()
@ -1155,7 +1156,25 @@ func (this *MapData) ShuffleElem() {
this.Plat[i] = tmp
}
}
this.SetIndelibilityPlat()
szMap = append(szMap, &pb.MapData{
Data: this.GetPalatData(),
})
for {
if b := this.Check3X(); b {
if sz, b := this.CheckMap(0, false); len(sz) == 0 {
break
} else {
if b {
bAddPs = true
}
szMap = append(szMap, sz...)
}
} else {
break
}
}
return
//this.SetIndelibilityPlat()
}
func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData) {

View File

@ -6,7 +6,7 @@ import (
)
// 参数校验
func (this *apiComp) CheckSetPolts(session comm.IUserSession, req *pb.MainlineSetPoltsReq) (errdata *pb.ErrorData) {
func (this *apiComp) SetPoltsCheck(session comm.IUserSession, req *pb.MainlineSetPoltsReq) (errdata *pb.ErrorData) {
return
}
@ -16,7 +16,7 @@ func (this *apiComp) SetPolts(session comm.IUserSession, req *pb.MainlineSetPolt
info *pb.DBMainline
err error
)
if errdata = this.CheckSetPolts(session, req); errdata != nil {
if errdata = this.SetPoltsCheck(session, req); errdata != nil {
return // 参数校验失败直接返回
}