武将战力计算(进阶,穿戴,羁绊,好感)加道具
This commit is contained in:
@@ -6,13 +6,15 @@ import { HERO_SYSTEM_TYPE } from '../consts/consts';
|
||||
import { pinus } from 'pinus';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
|
||||
import { resResult } from '../pubUtils/util';
|
||||
import { resResult, deepCopy } from '../pubUtils/util';
|
||||
import Hero from '../db/Hero';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { CeAttrData, CeAttr } from '../db/BaseModel';
|
||||
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById, getHeroSkillById, getSeidById } from '../pubUtils/gamedata';
|
||||
import { getFashionsById, getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById, getHeroSkillById, getSeidById } from '../pubUtils/gamedata';
|
||||
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE, SEID_TYPE, HERO_ATTR} from '../consts/abilityConst';
|
||||
import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
|
||||
const HERO_CE_RATIO = 100;
|
||||
const _ = require('underscore');
|
||||
//战力计算TODO
|
||||
export function calPlayerCe(hero: any, type: number, args: Array<number>) {
|
||||
let incCe = 0;
|
||||
@@ -26,6 +28,14 @@ export function calPlayerCe(hero: any, type: number, args: Array<number>) {
|
||||
reIncAttr = calHeroStarIncAttr(hero, args, addSeidList, removeSeidList); // args: 升的星盘
|
||||
} else if (type == HERO_SYSTEM_TYPE.TRAIN) {
|
||||
reIncAttr = calHeroTrainIncAttr(hero);
|
||||
} else if (type == HERO_SYSTEM_TYPE.STAGEUP) {
|
||||
reIncAttr = calHeroJobStageUpIncAttr(hero, args, addSeidList, removeSeidList )
|
||||
} else if (type == HERO_SYSTEM_TYPE.SKIN) {
|
||||
reIncAttr = calWaerHeroSkinIncAttr(hero, args);
|
||||
} else if (type == HERO_SYSTEM_TYPE.FAVOUR) {
|
||||
reIncAttr = calHeroFavourUpIncAttr(hero, args);
|
||||
} else if (type == HERO_SYSTEM_TYPE.CONNECT) {
|
||||
reIncAttr = calHeroConectIncAttr(hero, args);
|
||||
}
|
||||
|
||||
addSeidEffect(reIncAttr, addSeidList, removeSeidList); // 处理加值
|
||||
@@ -123,7 +133,7 @@ export function getAllAttrStage () {
|
||||
};
|
||||
return attrs;
|
||||
}
|
||||
|
||||
//训练
|
||||
export function calHeroTrainIncAttr(hero: any) {
|
||||
let res = {};
|
||||
let attrName: string = getAttrNameByJobStage(hero.jobStage);
|
||||
@@ -138,25 +148,82 @@ export function calHeroTrainIncAttr(hero: any) {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
export function calHeroJobStageUpIncAttr(hero: any) {
|
||||
//进阶
|
||||
export function calHeroJobStageUpIncAttr(hero: any, args: Array<number>, addSeidList: Array<number>, removeSeidList: Array<number> ) {
|
||||
let res = {};
|
||||
|
||||
let lastJob = getJobInfoById(args[0]);
|
||||
let currentJob = getJobInfoById(hero.job);
|
||||
addSeidList.concat(deepCopy(currentJob.seids));
|
||||
for (let seid of lastJob.seids) {
|
||||
let index = _.indexOf(currentJob.seids, seid);
|
||||
if (index > 0) {
|
||||
addSeidList.splice(index, 1);
|
||||
} else {
|
||||
removeSeidList.push(seid);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//穿戴时装
|
||||
export function calWaerHeroSkinIncAttr(hero: any, args: Array<number>) {
|
||||
let res = {};
|
||||
let addSkin = getFashionsById(args[0]);
|
||||
let delSkin = getFashionsById(args[1]);
|
||||
let attrName;
|
||||
for (let attr of delSkin.actorAttrs) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * HERO_CE_RATIO;
|
||||
}
|
||||
for (let attr of addSkin.actorAttrs) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp -= attr.number * HERO_CE_RATIO;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
export function calWaerHeroSkinIncAttr(hero: any) {
|
||||
//羁绊解锁
|
||||
export function calHeroConectIncAttr(hero: any, args: Array<number>) {
|
||||
let res = {};
|
||||
let friendShipLevel = getFiendShipLevel(hero.favourLv);
|
||||
hero.conections.forEach(element => {
|
||||
let reFriendShip = getFriendShipById(element.shipId, element.level);
|
||||
if (reFriendShip)
|
||||
getAtrrNameById(reFriendShip);
|
||||
});
|
||||
if (hero.favourLv > 1) {
|
||||
|
||||
} else {
|
||||
let fiendShipLevel = getFiendShipLevel(hero.favourLv);
|
||||
let shipId = args[0];//当前升级的羁绊序号
|
||||
let level = args[1];//当前升级的羁绊等级
|
||||
let attrName;
|
||||
let currentShip = getFriendShipById(shipId, level);
|
||||
for (let attr of currentShip.attributes) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * (HERO_CE_RATIO + fiendShipLevel.add);
|
||||
}
|
||||
if (level > 1) {
|
||||
let lastShip = getFriendShipById(shipId, level - 1);
|
||||
for (let attr of lastShip.attributes) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp -= attr.number * (HERO_CE_RATIO + fiendShipLevel.add);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//好感升级
|
||||
export function calHeroFavourUpIncAttr(hero: any, args: Array<number>) {
|
||||
let res = {};
|
||||
let currentFiendShipLevel = getFiendShipLevel(hero.favourLv);
|
||||
let difAdd = currentFiendShipLevel.add;
|
||||
if (!!args[0]) {
|
||||
let lastFiendShipLevel = getFiendShipLevel(args[0]);
|
||||
difAdd -= lastFiendShipLevel.add;
|
||||
}
|
||||
let attrName;
|
||||
for (let connect of hero.conections) {
|
||||
let heroShip = getFriendShipById(connect.shipId, connect.level);
|
||||
for (let attr of heroShip.attributes) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * (HERO_CE_RATIO + difAdd);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user