diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index d635d1a08..fa41ba563 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -71,6 +71,8 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq ret := this.module.CheckCondition(session.GetUserId()) if ret == true { // 命中插入5星英雄 szStar = append(szStar, 5) + heroRecord.Star5 = 0 // 重置保底 + star5Max++ // 记录当前 5星数量 continue } // 3,4,5 星权重 @@ -95,16 +97,34 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq 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 - 3 + starIndex = star heroRecord.Inevitable = heroRecord.Drawcount update["inevitable"] = heroRecord.Drawcount + szStar = append(szStar, star) + if star == 4 { + heroRecord.Star4 = 0 + star4Max++ + } else if star == 5 { + star5Max++ + heroRecord.Star5 = 0 + } + continue } } // 保底情况 if heroRecord.Drawcount == iEnd && heroRecord.Inevitable == 0 { - starIndex = star - 3 + starIndex = star heroRecord.Inevitable = heroRecord.Drawcount update["inevitable"] = heroRecord.Drawcount + szStar = append(szStar, star) + if star == 4 { + heroRecord.Star4 = 0 + star4Max++ + } else if star == 5 { + star5Max++ + heroRecord.Star5 = 0 + } + continue } } }