抽卡规则优化+ 获得英雄转碎片不广播+概率调整

This commit is contained in:
meixiongfeng 2023-02-08 18:22:11 +08:00
parent a9743c6169
commit 68cbc5c5e3
4 changed files with 72 additions and 40 deletions

View File

@ -138,9 +138,9 @@
"e": 999999999,
"p": "base_pool7"
},
"base_pool_star3": 970,
"base_pool_star4": 27,
"base_pool_star5": 3,
"base_pool_star3": 100,
"base_pool_star4": 700,
"base_pool_star5": 200,
"camp_pool_star3": 9500,
"camp_pool_star4": 900,
"camp_pool_star5": 100,

View File

@ -76,17 +76,10 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
continue
}
// 3,4,5 星权重
starWeight := make([]int32, 0)
if cfgDraw.BasePoolStar3 != 0 {
starWeight = append(starWeight, cfgDraw.BasePoolStar3)
}
if cfgDraw.BasePoolStar4 != 0 {
starWeight = append(starWeight, cfgDraw.BasePoolStar4)
}
if cfgDraw.BasePoolStar5 != 0 {
starWeight = append(starWeight, cfgDraw.BasePoolStar5)
}
starWeight := []int32{cfgDraw.BasePoolStar3, cfgDraw.BasePoolStar4, cfgDraw.BasePoolStar5}
starIndex := this.module.modelHero.GetRandW(starWeight) // 3 4 5 星索引
// 特殊规则 DrawCard_5StarsInRange 第2-30次抽奖必出一个5星英雄普通卡池
inRangeConf := this.module.configure.GetGlobalConf().DrawCard5StarsInRange
if len(inRangeConf) == 3 {
@ -180,28 +173,28 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
}
heroRecord.Star4++ // 4星保底数量+1
heroRecord.Star5++ // 5星保底数量+1
if starIndex == 1 {
if starIndex == 4 {
heroRecord.Star4 = 0
star4Max++
} else if starIndex == 2 {
} else if starIndex == 5 {
star5Max++
heroRecord.Star5 = 0
}
if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max { // 达到10连抽最大(4,5星)数量 直接给三星
starIndex = 0
starIndex = 3
} else {
// 普通卡池保底
if cfgDraw.DrawFloorStar4 <= heroRecord.Star4 {
heroRecord.Star4 = 0
starIndex = 1
starIndex = 4
}
if cfgDraw.DrawFloorStar5 <= heroRecord.Star5 {
heroRecord.Star5 = 0
starIndex = 2
starIndex = 5
}
}
szStar = append(szStar, starIndex+3)
szStar = append(szStar, starIndex)
if len(szStar) >= int(req.DrawCount) {
break
}
@ -256,27 +249,18 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
return
}
for {
sz := make([]int32, 0)
if cfgDraw.CampPoolStar3 != 0 {
sz = append(sz, cfgDraw.CampPoolStar3) // 3 4 5 星权重
}
if cfgDraw.CampPoolStar4 != 0 {
sz = append(sz, cfgDraw.CampPoolStar4)
}
if cfgDraw.CampPoolStar5 != 0 {
sz = append(sz, cfgDraw.CampPoolStar5)
starWeight := []int32{cfgDraw.CampPoolStar3, cfgDraw.CampPoolStar4, cfgDraw.CampPoolStar5}
}
starIndex := this.module.modelHero.GetRandW(sz)
if starIndex == 1 {
starIndex := this.module.modelHero.GetRandW(starWeight)
if starIndex == 4 {
star4Max++
} else if starIndex == 2 {
} else if starIndex == 5 {
star5Max++
}
if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max {
starIndex = 0
starIndex = 3
}
szStar = append(szStar, starIndex+3)
szStar = append(szStar, starIndex)
if len(szStar) >= int(req.DrawCount) {
break
}
@ -337,11 +321,11 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
}
if code, atno := this.module.DispenseAtno(session, []*cfg.Gameatn{res}, true); code == pb.ErrorCode_Success {
list := &pb.AtnoData{}
list.Atno = append(list.Atno, atno...)
rsp.Data = append(rsp.Data, list)
rsp.Data = append(rsp.Data, &pb.AtnoData{
Atno: atno,
})
for _, v := range atno {
if v.A == "hero" {
if v.A == "hero" && v.N == 1 {
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
}

View File

@ -624,7 +624,7 @@ func (this *ModelHero) GetRandW(sz []int32) int32 {
for i, v := range sz {
_tmpW += int64(v)
if n.Int64() < _tmpW {
return int32(i)
return int32(i) + 3
}
}
}

View File

@ -721,7 +721,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
this.ModuleRtask.SendToRtask(session, comm.Rtype89, drawCount)
}
func (this Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
inRangeConf := this.configure.GetGlobalConf().DrawCard5StarsInRange
if len(inRangeConf) == 3 {
iStart := inRangeConf[0] // 抽卡开始
@ -751,3 +751,51 @@ func (this Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex
get = false
return
}
func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update map[string]interface{}) (starIndex int32, pool string) {
starIndex = 3 // 默认3星
inRangeConf1 := this.configure.GetGlobalConf().DrawCard5StarsInRange1
pool = this.configure.GetGlobalConf().DrawCard5StarsInRange1Pool
if len(inRangeConf1) == 3 {
iStart := inRangeConf1[0] // 抽卡开始
iEnd := inRangeConf1[1] // 抽卡结束
star := inRangeConf1[2]
if star >= 3 { // 保底必须三星+
if heroRecord.Inevitable == 0 && heroRecord.Drawcount > iStart && heroRecord.Drawcount < iEnd && iEnd >= iStart {
n, _ := rand.Int(rand.Reader, big.NewInt(int64(iEnd-iStart)))
if n.Int64() < 1 { // 抽中
starIndex = star
heroRecord.Inevitable = heroRecord.Drawcount
update["inevitable1"] = heroRecord.Drawcount
if star == 4 {
heroRecord.Star4 = 0
} else if star == 5 {
heroRecord.Star5 = 0
}
// 修改卡池
// if newPoll != "" {
// strPool[len(strPool)-1] = newPoll
// }
return
}
}
// 保底情况
if heroRecord.Drawcount == iEnd && heroRecord.Inevitable == 0 {
starIndex = star
heroRecord.Inevitable1 = heroRecord.Drawcount
update["inevitable1"] = heroRecord.Drawcount
if star == 4 {
heroRecord.Star4 = 0
} else if star == 5 {
heroRecord.Star5 = 0
}
return
}
}
}
return
}