From e3509b402327bbb1abaa14af4ac3adac020b7157 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 6 Nov 2023 15:33:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=A9=E6=B3=95=E4=B8=B4=E6=97=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=20=E7=AD=89=E6=9C=80=E7=BB=88=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/entertainment/room.go | 11 ++++++++++- modules/entertainment/xxlPlat.go | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index bc7e0d9ed..14ec67ee3 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -1,6 +1,7 @@ package entertainment import ( + "crypto/rand" "errors" "fmt" "go_dreamfactory/comm" @@ -9,6 +10,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + "math/big" "time" "go.mongodb.org/mongo-driver/bson/primitive" @@ -94,14 +96,21 @@ func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) { // 随机一个玩法 func (this *Room) RandomPlayType() (itype int32) { + var weight []int32 // 权重 // 开始随机玩法 list := this.module.configure.GetGameConsumeIntegral() for _, v := range list { weight = append(weight, v.Weight) } + itype = list[comm.GetRandW(weight)].Key - return list[comm.GetRandW(weight)].Key + // 临时修改 50% 概率1类型 + n, _ := rand.Int(rand.Reader, big.NewInt(2)) + if n.Int64() == 0 { + itype = 1 + } + return } func (this *Room) InitRoom(module *Entertainment, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room { diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go index 173be88b6..836958e20 100644 --- a/modules/entertainment/xxlPlat.go +++ b/modules/entertainment/xxlPlat.go @@ -143,6 +143,7 @@ func (this *MapData) InitMap(module *Entertainment, iType int32) { } } this.SetIndelibilityPlat() + this.Plat = this.GetPalatData() //this.SetMap() // 方便测试固定地图 }