🐞 fix(gvg): 遗迹排名变化后刷新对手
This commit is contained in:
@@ -339,7 +339,7 @@ export class GVGProduceHandler {
|
||||
let historyRank = historyData?.rank||0;
|
||||
// 交换排名
|
||||
let { isChange, atkData, defData, endTime } = await GVGVestigeRankModel.changeRank(isSuccess, rec.vestigeId, rec.attackInfo, rec.defenseInfo);
|
||||
atkData = await updateMyVestigeRank(isChange, atkData, historyRank, rec);
|
||||
atkData = await updateMyVestigeRank(isChange, atkData, defData, historyRank, rec);
|
||||
// 更新vestigeRec
|
||||
rec = await GVGVestigeRecModel.battleEnd(battleCode, isSuccess, endTime, atkData?.rank, defData?.rank||rec.attackInfo.oldRank);
|
||||
// 更新锁
|
||||
|
||||
@@ -274,7 +274,7 @@ export function getVestigeRecStatus(rec: GVGVestigeRecType) {
|
||||
}
|
||||
|
||||
// 将开始战斗时候的阵容存到防守阵容
|
||||
export async function updateMyVestigeRank(isChange: boolean, atkData: GVGVestigeRankType, historyRank: number, rec: GVGVestigeRecType) {
|
||||
export async function updateMyVestigeRank(isChange: boolean, atkData: GVGVestigeRankType, defData: GVGVestigeRankType, historyRank: number, rec: GVGVestigeRecType) {
|
||||
let update: GVGVestigeRankUpdate = {}, needUpdate = false;
|
||||
if(isChange) {
|
||||
if(atkData && !atkData.hasDefense) { // 只有第一次挑战且自己没有主动保存过阵容的时候才会这么保存
|
||||
@@ -297,6 +297,10 @@ export async function updateMyVestigeRank(isChange: boolean, atkData: GVGVestige
|
||||
if(needUpdate) {
|
||||
atkData = await GVGVestigeRankModel.updateByRoleId(atkData.vestigeId, atkData.roleId, update);
|
||||
}
|
||||
if(isChange && defData) {
|
||||
let oppRanks = refreshVestigeOppRanks(defData.rank);
|
||||
defData = await GVGVestigeRankModel.updateByRoleId(defData.vestigeId, defData.roleId, { oppRanks });
|
||||
}
|
||||
return atkData
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user