🐞 fix(gvg): 激战期,占领城池逻辑
This commit is contained in:
@@ -590,7 +590,6 @@ export async function calCityGuard(configId: number, canSendReward: boolean) {
|
||||
let sortCities = new Map<string, SortCities[]>(); // groupKey => cities
|
||||
let rankByCity = new Map<string, Map<number, RankAndLastLeague>>(); // groupKey => city => {ranks, lastLeague}
|
||||
await generateData(configId, sortCities, rankByCity);
|
||||
|
||||
for(let [groupKey, cities] of sortCities) {
|
||||
let cityResult: number[] = [];
|
||||
let index = 0; // 防死循环,万一出什么事cityResult.length一直不等于cities.length
|
||||
@@ -611,11 +610,10 @@ export async function calCityGuard(configId: number, canSendReward: boolean) {
|
||||
await addGuardCity(configId, groupKey, cityId, leagueCode, canSendReward);
|
||||
guardLeagueCnt.set(leagueCode, cnt + 1);
|
||||
cityResult.push(cityId);
|
||||
}
|
||||
}
|
||||
|
||||
for(let city of cities) { // 没有成功防守到联军的城池,进行下一轮处理
|
||||
if(cityResult.indexOf(city.cityId) != -1) continue;
|
||||
break;
|
||||
} else {
|
||||
let city = cities.find(cur => cur.cityId == cityId);
|
||||
if(!city) continue;
|
||||
if(city.index == -1) {
|
||||
cityResult.push(city.cityId); continue;
|
||||
}
|
||||
@@ -636,6 +634,7 @@ export async function calCityGuard(configId: number, canSendReward: boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user