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.

69 lines
2.0 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 PickWeaponUp() string {
if global.LastRareWeapon >= 9 {
global.LastRareWeapon -= 9
}
if global.LastEpicWeapon >= 80 {
global.LastEpicWeapon -= 80
}
//保底
if global.LastEpicWeapon == 79 {
//必出橙色
//fmt.Println("必出橙色-----------------------------------------------------------------------------------------------------------------------")
return RandomEpicWeapon()
}
if global.LastRareWeapon == 9 {
//必出紫色
//fmt.Println("必出紫色")
return RandomRareWeapon()
}
//单抽
//up5占5星出货75%
//up4占4星出货75%
//5星概率为0.7% 最多80次必出5星
//4星概率为6% 其中角色3% 武器3% 最多10次必出4星
//当起源到4星时 75%为up武器
//如果本次不是当期up 下一个一定是up
//https://www.bilibili.com/read/cv12616453
//模型五星综合概率为1.8779%期望53.250抽概率在第63抽开始上升保底位置实为第77抽而非公示的第80抽。
//作者:一棵平衡树 https://www.bilibili.com/read/cv12616453 出处bilibili
//模型四星综合概率为14.857%期望6.7309抽概率在第8抽开始上升保底位置实为第9抽而非公示的第10抽。
//作者:一棵平衡树 https://www.bilibili.com/read/cv12616453 出处bilibili
dice := rand.Intn(10000)
adjustRateWeapon := 69
if global.LastEpicWeapon > 61 {
adjustRateWeapon = 770 + 700*(global.LastEpicWeapon-61)
}
adjustRateRareWeapon := 300 + 300
if global.LastRareWeapon == 7 {
adjustRateRareWeapon += 6000
}
switch {
case dice <= adjustRateWeapon:
//epic
return RandomEpicWeapon()
case dice <= adjustRateWeapon+adjustRateRareWeapon:
//rare
return RandomRareWeapon()
default:
//常驻3星武器
return RandomCommonItemWeapon()
}
}
// 常驻3星武器 武器池
func RandomCommonItemWeapon() string {
global.LastEpicWeapon += 1
global.LastRareWeapon += 1
commonItem := global.CommonItem
return commonItem[rand.Intn(len(commonItem))]
}