玩法临时修改 等最终配置
This commit is contained in:
parent
876a33e84b
commit
e3509b4023
@ -1,6 +1,7 @@
|
|||||||
package entertainment
|
package entertainment
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
@ -9,6 +10,7 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"math/big"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"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) {
|
func (this *Room) RandomPlayType() (itype int32) {
|
||||||
|
|
||||||
var weight []int32 // 权重
|
var weight []int32 // 权重
|
||||||
// 开始随机玩法
|
// 开始随机玩法
|
||||||
list := this.module.configure.GetGameConsumeIntegral()
|
list := this.module.configure.GetGameConsumeIntegral()
|
||||||
for _, v := range list {
|
for _, v := range list {
|
||||||
weight = append(weight, v.Weight)
|
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 {
|
func (this *Room) InitRoom(module *Entertainment, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room {
|
||||||
|
@ -143,6 +143,7 @@ func (this *MapData) InitMap(module *Entertainment, iType int32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.SetIndelibilityPlat()
|
this.SetIndelibilityPlat()
|
||||||
|
this.Plat = this.GetPalatData()
|
||||||
//this.SetMap() // 方便测试固定地图
|
//this.SetMap() // 方便测试固定地图
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user