From 7822cff7ee8df1487c99190b2e86d292f3fac719 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 24 Oct 2023 20:10:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=87=8A=E6=94=BE=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=BF=9E=E6=B6=88=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/entertainment/configure.go | 17 +++++++++++++++++ modules/entertainment/room.go | 16 +++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/modules/entertainment/configure.go b/modules/entertainment/configure.go index a4deed611..2a3dcdaf9 100644 --- a/modules/entertainment/configure.go +++ b/modules/entertainment/configure.go @@ -14,6 +14,7 @@ import ( const ( game_block = "game_block.json" game_consumehero = "game_consumehero.json" + game_integral = "game_integral.json" ) // /配置管理组件 @@ -31,6 +32,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this.module = module.(*Entertainment) err = this.LoadMultiConfigure(map[string]interface{}{ game_consumehero: cfg.NewGameConsumeHero, + // game_integral: cfg.NewGameInitial, }) configure.RegisterConfigure(game_block, cfg.NewGameBlock, this.LoadGameBlock) @@ -90,3 +92,18 @@ func (this *configureComp) GetGameConsumeHero(heroid string) (conf *cfg.GameCons err = comm.NewNotFoundConfErr(moduleName, game_consumehero, heroid) return } + +func (this *configureComp) GetGameConsumeintegral(key int32) (conf *cfg.GameIntegralData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_integral); err == nil { + if configure, ok := v.(*cfg.GameIntegral); ok { + if conf = configure.Get(key); conf != nil { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_consumehero, key) + return +} diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index 77f963b31..c10050b36 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -192,8 +192,18 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr return } if this.player1.Energy >= conf.Skillload { - this.player1.Energy = conf.Skillload // 清零 - curScore, szMap = this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue) + this.player1.Energy = 0 // 清零 + + if score, m := this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue); score > 0 { + curScore += score + szMap = append(szMap, m...) + } else { + szMap = append(szMap, &pb.MapData{ + Data: this.chessboard.GetPalatData(), + }) + } + this.player1.Score += curScore + } else { errdata = &pb.ErrorData{ Code: pb.ErrorCode_EntertainNoEnergy, @@ -264,7 +274,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr this.player1.Ps = MaxPs } for _, v := range szMap { // - if v.Xgrid >= 4 { + if v.Xgrid > 0 { if color == 1 { this.player1.Energy += v.Xgrid } else { From ad64ecc289acdde58169b32573ceb4d6bb8a7d2c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 25 Oct 2023 09:53:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ai=20=E8=83=BD=E9=87=8F=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/entertainment/room.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index c10050b36..dc665fe1f 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -128,6 +128,11 @@ func (this *Room) AiOperator() { if this.NexPower != this.curPower { this.round++ } + for _, v := range szMap { // + if v.Xgrid > 0 { + this.player2.Energy += v.Xgrid + } + } this.player2.Score += curScore // 广播消息