diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index 2d4938012..fb10b9df4 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -190,7 +190,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr } if this.player1.Energy >= conf.Skillload { this.player1.Energy = conf.Skillload // 清零 - this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue) + curScore, szMap = this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue) } } if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go index a3aaa51e0..f265e6dd2 100644 --- a/modules/entertainment/xxlPlat.go +++ b/modules/entertainment/xxlPlat.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "fmt" "go_dreamfactory/pb" + "go_dreamfactory/utils" "math/big" ) @@ -463,7 +464,7 @@ func (this *MapData) CheckMap(color int32) (score int32, szMap []*pb.MapData) { score += curScore // 总分 if this.DropGirde() { szMap = append(szMap, &pb.MapData{ - Data: this.GetPalat(), + Data: this.GetPalatData(), CurSocre: curScore, Xgrid: count, }) @@ -507,7 +508,7 @@ func (this *MapData) DropGirde() bool { return bDrop } -func (this *MapData) GetPalat() (data []*pb.GirdeData) { +func (this *MapData) GetPalatData() (data []*pb.GirdeData) { for _, v := range this.Plat { data = append(data, &pb.GirdeData{ Oid: v.Oid, @@ -563,11 +564,16 @@ func (this *MapData) AiSwapGirde() (score int32, szMap []*pb.MapData, oid1 int32 } // 释放技能 技能id 和参数 -func (this *MapData) SkillUp(skillid int32, value int32) (plat *pb.MapData) { +func (this *MapData) SkillUp(skillid int32, value int32) (score int32, szMap []*pb.MapData) { if skillid == 1 { // 随机消除盘面上X个方块 + ids := utils.RandomNumbers(0, Total-1, int(value)) + for _, id := range ids { + this.Plat[id] = &pb.GirdeData{} + } + if this.DropGirde() { + score, szMap = this.CheckMap(1) + } } - return &pb.MapData{ - Data: this.Plat, - } + return } diff --git a/modules/entertainment/xxl_test.go b/modules/entertainment/xxl_test.go index d53cbb2c5..ae1fa316f 100644 --- a/modules/entertainment/xxl_test.go +++ b/modules/entertainment/xxl_test.go @@ -90,6 +90,7 @@ func Test_Main(t *testing.T) { // if bSwap, m := m.AiSwapGirde(); bSwap { // szMap = append(szMap, m...) // } + m.SkillUp(1, 7) m.SwapGirde(1, 8) m.CheckMap(1)