🐞 fix(gvg): 守城顺序&投石车数据

This commit is contained in:
luying
2023-02-28 21:12:32 +08:00
parent 074615affd
commit 6afc62d052
5 changed files with 71 additions and 51 deletions

View File

@@ -312,20 +312,15 @@ export default class GVGTeam extends BaseModel {
}
// 投石车伤害
public static async attackByCatapult(teamCodes: string[], inc: number, rebirthAreaId: number) {
let teams: GVGTeamType[] = [];
for(let teamCode of teamCodes) {
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $inc: { durability: -inc } }, { new: true }).lean();
let originPointId = team.pointId;
if(team.durability <= 0) {
team = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { areaId: rebirthAreaId, pointId: 0, durability: team.maxDurability } }, { new: true }).lean();
team.originPointId = originPointId;
team.curTeamBreak = true;
}
teams.push(team);
public static async attackByCatapult(teamCode: string, inc: number, rebirthAreaId: number, reviveCd: number) {
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $inc: { durability: -inc } }, { new: true }).lean();
let originPointId = team.pointId;
if(team.durability <= 0) {
team = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { fromAreaId: team.areaId, areaId: rebirthAreaId, pointId: 0, durability: team.maxDurability, restartTime: nowSeconds() + reviveCd } }, { new: true }).lean();
team.originPointId = originPointId;
team.curTeamBreak = true;
}
return teams
return team;
}
// 加积分