战力:pvp远征匹配系数修改
This commit is contained in:
@@ -24,9 +24,11 @@ import { PvpHistoryOppModel, PvpHistoryOppType } from '../db/PvpHistoryOpp';
|
||||
export async function initPvpInfo(role: RoleType) {
|
||||
let heroes: Array<Heroes> = [];
|
||||
//初始化最强5人阵容
|
||||
let defCe = 0;
|
||||
for (let i = PVP_HERO_POS.START; i <= PVP_HERO_POS.END; i++) {
|
||||
let index = i - PVP_HERO_POS.START;
|
||||
let item = role.topLineup[index];
|
||||
if(item) defCe += item.ce;
|
||||
heroes.push({
|
||||
actorId: item?.hid||0,
|
||||
hero: item?.hero||null,
|
||||
@@ -39,7 +41,7 @@ export async function initPvpInfo(role: RoleType) {
|
||||
let oppPlayers: Array<OppPlayers> = await refreshEnemies(role, 0, 1);
|
||||
let {seasonNum} = await SystemConfigModel.findSystemConfig();
|
||||
let challengeCnt = PVP.PVP_CHALLENGE_COUNTS;
|
||||
let result = await PvpDefenseModel.createPvpDefense({ roleId: role.roleId, roleName: role.roleName, role: role._id, heroes, oppPlayers, defCe: role.topLineupCe, seasonNum, challengeCnt });
|
||||
let result = await PvpDefenseModel.createPvpDefense({ roleId: role.roleId, roleName: role.roleName, role: role._id, heroes, oppPlayers, defCe, seasonNum, challengeCnt });
|
||||
|
||||
//加入排行榜
|
||||
let { roleId, roleName, lv, vLv, headHid, sHid, title } = role;
|
||||
@@ -248,6 +250,7 @@ async function matchRobot(oppPlayers: OppPlayers[], mapWarJson: DicWarJson[], ro
|
||||
let robotWarjson = gameData.warJson.get(result.war_id);
|
||||
if(!robotWarjson) { /* TODO 判空处理 */ }
|
||||
let heroes = new Array<PvpEnemies>();
|
||||
let defCe = 0;
|
||||
for(let warJson of mapWarJson) {
|
||||
if(warJson.relation == 1) continue;
|
||||
let h = robotWarjson.find(cur => cur.dataId == warJson.dataId);
|
||||
@@ -257,6 +260,7 @@ async function matchRobot(oppPlayers: OppPlayers[], mapWarJson: DicWarJson[], ro
|
||||
let heroInfo = new PvpHeroInfo();
|
||||
heroInfo.setRobotInfo(h, myLv, dicHero.initialStars, dicHero.quality);
|
||||
let attribute = getRobotAttribute(h.attribute, myCe, PVP_CONST.ENEMY_CE, ratio);
|
||||
defCe += attribute.ce;
|
||||
heroInfo.setAttribute(attribute);
|
||||
let enemy = new PvpEnemies(warJson, heroInfo, 0);
|
||||
heroes.push(enemy);
|
||||
@@ -269,7 +273,7 @@ async function matchRobot(oppPlayers: OppPlayers[], mapWarJson: DicWarJson[], ro
|
||||
if(hisPLv < 1) hisPLv = 1
|
||||
|
||||
let pvpHistoryOpp = await PvpHistoryOppModel.createPvpOpp({
|
||||
roleId, oppRoleId, roleName, pos, defCe: Math.floor(myCe * ratio), pLv: hisPLv, lv: myLv, heroes
|
||||
roleId, oppRoleId, roleName, pos, defCe, pLv: hisPLv, lv: myLv, heroes
|
||||
});
|
||||
|
||||
oppPlayers.push({
|
||||
@@ -494,9 +498,10 @@ export async function findPvpDefAllByRoleId(roleId: string) {
|
||||
export function getRobotAttribute(attribute: {id: number, val: number}[], ce: number, enemyCe: number, ratio: number) {
|
||||
|
||||
let newAttribute = new Attribute();
|
||||
newAttribute.setByWarJson(attribute, ce / enemyCe * ratio);
|
||||
newAttribute.setByWarJson(attribute, Math.sqrt(ce / enemyCe * ratio));
|
||||
let attrJson = newAttribute.getReduceAttributes();
|
||||
|
||||
let resultCe = newAttribute.calCelAndReduce();
|
||||
attrJson.ce = resultCe;
|
||||
return attrJson;
|
||||
}
|
||||
|
||||
@@ -509,7 +514,8 @@ export function getPlayerAttribute(heroAttrs: CeAttrData[] = [], roleAttrs: CeAt
|
||||
let newAttribute = new Attribute();
|
||||
newAttribute.setByDbData(roleAttrs, heroAttrs);
|
||||
let attrJson = newAttribute.getReduceAttributes();
|
||||
|
||||
let resultCe = newAttribute.calCelAndReduce();
|
||||
attrJson.ce = resultCe;
|
||||
return attrJson;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user