添加最强五人战力
This commit is contained in:
@@ -39,10 +39,6 @@ export default class Utils extends Service {
|
||||
return pubGamedata.getGoodById(gid);
|
||||
}
|
||||
|
||||
public calculateCE(heroInfo: {hid: number, lv: number }) {
|
||||
return pubUtils.calculateCE(heroInfo)
|
||||
}
|
||||
|
||||
public getExpByLv(lv: number) {
|
||||
return pubGamedata.getExpByLv(lv);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ import { Service } from 'egg';
|
||||
import Counter from '@db/Counter';
|
||||
import { STATUS, HERO_SYSTEM_TYPE } from '@consts';
|
||||
import { ITID, COUNTER } from '@consts';
|
||||
import Actor from '@pubUtils/actor';
|
||||
import { ItemModel } from '@db/Item';
|
||||
import { gameData, getHeroExpByLv } from '@pubUtils/data';
|
||||
import { calPlayerCeAndSave } from '@pubUtils/playerCe';
|
||||
import { SchoolModel } from '@db/School';
|
||||
import { CeAttrNumber } from '@db/generalField';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -381,21 +381,26 @@ export default class GMUsers extends Service {
|
||||
public async saveHeroToDefense(roleId: string, roleName: string, hid: number) {
|
||||
const {ctx} = this;
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if(!hero) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
if(!hero || !role) {
|
||||
return ctx.service.utils.resResult(STATUS.GM_HERO_NOT_FOUND);
|
||||
}
|
||||
let { lv } = hero;
|
||||
let { lv, ce, ceAttr } = hero;
|
||||
let { globalCeAttr } = role;
|
||||
|
||||
|
||||
let dicHero = ctx.service.utils.getHeroById(hid);
|
||||
|
||||
let actor = new Actor();
|
||||
actor.initHero(hero);
|
||||
let ce = actor.calculateCE();
|
||||
let attribute = actor.getAttributeJson();
|
||||
let attribute = new CeAttrNumber();
|
||||
for(let attrName in attribute) {
|
||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
||||
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
||||
attribute[attrName] += base * ( 1 + ratioUp + ratioUp2) + fixUp + fixUp2 + equipUp;
|
||||
}
|
||||
let heroInfo = {
|
||||
actorId: dicHero.heroId,
|
||||
actorName: dicHero.name,
|
||||
attribute, lv,
|
||||
attribute: {...attribute, speed: 0, ap: 0}, lv,
|
||||
ce
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user