This commit is contained in:
wh_zcy 2022-11-21 16:39:47 +08:00
commit 98d648e794
3 changed files with 61 additions and 2 deletions

View File

@ -10,8 +10,7 @@ import (
)
const (
game_gourmet = "game_gourmet.json"
game_gourmetskill = "game_gourmetskill.json"
game_gourmet = "game_gourmet.json"
)
///配置管理基础组件

View File

@ -108,6 +108,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
}
}
} else { // 所有阵营抽卡都走这里
drawCount += req.DrawCount
if req.DrawCount == 1 {
switch req.DrawType {
case 1:
@ -197,6 +198,12 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
if v, ok := _data[int32(star)]; ok {
if int32(len(v)) > randomIndex {
if star == 5 { // 抽出5星英雄后A次抽奖内不会再抽到5星英雄普通卡池+阵营卡池)
curDrawCount := drawCount - req.DrawCount
newID := this.module.ContinuousRestriction(session.GetUserId(), v[randomIndex].Id, curDrawCount+int32(index), strPool[index])
szCards = append(szCards, newID)
continue
}
szCards = append(szCards, v[randomIndex].Id)
}
}
@ -215,6 +222,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
return
}
for _, heroId := range szCards {
_mapAddHero[heroId]++
}
code = this.module.CreateRepeatHeros(session, _mapAddHero, true)

View File

@ -457,6 +457,58 @@ func (this *Hero) NoLoginDay(uid string, day int32) {
}
}
// 连续抽卡最多连续出A个相同阵营的英雄普通卡池
/*
heroCid 抽到的5星英雄ID
drawCount 当前抽卡次数
poll 当前卡池
返回值 newCid不满足抽卡要求替换其他5星英雄
*/
func (this *Hero) ContinuousRestriction(uid string, heroCid string, drawCount int32, pool string) (newCid string) {
var (
update map[string]interface{}
)
record, err := this.modelRecord.GetHeroRecord(uid)
if err != nil {
return heroCid
}
for heroid, index := range record.Star5Hero {
if heroid == heroCid {
conf := this.configure.GetGlobalConf() //.
iMaxCOunt := conf.DrawCardContinuousRestrictionStar5
if drawCount-index <= iMaxCOunt { // 连续n次还获得该英雄 直接替换其他英雄
_data := this.configure.GetPollByType(pool)
if _data == nil {
return heroCid
}
sz := make([]int32, 0)
for _, v := range _data[5] {
sz = append(sz, v.Weight)
}
//randomIndex := this.modelHero.GetRandW(sz)
for i := 0; i < len(_data[5]); i++ {
if v, ok := _data[5]; ok {
if int32(len(v)) > int32(i) {
newCid = v[i].Id
if newCid == heroid {
continue
}
record.Star5Hero[heroid] = drawCount
update["star5Hero"] = record.Star5Hero
this.modelRecord.ChangeHeroRecord(uid, update) // 更新信息
return
}
}
}
}
}
}
return heroCid
}
// 检查充值和未登录天数之内抽卡是否抽中
func (this *Hero) CheckCondition(uid string) bool {
var (