修改转盘奖励

This commit is contained in:
hahwu 2025-07-22 15:40:29 +08:00
parent 489a1ed7bc
commit 04a9ca69c9
2 changed files with 16 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package GoUtil
import ( import (
"fmt" "fmt"
"server/game/mod/item"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -52,6 +53,15 @@ func RandSlice(slice []int) int {
return slice[Id] return slice[Id]
} }
func RandItem(slice []*item.Item) *item.Item {
slen := len(slice)
if slen == 0 {
return nil
}
Id := GetRand().Intn(slen)
return slice[Id]
}
func RandSliceNum(s []int, num int) []int { func RandSliceNum(s []int, num int) []int {
slice := make([]int, len(s)) slice := make([]int, len(s))
copy(slice, s) copy(slice, s)

View File

@ -295,7 +295,12 @@ func (l *LimitedTimeEventMod) GetChestReward(MergeList []int) []*item.Item {
func (l *LimitedTimeEventMod) GetSceneDashReward() (int, []*item.Item) { func (l *LimitedTimeEventMod) GetSceneDashReward() (int, []*item.Item) {
ProbList := limitedTimeEventCfg.GetSenceJackpotProb() ProbList := limitedTimeEventCfg.GetSenceJackpotProb()
Id := GoUtil.RandMap(ProbList) Id := GoUtil.RandMap(ProbList)
return Id, limitedTimeEventCfg.GetSenceJackpotReward(Id) Items := limitedTimeEventCfg.GetSenceJackpotReward(Id)
if len(Items) > 1 {
// 多个奖励时,随机选择一个
Items = []*item.Item{GoUtil.RandItem(Items)}
}
return Id, Items
} }
// 获取连击快手奖励 // 获取连击快手奖励