添加最强五人战力
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {Application, BackendSession} from 'pinus';
|
||||
import { HeroModel } from '../../../db/Hero';
|
||||
import Actor from '../../../pubUtils/actor';
|
||||
|
||||
|
||||
export default function(app: Application) {
|
||||
return new ChatHandler(app);
|
||||
|
||||
@@ -3,17 +3,14 @@ import { EquipModel } from './../../../db/Equip';
|
||||
import { RoleModel } from './../../../db/Role';
|
||||
import { UserModel } from '../../../db/User';
|
||||
import { GMUserModel } from '../../../db/GMUser';
|
||||
import { Application, Session } from 'pinus';
|
||||
import { Application } from 'pinus';
|
||||
import {FrontendSession} from 'pinus';
|
||||
import { HeroModel } from './../../../db/Hero';
|
||||
import { resResult, returnHeroCeRatio, reduceCe } from '../../../pubUtils/util';
|
||||
import { startEvent } from '../../../services/eventSercive';
|
||||
import { EVENT_START_LV, FUNC_OPT_TYPE, HERO_CE_RATIO } from '../../../consts';
|
||||
import { FUNC_OPT_TYPE } from '../../../consts';
|
||||
import { getAp } from '../../../services/actionPointService';
|
||||
import Actor from '../../../pubUtils/actor';
|
||||
import { ItemModel } from '../../../db/Item';
|
||||
import { switchOnFunc } from '../../../services/funcSwitchService';
|
||||
import { stat } from 'fs';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new EntryHandler(app);
|
||||
|
||||
@@ -5,9 +5,8 @@ import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
|
||||
import { getWarJsons, getGamedata, getExpeditionById } from '../pubUtils/gamedata';
|
||||
import { decodeStr, resResult, setLocalHours, shouldRefresh } from '../pubUtils/util';
|
||||
import { EXPEDITION_CONST, HERO_CE_RATIO } from '../consts';
|
||||
import { EXPEDITION_CONST, HERO_CE_RATIO, getAttrCeRatio } from '../consts';
|
||||
import { getAtrrNameById} from '../consts';
|
||||
import Actor from '../pubUtils/actor';
|
||||
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
||||
|
||||
export async function findOrCreateEnemies(roleId: string, myCe: number, expeditionCode: string, expeditionId: number, battleStatus: number) {
|
||||
@@ -110,8 +109,10 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
|
||||
attribute[value] *= ratio;
|
||||
attribute[value] = Math.round(attribute[value]);
|
||||
}
|
||||
let actor = new Actor();
|
||||
let ce = actor.calculateCEByExpression(attribute);
|
||||
let ce = 0;
|
||||
for(let attrName in attribute) {
|
||||
ce += attribute[attrName] * getAttrCeRatio(attrName);
|
||||
}
|
||||
enemyObj.enemies.push({...enemy, attribute, lv});
|
||||
allCe += ce;
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ const _ = require('underscore');
|
||||
|
||||
//修改并下发战力
|
||||
export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) {
|
||||
let {role, pushHeros} = await pubCalPlayerCeAndSave(roleId, heros, type, args);
|
||||
let {role, pushHeros, topFiveCe} = await pubCalPlayerCeAndSave(roleId, heros, type, args);
|
||||
//下发战力
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: pushHeros, topFiveCe: 0 }), uids);
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: pushHeros, topFiveCe: reduceCe(topFiveCe) }), uids);
|
||||
return heros;
|
||||
}
|
||||
|
||||
export async function calAllHeroCe(sid: string, roleId: string, type?:number, args?:Array<number>) {
|
||||
let {ce, pushHeros}= await reCalAllHeroCe(roleId, type, args);
|
||||
let {ce, pushHeros, topFiveCe }= await reCalAllHeroCe(roleId, type, args);
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topFiveCe: 0 }), uids);
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topFiveCe: reduceCe(topFiveCe) }), uids);
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user