🐞 fix(gvg): 添加投石车
This commit is contained in:
@@ -116,6 +116,7 @@ export async function initRobots(configId: number, groupKey: string, city: GVGCi
|
|||||||
let updateDicPoints: DicGVGAreaPoint[] = [];
|
let updateDicPoints: DicGVGAreaPoint[] = [];
|
||||||
let { areaIds = []} = gameData.gvgCity.get(cityId);
|
let { areaIds = []} = gameData.gvgCity.get(cityId);
|
||||||
for(let [_, point] of gameData.gvgAreaPoint) {
|
for(let [_, point] of gameData.gvgAreaPoint) {
|
||||||
|
if(point.type != 1) continue;
|
||||||
if(areaIds.indexOf(point.areaId) == -1) continue;
|
if(areaIds.indexOf(point.areaId) == -1) continue;
|
||||||
let robotTeam = robotTeams.find(team => team.pointId == point.pointId);
|
let robotTeam = robotTeams.find(team => team.pointId == point.pointId);
|
||||||
if(!robotTeam || (!robotTeam.isBroken && robotTeam.configId != configId) ) {
|
if(!robotTeam || (!robotTeam.isBroken && robotTeam.configId != configId) ) {
|
||||||
@@ -296,14 +297,17 @@ export async function initCatapult(cityId: number, groupKey: string, leagueCode:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(hasCatapult) {
|
if(hasCatapult) {
|
||||||
let dicCity = gameData.gvgCity.get(cityId);
|
let updateDicPoints: DicGVGAreaPoint[] = [];
|
||||||
let areaIds = (dicCity?.areaIds||[]).filter(areaId => {
|
let { areaIds = []} = gameData.gvgCity.get(cityId);
|
||||||
let dicArea = gameData.gvgArea.get(areaId);
|
for(let [_, point] of gameData.gvgAreaPoint) {
|
||||||
return dicArea && dicArea.areaType == GVG_AREA_TYPE.CATAPULT;
|
|
||||||
});
|
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 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);
|
let teamObj = getGVGBattleData(groupKey);
|
||||||
teamObj.enterCity(...teams);
|
teamObj.enterCity(...teams);
|
||||||
|
|||||||
@@ -229,22 +229,18 @@ export default class GVGTeam extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 生成投石车
|
// 生成投石车
|
||||||
public static async initCatapult(configId: number, groupKey: string, cityId: number, leagueCode: string, leagueName: string, areaIds: number[], atk: number, durability: number, lv: number) {
|
public static async initCatapult(configId: number, groupKey: string, cityId: number, dicPoints: DicGVGAreaPoint[], leagueCode: string, leagueName: string, atk: number, durability: number, lv: number) {
|
||||||
await GVGTeamModel.bulkWrite(areaIds.map(areaId => {
|
const teams: GVGTeamType[] = [];
|
||||||
return {
|
for(let { pointId, areaId, name, head, spine, ce } of dicPoints) {
|
||||||
updateOne: {
|
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ groupKey, cityId, areaId, pointId }, {
|
||||||
filter: { groupKey, cityId, areaId },
|
$setOnInsert: {
|
||||||
update: { $setOnInsert: {
|
teamCode: genCode(8), maxDurability: durability, roleName: name, head, spine, frame: EXTERIOR.EXTERIOR_FACECASE, lineupCe: ce, lv, leagueCode, leagueName, captapultAtk: atk,
|
||||||
teamCode: genCode(8), maxDurability: durability, captapultAtk: atk, leagueCode, leagueName,
|
isRobot: true, isCatapult: true, isBroken: false, startMoveTime: 0, stopMoveTime: 0, guildCode: '', fromAreaId: areaId,
|
||||||
roleName: GVG.GVG_CATAPULT_NAME, head: GVG.GVG_CATAPULT_HEAD, spine: GVG.GVG_CATAPULT_SPINE, frame: EXTERIOR.EXTERIOR_FACECASE, lineupCe: GVG.GVG_CATAPULT_CE, lv,
|
}, $set: { configId, durability }
|
||||||
isRobot: true, isCatapult: true, fromAreaId: areaId,
|
}, { new: true, upsert: true }).lean();
|
||||||
isBroken: false, startMoveTime: 0, stopMoveTime: 0, guildCode: '', pointId: 0, roleId: GVG_CATAPULT
|
teams.push(team);
|
||||||
}, $set: { configId, durability } },
|
}
|
||||||
upsert: true
|
return teams
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
return await this.findCatapultTeams(groupKey, cityId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 攻击方攻击cd
|
// 攻击方攻击cd
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export interface DicGVGAreaPoint {
|
|||||||
readonly pointId: number;
|
readonly pointId: number;
|
||||||
// 区域id
|
// 区域id
|
||||||
readonly areaId: number;
|
readonly areaId: number;
|
||||||
|
// 类型 1-守卫者 2-投石车
|
||||||
|
readonly type: number;
|
||||||
// 积分
|
// 积分
|
||||||
readonly score: number;
|
readonly score: number;
|
||||||
// 位置
|
// 位置
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user