武将:一键训练

This commit is contained in:
luying
2021-08-14 17:57:46 +08:00
parent 8fd9aeb25b
commit e86e51c456
2 changed files with 26 additions and 22 deletions

View File

@@ -463,17 +463,18 @@ export function calHeroTrainIncAttr(originHero: HeroType, update: HeroUpdate) {
let { job = oldJob, jobStage = oldJobStage } = update;
let dicJob = gameData.job.get(job);
if (dicJob.grade >= 1) {
let jobGradeAndClass = getJobByGradeAndClass(dicJob.job_class, dicJob.grade - 1);
let lastJob = gameData.job.get(jobGradeAndClass.jobid);
let targetAttrId = dicJob.ceAttr.get(jobStage).id;
let inc = (dicJob.ceAttr.get(jobStage).attr - lastJob.ceAttr.get(jobStage).attr) * HERO_CE_RATIO;
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp: inc } });
} else {
let targetAttrId = dicJob.ceAttr.get(jobStage).id;
let inc = dicJob.ceAttr.get(jobStage).attr * HERO_CE_RATIO;
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp: inc } });
let lastJob = getJobByGradeAndClass(dicJob.job_class, dicJob.grade - 1);
let dicLastJob = lastJob? gameData.job.get(lastJob.jobid): null;
for(let i = 1; i <= dicJob.maxStage; i++) {
if(oldJobStage < i && jobStage >= i) {
let lastAttr = dicLastJob? dicLastJob.ceAttr.get(i).attr: 0;
let targetAttrId = dicJob.ceAttr.get(i).id;
let targetAttrValue = dicJob.ceAttr.get(i).attr;
let inc = (targetAttrValue - lastAttr) * HERO_CE_RATIO;
console.log('*******', targetAttrId, targetAttrValue, lastAttr, inc )
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp: inc } });
}
}
return heroAttrs;
}