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/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 (