🐞 fix(巅峰演武): 修改等级计算、2倍碾压

This commit is contained in:
zhangxk
2023-10-13 17:03:06 +08:00
parent 73a44e9828
commit b82d525f7f
5 changed files with 38 additions and 20 deletions

View File

@@ -157,6 +157,11 @@ export default class PvpRecord extends BaseModel {
return result;
}
public static async updateByRec(battleCode: string, param: {roleId1: string, roleId2: string, warId: number, attackInfo: PvpRecordPlayerInfo, defenseInfo: PvpRecordPlayerInfo, createTime: number, timeout?: boolean }) {
const result = await PvpRecordModel.findOneAndUpdate({ battleCode }, param, { new: true, upsert: true }).lean();
return result;
}
public static async getRecByRoleId( roleId: string, limit = 15, lean = true) {
// await this.delPvpRecords();
let t = <number>getTimeFun().getBeforeDayWithHour(3);

View File

@@ -65,10 +65,14 @@ export class Defense {
@prop({ required: true, type: () => Combo, _id: false })
combo: Combo[]; // 防守阵容的等级
constructor(heroes: DefenseHero[], scores: number[], warId: number, buff: number, combo: Combo[]) {
constructor(heroes: DefenseHero[], scores: number[], warId: number, buff: number, combo: Combo[], heroScores:HeroScore[]) {
this.heroes = heroes;
this.score = scores.reduce((pre, cur) => pre + cur, 0);
let {pLv, score} = getPlvAndScore(scores);
let newScores: number[] = [];
for(let {score} of heroScores){
newScores.push(score);
}
let {pLv, score} = getPlvAndScore(newScores);
this.pLv = pLv,
this.score = score;
this.warId = warId;
@@ -96,10 +100,14 @@ export class Attack {
@prop({ required: true })
pLv: number; // 防守阵容的等级
constructor(heroes: AttackHero[], scores: number[]) {
constructor(heroes: AttackHero[], scores: number[], heroScores:HeroScore[]) {
this.heroes = heroes;
this.score = scores.reduce((pre, cur) => pre + cur, 0);
let {pLv, score} = getPlvAndScore(scores);
let newScores: number[] = [];
for(let {score} of heroScores){
newScores.push(score);
}
let {pLv, score} = getPlvAndScore(newScores);
this.pLv = pLv;
this.score = score;
}

View File

@@ -13,7 +13,7 @@ import { dicTower, loadTower } from "./dictionary/DicTower";
import { dicTowerTask, loadTowerTask } from "./dictionary/DicTowerTask";
import { dicWar, dicWarPvp, dicDailyWarByType, loadWar, dicHeroIdByWar, dicComBattleReward } from "./dictionary/DicWar";
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
import { AUCTION_TIME, BOSS_HP_RATIO_TYPE } from "../consts";
import { AUCTION_TIME, BOSS_HP_RATIO_TYPE, LINEUP_NUM } from "../consts";
import { dicFashions, dicFashionsByHeroId, loadFashions } from "./dictionary/DicFashions";
import { friendShipByIndex, friendShips, friendShipsByLv, friendShipsMax, loadFriendShip } from "./dictionary/DicFriendShip";
import { dicHeroQualityUp, loadHeroQualityUp } from "./dictionary/DicHeroQualityUp";
@@ -645,9 +645,11 @@ export function getPlvAndScore(scores: number[] = []) {
return b - a;
}
});
let maxScore = scores.slice(0, 6).reduce((acc, curr) => acc + curr, 0);
let maxScore = scores.slice(0, LINEUP_NUM).reduce((acc, curr) => acc + curr, 0);
let score = scores.reduce((pre, cur) => pre + cur, 0);
return { score, pLv: getPLvByScore(maxScore * param.PVP.PVP_LINEUP_HEROS) };
// return { score, pLv: getPLvByScore(maxScore * param.PVP.PVP_LINEUP_HEROS) };
return { score, pLv: getPLvByScore(maxScore) };
}
export function getPvpHeroRewardsByScore(score: number) {