✨ feat(gvg): 进驻积分点

This commit is contained in:
luying
2023-02-17 10:59:38 +08:00
parent 6815bf316a
commit 4359bfd9cc
10 changed files with 129 additions and 39 deletions
+19 -10
View File
@@ -75,6 +75,17 @@ class GVGBattleData {
}
}
private setRolePoints(roleId: string, fromPointId: number, pointId: number) {
if(fromPointId > 0 && pointId == 0) { // 被打得撤离积分点
if(this.rolePoints.has(roleId) && this.rolePoints.get(roleId).has(pointId)) {
this.rolePoints.get(roleId).delete(pointId);
}
} else if (fromPointId == 0 && pointId > 0) {
if(!this.rolePoints.has(roleId)) this.rolePoints.set(roleId, new Set());
this.rolePoints.get(roleId).add(pointId);
}
}
public move(teamCode: string, areaId: number, fromAreaId: number, startMoveTime: number, stopMoveTime: number) {
let team = this.teams.get(teamCode);
if(!team) return;
@@ -90,11 +101,13 @@ class GVGBattleData {
}
// 队伍入驻积分点
public teamSettle(teamCode: string, pointId: number) {
let team = this.teams.get(teamCode);
if(!team) return;
team.pointId = pointId;
}
public teamSettle(roleId: string, teamCode: string, pointId: number) {
let teamMem = this.teams.get(teamCode);
if(!teamMem) return;
let { pointId: fromPointId } = teamMem;
this.setRolePoints(roleId, fromPointId, pointId);
teamMem.pointId = pointId;
}
// 关卡结算
public battleEnd(teams: GVGTeamType[]) {
@@ -105,11 +118,7 @@ class GVGBattleData {
}
let { areaId: fromAreaId, pointId: fromPointId } = teamMem;
teamMem.battleEnd(team);
if(fromPointId > 0 && team.pointId == 0) { // 被打得撤离积分点
if(this.rolePoints.has(team.roleId) && this.rolePoints.get(team.roleId).has(team.pointId)) {
this.rolePoints.get(team.roleId).delete(team.pointId);
}
}
this.setRolePoints(team.roleId, fromPointId, team.pointId);
this.setAreaMap(team.teamCode, fromAreaId, team.areaId);
}
}