修复当出现相同关卡id时记录会混乱的bug

This commit is contained in:
luying
2020-10-30 15:00:12 +08:00
parent 222b9c6e12
commit 858b79339c

View File

@@ -234,7 +234,14 @@ export async function refreshEvent(num: number, roleId: string, roleName: string
let curPoint = new Array<number>();
for(let i = 0; i < num; i++) {
let {dic} = getRandomWithWeight(randomList);
console.log(JSON.stringify(dic))
// 临时处理不出现相同的关卡id
for(let x = 0; x < 1000; x++) {
let hasEvent = event.find(cur => {
return cur.type == EVENT_TYPE.BATTLE && cur.battleId == dic.warId});
dic = getRandomWithWeight(randomList).dic;
if(!hasEvent) break;
}
// if(!dic) break;
let point = randomPosition(dic.movePointArray, prePoint, curPoint);
let eventCode = genCode(8);