战力:获取显示数据
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
|
||||
import { ExpeditionPointModel } from '../db/ExpeditionPoint';
|
||||
import Role, { CeAttrDataRole, RoleModel } from '../db/Role';
|
||||
import Role, { RoleModel } from '../db/Role';
|
||||
import { shouldRefresh, getRandSingleEelm } from '../pubUtils/util';
|
||||
import { LINEUP_NUM, EXPEDITION_WAR_RECORD_STATUS } from '../consts';
|
||||
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
||||
import { CeAttrData, HeroType } from '../db/Hero';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { getTimeFunD } from '../pubUtils/timeUtil';
|
||||
import { ExpeditionRecordModel } from '../db/ExpeditionRecord';
|
||||
import { Attribute, AttributeCal } from '../domain/roleField/attribute';
|
||||
import * as dicParam from '../pubUtils/dicParam';
|
||||
import { getSumCe } from './playerCeService';
|
||||
import { getHeroesAttributes, getSumCe } from './playerCeService';
|
||||
|
||||
/**
|
||||
* 获取远征关卡列表
|
||||
@@ -137,7 +137,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
|
||||
let index = Math.floor(Math.random() * resultRange.length);
|
||||
let role = resultRange[index];
|
||||
let {roleId, topLineup, topLineupCe } = role;
|
||||
let { attr: roleAttrs } = role;
|
||||
let attrByHid = await getHeroesAttributes(roleId);
|
||||
|
||||
enemyObj.enemyFrom = 1;
|
||||
enemyObj.enemyId = roleId;
|
||||
@@ -150,9 +150,10 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
|
||||
if(hero) {
|
||||
let h = <HeroType>hero.hero;
|
||||
if(h) {
|
||||
let { star, lv, attr: heroAttrs, ce } = h;
|
||||
let { star, lv, ce } = h;
|
||||
let dicHero = gameData.hero.get(hero.hid);
|
||||
let { attribute } = getPlayerAttribute(lv, heroAttrs, roleAttrs);
|
||||
let attr = attrByHid.get(hero.hid);
|
||||
let attribute = attr.getAttributesToString();
|
||||
let heroInfo = {
|
||||
actorId: hero.hid,
|
||||
skinId: h.skinId,
|
||||
@@ -281,32 +282,18 @@ export async function getResetRemainCnt(curTime: Date, roleId: string, role?: Ro
|
||||
let newAttribute = new AttributeCal();
|
||||
newAttribute.setLv(lv);
|
||||
newAttribute.setByWarJson(subAttrs); // 次级属性
|
||||
let subAttrCe = newAttribute.calSubAttrCeAndReduce() * enemyCount;
|
||||
let subAttrCe = newAttribute.calSubAttrCe() * enemyCount;
|
||||
if(ce * ratio > subAttrCe) {
|
||||
let mainAttrCe = ce * ratio - subAttrCe;
|
||||
newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe);
|
||||
let attrArr = newAttribute.getReduceAttributesToString();
|
||||
let newCe = newAttribute.calCelAndReduce();
|
||||
let attrArr = newAttribute.getAttributesToString();
|
||||
let newCe = newAttribute.calCe();
|
||||
return { attribute: attrArr, ce: newCe };
|
||||
} else {
|
||||
newAttribute = new AttributeCal();
|
||||
newAttribute.setByWarJson(mainAttrs, ce * ratio / enemyCe);
|
||||
let attrArr = newAttribute.getReduceAttributesToString();
|
||||
let newCe = newAttribute.calCelAndReduce();
|
||||
let attrArr = newAttribute.getAttributesToString();
|
||||
let newCe = newAttribute.calCe();
|
||||
return { attribute: attrArr, ce: newCe };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据玩家数据获取到他的属性
|
||||
* @param ceAttr hero表的ceAttr
|
||||
* @param globalCeAttr role表中的globalCeAttr
|
||||
*/
|
||||
export function getPlayerAttribute(lv: number, heroAttrs: CeAttrData[] = [], roleAttrs: CeAttrDataRole[] = []) {
|
||||
let newAttribute = new AttributeCal();
|
||||
newAttribute.setLv(lv);
|
||||
newAttribute.setByDbData(roleAttrs, heroAttrs);
|
||||
let attribute = newAttribute.getReduceAttributesToString();
|
||||
let ce = newAttribute.calCelAndReduce();
|
||||
return { attribute, ce };
|
||||
}
|
||||
Reference in New Issue
Block a user