武将战力更新,更新表json

This commit is contained in:
mamengke01
2020-12-12 17:40:37 +08:00
parent 4158799327
commit 9bf50e2d14
12 changed files with 1888 additions and 51 deletions
@@ -346,7 +346,7 @@ export class HeroHandler {
continue;
let member = await HeroModel.findByHidAndRole(hid, roleId, false);
if (!member)
return resResult(STATUS.HERO_NOT_FIND);
return resResult(STATUS.ROLE_SHORT_HERO_CONECTION);
if (member.star < friendShip.level)
return resResult(STATUS.NOT_REACH_UNLOCK_LEVEL);
}
@@ -5,7 +5,8 @@ import { PvpDefenseModel } from '../db/PvpDefense';
import { getWarJsons, getGamedata, getExpeditionById } from '../pubUtils/gamedata';
import { decodeStr, resResult, setLocalHours, shouldRefresh } from '../pubUtils/util';
import { WAR_JSON_ATTRIBUTE_TYPE, EXPEDITION_CONST } from '../consts/consts';
import { EXPEDITION_CONST } from '../consts/consts';
import { getAtrrNameById} from '../consts/abilityConst';
import Actor from '../pubUtils/actor';
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
@@ -143,7 +144,7 @@ export function decodeWarJsonAttribute(attribute: string) {
let obj = {hp: 0, atk: 0, matk: 0, def: 0, mdef: 0, speed: 0, agi: 0, luk: 0, hit: 0, cri: 0, flee: 0, antCri: 0, damageIncrease: 0, damageDecrease: 0, defIngnore: 0, bloodSuck: 0}
for(let {id, value} of arr) {
let field = WAR_JSON_ATTRIBUTE_TYPE[id];
let field = getAtrrNameById(id);
if(field) {
obj[field] = value;
}
+31 -9
View File
@@ -2,22 +2,22 @@
* 体力系统
*/
import { HERO_SYSTEM_TYPE, WAR_JSON_ATTRIBUTE_TYPE } from '../consts/consts';
import { HERO_SYSTEM_TYPE } from '../consts/consts';
import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util';
import Hero from '../db/Hero';
import { RoleModel } from '../db/Role';
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake } from '../pubUtils/gamedata';
import { HEROTARIN, CE_RATIO, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst';
import { CeAttrData, CeAttr } from '../db/BaseModel';
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById } from '../pubUtils/gamedata';
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst';
const HERO_CE_RATIO = 100;
//战力计算TODO
export function calPlayerCe(hero: any, type: number, args: Array<number>) {
let incCe = 0;
let incArr = {};
let reIncAttr; // {"hp": {"base": number, "fixUp": number, "ratioUp": number}}
let reIncAttr = {}; // {"hp": {"base": number, "fixUp": number, "ratioUp": number}}
let addSeidList = new Array<number>();
let removeSeidList = new Array<number>();
@@ -40,7 +40,7 @@ export function calPlayerCe(hero: any, type: number, args: Array<number>) {
hero.ceAttr[attrName][attrKey] = parseInt(reIncAttr[attrName][attrKey]);
}
incArr[attrName] = reIncAttr[attrName].fixUp * HERO_CE_RATIO + reIncAttr[attrName].base *(HERO_CE_RATIO + reIncAttr[attrName].ratioUp) - oldCe; //计算属性
incCe += incArr[attrName] * CE_RATIO[attrName];
incCe += incArr[attrName] * getAttrCeRatio[attrName];
}
hero.ce += incCe;
return incCe;
@@ -106,8 +106,8 @@ export function calHeroStarIncAttr (hero: Hero, addSeidList: Array<number>, remo
let starUp = dicStar.ceAttr.get(stage);
let newBase = heroAttr + hero.lv * (heroUpAttr + starUp);
let field = WAR_JSON_ATTRIBUTE_TYPE[targetAttrId];
let ceAttrData: CeAttrData = ceAttr[field]||new CeAttrData(); // 存表中的属性下的basefixupratioup
let field = getAtrrNameById(targetAttrId);
let ceAttrData: CeAttrData = ceAttr[field]; // 存表中的属性下的basefixupratioup
let {ratioUp = 0, fixUp = 0} = ceAttrData;
res[field] = { base: newBase, ratioUp, fixUp}; // base变动,增量为△base * ratio + 0
}
@@ -117,8 +117,8 @@ export function calHeroStarIncAttr (hero: Hero, addSeidList: Array<number>, remo
export function calHeroTrainIncAttr(hero: any) {
let res = {};
let attrName: string = HEROTARIN[hero.jobStage];
res[attrName] ={fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
let attrName: string = getAttrNameByJobStage[hero.jobStage];
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
let currentJob = getJobInfoById(hero.job);
if (currentJob.grade > 1) {
let jobGradeAndClass = getJobByGradeAndClass(currentJob.job_class, currentJob.grade - 1);
@@ -130,6 +130,28 @@ export function calHeroTrainIncAttr(hero: any) {
return res;
}
export function calHeroJobStageUpIncAttr(hero: any) {
let res = {};
return res;
}
export function calWaerHeroSkinIncAttr(hero: any) {
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 {
}
return res;
}
// 根据存在升星表等的stage字段的id对应17维id
function getFieldByStage(stage: number, jobid: number) {
let targetAttrId = ABI_TYPE_TO_STAGE.get(stage);