Skip to content

Commit

Permalink
fix(headhunt): fix golan grammar error
Browse files Browse the repository at this point in the history
  • Loading branch information
cworld1 committed Apr 1, 2024
1 parent 8a19ebb commit f67c2d1
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions src/core/web/headhunt.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Headhunt(r *gin.Engine) {
var operator utils.Operator
name := ""
autoProb(&r6prob, &r5prob, &r4prob, &r3prob, &times)
name = genOpeName(r6prob, r5prob, r4prob, r3prob)
name = genOpeName(&r6prob, &r5prob, &r4prob, &r3prob)

char := utils.GetOperatorByName(name)
operator.Profession = char.Profession
Expand All @@ -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, &times)
} 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星概率
Expand Down

0 comments on commit f67c2d1

Please sign in to comment.