【娃娃机抓取概率公式】

https://www.tapd.cn/31044302/prong/stories/view/1131044302001001287
This commit is contained in:
DESKTOP-45ANQ2C\unis 2024-10-21 13:54:36 +08:00
parent 69caf19491
commit 147f956857
1 changed files with 15 additions and 7 deletions

View File

@ -150,10 +150,12 @@ func (this *SceneEx) OnPlayerLeave(p *base.Player, reason int) {
return
}
if len(this.players) <= 0 {
logger.Logger.Trace("Clawdoll (*SceneEx) OnPlayerLeave, cur player num = ", len(this.players))
// 发送http Get请求 关闭直播间流
operateTask(this, 2, rule.Zego_ForbidRTCStream, p.Platform)
if !rule.DebugSwitch {
if len(this.players) <= 0 {
logger.Logger.Trace("Clawdoll (*SceneEx) OnPlayerLeave, cur player num = ", len(this.players))
// 发送http Get请求 关闭直播间流
operateTask(this, 2, rule.Zego_ForbidRTCStream, p.Platform)
}
}
}
@ -349,18 +351,24 @@ func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 {
machineId := this.GetDBGameFree().GetId() % 6080000
machineInfo := this.GetMachineServerInfo(machineId, player.Platform)
if machineInfo == nil {
logger.Logger.Errorf("GetPlayGrabType machineId: %v, platform: %v", machineId, player.Platform)
logger.Logger.Errorf("Clawdoll GetPlayGrabType machineId: %v, platform: %v", machineId, player.Platform)
return rule.ClawWeak
}
ProfitRate := common.RandFloat(machineInfo.ProfitMin, machineInfo.ProfitMax)
strongRate := machineInfo.CatchPrice/machineInfo.BuyPrice*ProfitRate*float64(this.PayCoinCount) - 1
strongRate := (machineInfo.CatchPrice/(machineInfo.BuyPrice*ProfitRate))*float64(this.PayCoinCount) - 1
logger.Logger.Tracef("Clawdoll GetPlayGrabType: SnId: %v, PayCoinCount:%v, ProfitRate:%v, strongRate:%v", player.SnId, this.PayCoinCount, ProfitRate, strongRate)
if strongRate <= 0.00000 {
return rule.ClawWeak
} else if strongRate > 0.00000 && strongRate <= 0.99999 {
// 再次随机
newRate := common.RandFromRangeInt64(0, 100)
if int64(strongRate*100) > newRate {
logger.Logger.Tracef("Clawdoll GetPlayGrabType: newRate:%v, SnId: %v, PayCoinCount:%v, ProfitRate:%v, strongRate:%v ", newRate, player.SnId, this.PayCoinCount, ProfitRate, strongRate)
if int64(strongRate*100) >= newRate {
logger.Logger.Tracef("Clawdoll GetPlayGrabType: SnId: %v gain ClawStrong, PayCoinCount:%v", player.SnId, this.PayCoinCount)
return rule.ClawStrong
} else {
return rule.ClawWeak