diff --git a/bin/json/game_global.json b/bin/json/game_global.json index bced51e8d..cea3c3d07 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -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, diff --git a/modules/comp_configure.go b/modules/comp_configure.go index 03eff39b1..014617f50 100644 --- a/modules/comp_configure.go +++ b/modules/comp_configure.go @@ -363,7 +363,7 @@ func (this *MCompConfigure) GetAllItemConfigure() (item []*cfg.GameItemData) { return } -func (this *MCompConfigure) GetAllEquipmentConfigure(equipmentId string) (configure []*cfg.GameEquipData) { +func (this *MCompConfigure) GetAllEquipmentConfigure() (configure []*cfg.GameEquipData) { if v, err := this.GetConfigure(game_equip); err == nil { for _, v1 := range v.(*cfg.GameEquip).GetDataMap() { diff --git a/modules/gm/module.go b/modules/gm/module.go index 36aa43755..56c0bd1f8 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -112,13 +112,13 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC res []*cfg.Gameatn ) - equip := this.configure.GetAllItemConfigure() + equip := this.configure.GetAllEquipmentConfigure() for _, v1 := range equip { res = append(res, &cfg.Gameatn{ A: "equi", T: v1.Id, - N: 1, + N: 5, }) } data := this.configure.GetHeroConfigData() diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 0e7d3c05d..5b210201d 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -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) } @@ -349,6 +333,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } } } + session.SendMsg(string(this.module.GetType()), DrawCard, rsp) // 任务统计 diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 454aacf1a..121630b76 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -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 } } } @@ -830,6 +830,12 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c if obj.HeroID == heroCfgId { hero = obj bFirst = false + atno = append(atno, &pb.UserAtno{ // 有英雄的时候 数量给0 + A: "hero", + T: hero.HeroID, + N: 0, + O: hero.Id, + }) break } } diff --git a/modules/hero/module.go b/modules/hero/module.go index a5143aa60..881b546cc 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -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 +}