fix 训练

This commit is contained in:
luying
2020-12-15 17:38:08 +08:00
parent 275ce6a6fb
commit 1565dd206a
2 changed files with 18 additions and 13 deletions
@@ -280,14 +280,19 @@ export class HeroHandler {
return resResult(STATUS.HERO_JOB_STAGE_REACH_MAX_STAGE); return resResult(STATUS.HERO_JOB_STAGE_REACH_MAX_STAGE);
if (hero.job >= getMaxGradeByjobClass(heroJob.job_class)) if (hero.job >= getMaxGradeByjobClass(heroJob.job_class))
return resResult(STATUS.HERO_JOB_REACH_MAX_STAGE); return resResult(STATUS.HERO_JOB_REACH_MAX_STAGE);
let result = await handleCost(roleId, sid, heroJob.trainingConsume);
let consume = new Array<RewardInter>();
if(heroJob.trainingConsume[hero.jobStage]) {
consume.push(heroJob.trainingConsume[hero.jobStage]);
}
let result = await handleCost(roleId, sid, consume);
if(!result) { if(!result) {
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
} }
hero.jobStage = hero.jobStage ++; hero.jobStage = hero.jobStage +1;
//重算战力并下发 //重算战力并下发
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.TRAIN); let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.TRAIN);
return resResult(STATUS.SUCCESS, { hid : heros[0].hid, job : heros[0].job, jobStage: heros[0].jobStage}); return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, job : heros[0].job, jobStage: heros[0].jobStage}});
} }
//进阶 //进阶
@@ -313,7 +318,7 @@ export class HeroHandler {
hero.jobStage = 0; hero.jobStage = 0;
//重算战力并下发 //重算战力并下发
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.STAGEUP, [curJob]); let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.STAGEUP, [curJob]);
return resResult(STATUS.SUCCESS, { hid : heros[0].hid, job : heros[0].job, jobStage : heros[0].jobStage}); return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, job : heros[0].job, jobStage : heros[0].jobStage}});
} }
//激活羁绊 //激活羁绊
@@ -362,7 +367,7 @@ export class HeroHandler {
} }
//重算战力并下发 //重算战力并下发
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.CONNECT, [shipId, level]); let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.CONNECT, [shipId, level]);
return resResult(STATUS.SUCCESS, { hid : heros[0].hid, connections : heros[0].connections}); return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, connections : heros[0].connections}});
} }
//赠送(包括一键赠送) //赠送(包括一键赠送)
@@ -407,7 +412,7 @@ export class HeroHandler {
} else { } else {
await HeroModel.updateHeroInfo(roleId, hero.hid, hero); await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
} }
return resResult(STATUS.SUCCESS, { hid : hero.hid, favour : hero.favour, favourLv : hero.favourLv}); return resResult(STATUS.SUCCESS, { curHero: {hid : hero.hid, favour : hero.favour, favourLv : hero.favourLv}});
} }
//穿带时装 //穿带时装
@@ -441,7 +446,7 @@ export class HeroHandler {
return resResult(STATUS.HERO_SKIN_NOT_FIND); return resResult(STATUS.HERO_SKIN_NOT_FIND);
} }
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.SKIN, [id, lastSkinId]); await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.SKIN, [id, lastSkinId]);
return resResult(STATUS.SUCCESS, { hid : hero.hid, skins : hero.skins}); return resResult(STATUS.SUCCESS, {curHero: {hid : hero.hid, skins : hero.skins} });
} }
} }
+6 -6
View File
@@ -136,7 +136,7 @@ export function getAllAttrStage () {
export function calHeroTrainIncAttr(hero: any) { export function calHeroTrainIncAttr(hero: any) {
let res = {}; let res = {};
let attrName: string = getAttrNameByJobStage(hero.jobStage); let attrName: string = getAttrNameByJobStage(hero.jobStage);
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp}; res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
let currentJob = getJobInfoById(hero.job); let currentJob = getJobInfoById(hero.job);
if (currentJob.grade > 1) { if (currentJob.grade > 1) {
let jobGradeAndClass = getJobByGradeAndClass(currentJob.job_class, currentJob.grade - 1); let jobGradeAndClass = getJobByGradeAndClass(currentJob.job_class, currentJob.grade - 1);
@@ -171,12 +171,12 @@ export function calWaerHeroSkinIncAttr(hero: any, args: Array<number>) {
let attrName; let attrName;
for (let attr of delSkin.actorAttrs) { for (let attr of delSkin.actorAttrs) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp}; 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; res[attrName].fixUp += attr.number * HERO_CE_RATIO;
} }
for (let attr of addSkin.actorAttrs) { for (let attr of addSkin.actorAttrs) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp}; 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; res[attrName].fixUp -= attr.number * HERO_CE_RATIO;
} }
return res; return res;
@@ -192,14 +192,14 @@ export function calHeroConectIncAttr(hero: any, args: Array<number>) {
let currentShip = getFriendShipById(shipId, level); let currentShip = getFriendShipById(shipId, level);
for (let attr of currentShip.attributes) { for (let attr of currentShip.attributes) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp}; 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); res[attrName].fixUp += attr.number * (HERO_CE_RATIO + fiendShipLevel.add);
} }
if (level > 1) { if (level > 1) {
let lastShip = getFriendShipById(shipId, level - 1); let lastShip = getFriendShipById(shipId, level - 1);
for (let attr of lastShip.attributes) { for (let attr of lastShip.attributes) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp}; 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); res[attrName].fixUp -= attr.number * (HERO_CE_RATIO + fiendShipLevel.add);
} }
} }
@@ -220,7 +220,7 @@ export function calHeroFavourUpIncAttr(hero: any, args: Array<number>) {
let heroShip = getFriendShipById(connect.shipId, connect.level); let heroShip = getFriendShipById(connect.shipId, connect.level);
for (let attr of heroShip.attributes) { for (let attr of heroShip.attributes) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp}; 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); res[attrName].fixUp += attr.number * (HERO_CE_RATIO + difAdd);
} }
} }