From f67c2d1cf7d0a9a4484dfcb35fa413a5e93b69fd Mon Sep 17 00:00:00 2001 From: CWorld Date: Mon, 1 Apr 2024 10:27:36 +0800 Subject: [PATCH] fix(headhunt): fix golan grammar error --- src/core/web/headhunt.go | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/core/web/headhunt.go b/src/core/web/headhunt.go index ed0718c..f7f18af 100644 --- a/src/core/web/headhunt.go +++ b/src/core/web/headhunt.go @@ -32,7 +32,7 @@ func Headhunt(r *gin.Engine) { var operator utils.Operator name := "" autoProb(&r6prob, &r5prob, &r4prob, &r3prob, ×) - name = genOpeName(r6prob, r5prob, r4prob, r3prob) + name = genOpeName(&r6prob, &r5prob, &r4prob, &r3prob) char := utils.GetOperatorByName(name) operator.Profession = char.Profession @@ -48,27 +48,28 @@ func Headhunt(r *gin.Engine) { } // 生成干员 -func genOpeName(r6prob, r5prob, r4prob, r3prob *float64) string { - // 愚人节应设定为全3星 - now := time.Now() - year, month, day := now.Date() - if month == time.April && day == 1 { - name = randChar(3) - return name - } - allPro := r6prob + r5prob + r4prob + r3prob - rankRand := float64(getRandomInt(1, int64(allPro))) - if rankRand <= r6prob { - name = randChar(6) - reProb(&r6prob, &r5prob, &r4prob, &r3prob, ×) - } else if rankRand <= r6prob+r5prob { - name = randChar(5) - } else if rankRand <= r6prob+r5prob+r4prob { - name = randChar(4) - } else if rankRand <= r6prob+r5prob+r4prob+r3prob { - name = randChar(3) - } - return name +func genOpeName(r6prob *float64, r5prob *float64, r4prob *float64, r3prob *float64) string { + name := "" + // 愚人节应设定为全3星 + now := time.Now() + _, month, day := now.Date() + if month == time.April && day == 1 { + name = randChar(3) + return name + } + allPro := *r6prob + *r5prob + *r4prob + *r3prob + rankRand := float64(getRandomInt(1, int64(allPro))) + if rankRand <= *r6prob { + name = randChar(6) + reProb(r6prob, r5prob, r4prob, r3prob, times) + } else if rankRand <= *r6prob+*r5prob { + name = randChar(5) + } else if rankRand <= *r6prob+*r5prob+*r4prob { + name = randChar(4) + } else { + name = randChar(3) + } + return name } // 自动调整6星概率