三消地图刷新技能规则调整 刷新生成的地图可消除

This commit is contained in:
meixiongfeng 2024-02-05 17:25:16 +08:00
parent 081e8af050
commit f75160a571
2 changed files with 36 additions and 7 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) {