You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package lottery
import (
"GenshinImpact/global"
"math/rand"
)
// 角色up池
func PickCharUp() string {
if global.LastRare >= 10 {
global.LastRare -= 10
}
if global.LastEpic >= 90 {
global.LastEpic -= 90
}
if global.LastEpic == 89 {
//必出橙色
//fmt.Println("必出橙色-----------------------------------------------------------------------------------------------------------------------")
return RandomEpic()
}
if global.LastRare == 9 {
//必出紫色
//fmt.Println("必出紫色")
return RandomRare()
}
//单抽
//5星概率为0.6% 最多90次必出5星 0-59
//4星概率为5.1% 其中角色2.55% 武器2.55% 最多10次必出4星 255 255
//https://www.bilibili.com/read/cv12616453
//原神抽卡概率工具表 超过73抽后概率增加
//模型五星综合概率为1.6052%期望62.297抽概率在第74抽开始上升。
//作者:一棵平衡树 https://www.bilibili.com/read/cv12616453 出处bilibili
dice := rand.Intn(10000)
adjustRate := 59
if global.LastEpic > 72 {
adjustRate = 660 + 600*(global.LastEpic-72)
}
adjustRateRare := 255 + 255
if global.LastRare == 8 {
//模型四星综合概率为13.057%期望7.6589抽概率在第9抽开始上升。
//作者:一棵平衡树 https://www.bilibili.com/read/cv12616453 出处bilibili
adjustRateRare += 5000
}
switch {
case dice <= adjustRate:
//epic
return RandomEpic()
case dice <= adjustRate+adjustRateRare:
//rare
return RandomRare()
default:
//common item
return RandomCommonItem()
}
}
// 随机取字符串
func RandomStr(sls []string) string {
return sls[rand.Intn(len(sls))]
}
// 常驻3星武器 角色池
func RandomCommonItem() string {
global.LastEpic += 1
global.LastRare += 1
commonItem := global.CommonItem
return commonItem[rand.Intn(len(commonItem))]
}