diff --git a/modules/gourmet/comp_configure.go b/modules/gourmet/comp_configure.go index a7b965fe8..56a4fd781 100644 --- a/modules/gourmet/comp_configure.go +++ b/modules/gourmet/comp_configure.go @@ -10,8 +10,7 @@ import ( ) const ( - game_gourmet = "game_gourmet.json" - game_gourmetskill = "game_gourmetskill.json" + game_gourmet = "game_gourmet.json" ) ///配置管理基础组件 diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index d91f3cca6..eed2c9110 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -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) diff --git a/modules/hero/module.go b/modules/hero/module.go index 28dbd336e..b11a28491 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -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 (