🐞 fix(gvg): 添加投石车

This commit is contained in:
luying
2023-02-27 21:54:32 +08:00
parent 82c4149063
commit 78777a1437
4 changed files with 378 additions and 22 deletions

View File

@@ -116,6 +116,7 @@ export async function initRobots(configId: number, groupKey: string, city: GVGCi
let updateDicPoints: DicGVGAreaPoint[] = [];
let { areaIds = []} = gameData.gvgCity.get(cityId);
for(let [_, point] of gameData.gvgAreaPoint) {
if(point.type != 1) continue;
if(areaIds.indexOf(point.areaId) == -1) continue;
let robotTeam = robotTeams.find(team => team.pointId == point.pointId);
if(!robotTeam || (!robotTeam.isBroken && robotTeam.configId != configId) ) {
@@ -296,14 +297,17 @@ export async function initCatapult(cityId: number, groupKey: string, leagueCode:
}
}
if(hasCatapult) {
let dicCity = gameData.gvgCity.get(cityId);
let areaIds = (dicCity?.areaIds||[]).filter(areaId => {
let dicArea = gameData.gvgArea.get(areaId);
return dicArea && dicArea.areaType == GVG_AREA_TYPE.CATAPULT;
});
let updateDicPoints: DicGVGAreaPoint[] = [];
let { areaIds = []} = gameData.gvgCity.get(cityId);
for(let [_, point] of gameData.gvgAreaPoint) {
if(point.type != 2) continue;
if(areaIds.indexOf(point.areaId) == -1) continue;
updateDicPoints.push(point);
}
let lv = gameData.war.get(GVG.GVG_CATAPULT_WARJSON)?.level||50;
let teams = await GVGTeamModel.initCatapult(configId, groupKey, cityId, leagueCode, leagueName, areaIds, atk, durability, lv);
let teams = await GVGTeamModel.initCatapult(configId, groupKey, cityId, updateDicPoints, leagueCode, leagueName, atk, durability, lv);
// 处理内存
let teamObj = getGVGBattleData(groupKey);
teamObj.enterCity(...teams);