fix 远征相应获取属性逻辑
This commit is contained in:
@@ -7,7 +7,7 @@ import { PVP_HERO_POS, ROBOT_NAME, REDIS_KEY, PVP_CONST } from '../consts';
|
||||
import { setPvpDefResult } from '../services/timeTaskService';
|
||||
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
|
||||
import { getRandomIndexByLen, genCode, getRandomByLen, shouldRefresh, reduceCe } from '../pubUtils/util';
|
||||
import { oppPlayersInter, RankParam, pvpEndParamInter, oppHeroesDefenseInter } from '../pubUtils/interface';
|
||||
import { oppPlayersInter, RankParam, pvpEndParamInter, oppHeroesDefenseInter, Attributes } from '../pubUtils/interface';
|
||||
import { gameData, getPLvByScore } from "../pubUtils/data";
|
||||
import { PVP } from '../pubUtils/dicParam';
|
||||
import { SystemConfigModel } from '../db/SystemConfig'
|
||||
@@ -15,7 +15,7 @@ import { setRank, getMyRank, getFieldByRank } from './redisService';
|
||||
import { nowSeconds, checkTodayTime } from '../pubUtils/timeUtil';
|
||||
import { HeroesRecord } from '../db/PvpRecord';
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import { CeAttrNumber } from '../db/generalField';
|
||||
import { CeAttrNumber, CeAttr, CeAttrRole } from '../db/generalField';
|
||||
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||
const _ = require('underscore');
|
||||
|
||||
@@ -369,15 +369,9 @@ export async function getRobotLineup(mapWarJson: DicWarJson[], curOpp: OppPlayer
|
||||
for(let json of dicWarJson) {
|
||||
let curDicMapJson = mapWarJson.find(cur => cur.dataId == json.dataId);
|
||||
const { actorId, actorName, attribute, skill, seid, star, spine, relation } = json;
|
||||
console.log(JSON.stringify(json))
|
||||
if(relation == 2 && actorId > 0) { // 默认格子
|
||||
let newAttribute = new CeAttrNumber();
|
||||
for(let attrName in newAttribute) {
|
||||
newAttribute[attrName] = Math.floor(attribute[attrName] * reduceCe(topFiveCe) / PVP_CONST.ENEMY_CE * dicOpp.ratio);
|
||||
}
|
||||
newAttribute['speed'] = 0;
|
||||
newAttribute['ap'] = 0;
|
||||
|
||||
if(relation == 2 && actorId > 0) { // 默认格子
|
||||
let newAttribute = getRobotAttribute(attribute, topFiveCe, PVP_CONST.ENEMY_CE, dicOpp.ratio);
|
||||
let heroInfo = { actorId, actorName, skill, seid, star, spine, attribute: newAttribute, lv };
|
||||
heroes.push({
|
||||
...curDicMapJson, ...heroInfo
|
||||
@@ -400,16 +394,7 @@ export async function getPlayerLineup(mapWarJson: DicWarJson[], curOpp: OppPlaye
|
||||
let dicHero = gameData.hero.get(actorId);
|
||||
let h = <HeroType>hero;
|
||||
let { ceAttr } = h;
|
||||
let newAttribute = new CeAttrNumber();
|
||||
for(let attrName in newAttribute) {
|
||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
||||
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
||||
let result = base * ( 1 + ratioUp + ratioUp2) + fixUp + fixUp2 + equipUp;
|
||||
newAttribute[attrName] += reduceCe(result);
|
||||
}
|
||||
newAttribute['speed'] = 0;
|
||||
newAttribute['ap'] = 0;
|
||||
|
||||
let newAttribute = getPlayerAttribute(ceAttr, globalCeAttr);
|
||||
let heroInfo = { outIndex: order, actorId, actorName: dicHero.name, skill:0, seid:'&', star: h.star, spine: 0, attribute: newAttribute, lv: h.lv };
|
||||
heroes.push({
|
||||
...curDicMapJson, ...heroInfo
|
||||
@@ -419,6 +404,34 @@ export async function getPlayerLineup(mapWarJson: DicWarJson[], curOpp: OppPlaye
|
||||
return heroes
|
||||
}
|
||||
|
||||
// 按比例计算出兵表中的属性
|
||||
export function getRobotAttribute(attribute: Attributes, ce: number, enemyCe: number, ratio: number) {
|
||||
|
||||
let newAttribute = new CeAttrNumber();
|
||||
for(let attrName in newAttribute) {
|
||||
newAttribute[attrName] = Math.floor(attribute[attrName] * reduceCe(ce) / enemyCe * ratio);
|
||||
}
|
||||
newAttribute['speed'] = 0;
|
||||
newAttribute['ap'] = 0;
|
||||
|
||||
return newAttribute;
|
||||
}
|
||||
|
||||
// 计算玩家的属性
|
||||
export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||
let newAttribute = new CeAttrNumber();
|
||||
for(let attrName in newAttribute) {
|
||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
||||
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
||||
let result = base * ( 1 + ratioUp + ratioUp2) + fixUp + fixUp2 + equipUp;
|
||||
newAttribute[attrName] += reduceCe(result);
|
||||
}
|
||||
newAttribute['speed'] = 0;
|
||||
newAttribute['ap'] = 0;
|
||||
|
||||
return newAttribute;
|
||||
}
|
||||
|
||||
// 获取我方战报记录
|
||||
export async function generMyRecInfo(heroScores: HeroScores[], winStreakNum: number, role: RoleType, isSuccess: boolean, pos: number, myHeroes: pvpEndParamInter[]) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user