From 68cbc5c5e3e850f5ff8c2c480b2c4a397e32e3b1 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 8 Feb 2023 18:22:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=8D=A1=E8=A7=84=E5=88=99=E4=BC=98?= =?UTF-8?q?=E5=8C=96+=20=E8=8E=B7=E5=BE=97=E8=8B=B1=E9=9B=84=E8=BD=AC?= =?UTF-8?q?=E7=A2=8E=E7=89=87=E4=B8=8D=E5=B9=BF=E6=92=AD+=E6=A6=82?= =?UTF-8?q?=E7=8E=87=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_global.json | 6 ++-- modules/hero/api_drawCard.go | 54 +++++++++++++----------------------- modules/hero/model_hero.go | 2 +- modules/hero/module.go | 50 ++++++++++++++++++++++++++++++++- 4 files changed, 72 insertions(+), 40 deletions(-) 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/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 08ce48eb0..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) } diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 4477ae434..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 } } } 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 +}