更新json和部分dictionary定义
This commit is contained in:
@@ -6,6 +6,7 @@ import fs = require('fs');
|
||||
import path = require('path');
|
||||
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||
import { HERO_CE_RATIO, ABI_STAGE } from '../consts';
|
||||
import { PvpDefenseType } from '../db/PvpDefense';
|
||||
|
||||
const _ = require('underscore');
|
||||
|
||||
@@ -173,6 +174,10 @@ export function getRandomByLen(arr: Array<any>): any {
|
||||
return arr[Math.floor(Math.random() * len)]
|
||||
}
|
||||
|
||||
export function getRandomIndexByLen(len: number) {
|
||||
return Math.floor(Math.random() * len);
|
||||
}
|
||||
|
||||
export function getRandomWithWeight(randomList: any) {
|
||||
let len = randomList.reduce((pre, cur) => {
|
||||
return pre + cur.weight || 1;
|
||||
|
||||
Reference in New Issue
Block a user