充值后、N天没登录情况下抽卡概率调整

This commit is contained in:
meixiongfeng 2022-11-18 22:04:20 +08:00
parent 8b20ec9f53
commit 62d65257f1
2 changed files with 5 additions and 4 deletions

View File

@ -63,7 +63,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
pool = this.module.modelHero.CheckPool(drawCount, cfgDraw)
drawCount += 1
strPool = append(strPool, pool)
ret := this.module.CheckCondition(session.GetUserId(), req.DrawCount)
ret := this.module.CheckCondition(session.GetUserId())
if ret == true { // 命中插入5星英雄
szStar = append(szStar, 5)
continue

View File

@ -458,7 +458,7 @@ func (this *Hero) NoLoginDay(uid string, day int32) {
}
// 检查充值和未登录天数之内抽卡是否抽中
func (this *Hero) CheckCondition(uid string, drawCount int32) bool {
func (this *Hero) CheckCondition(uid string) bool {
var (
curCount int32
update map[string]interface{}
@ -472,16 +472,15 @@ func (this *Hero) CheckCondition(uid string, drawCount int32) bool {
curCount = conf.DrawCardRechargeReward[1]
}
if v >= curCount { // 触发保底 直接给5星
delete(record.Condition, "recharge")
update["condition"] = record.Condition
return true
} else { // 1/curCount概率
n, _ := rand.Int(rand.Reader, big.NewInt(int64(curCount)))
if n.Int64() < 1 {
delete(record.Condition, "recharge")
update["condition"] = record.Condition
return true
}
record.Condition["recharge"] += 1
@ -494,12 +493,14 @@ func (this *Hero) CheckCondition(uid string, drawCount int32) bool {
}
if v >= curCount { // 触发保底 直接给5星
delete(record.Condition, "login")
update["login"] = record.Condition
return true
} else { // 1/curCount概率
n, _ := rand.Int(rand.Reader, big.NewInt(int64(curCount)))
if n.Int64() < 1 {
delete(record.Condition, "login")
update["login"] = record.Condition
return true
}
record.Condition["login"] += 1