feat(抽卡): 为了ur武将概率,修改抽卡卡池精度

This commit is contained in:
luying
2022-11-15 10:58:39 +08:00
parent 8ee829cd1d
commit d1d01cd79c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -206,7 +206,7 @@ export function getRandSingleIndex(len: number) {
*/
export function getRandEelmWithWeight<T extends { weight: number }>(randomList: T[]): { dic: T, index: number } {
let len = randomList.reduce((pre, cur) => {
return pre + cur.weight || 1;
return pre + (cur.weight||0);
}, 0);
let index = Math.floor(Math.random() * len);
let result = { dic: null, index: -1 };