武将:职业训练

This commit is contained in:
luying
2021-07-07 16:45:35 +08:00
parent 50867e8878
commit f0852f653a
3 changed files with 30 additions and 19 deletions
+11 -9
View File
@@ -14,7 +14,7 @@ import { DicSe } from './dictionary/DicSe';
import { EquipType } from '../db/Equip';
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
import { SchoolModel } from '../db/School';
import { ABI_TYPE_TO_STAGE, ABI_TYPE_MAIN } from '../consts/constModules/abilityConst'
import { ABI_TYPE_TO_STAGE, ABI_TYPE_MAIN, ABI_JOB_STAGE } from '../consts/constModules/abilityConst'
import { PvpDefenseModel } from '../db/PvpDefense';
import { findIndex } from 'underscore';
import { GuildModel } from '../db/Guild';
@@ -443,16 +443,17 @@ export function calHeroTrainIncAttr(originHero: HeroType, update: HeroUpdate) {
let { attr: heroAttrs, job: oldJob, jobStage: oldJobStage } = originHero;
let { job = oldJob, jobStage = oldJobStage } = update;
let targetAttrId = ABI_TYPE_TO_STAGE.get(jobStage); // 转换为18维的属性id
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 inc = (dicJob.ceAttr.get(jobStage) - lastJob.ceAttr.get(jobStage)) * HERO_CE_RATIO;
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 inc = dicJob.ceAttr.get(jobStage) * HERO_CE_RATIO;
let targetAttrId = dicJob.ceAttr.get(jobStage).id;
let inc = dicJob.ceAttr.get(jobStage).attr * HERO_CE_RATIO;
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp: inc } })
}
return heroAttrs;
@@ -505,14 +506,15 @@ export function calHeroJobAttr(originHero: HeroType, hero: HeroUpdate, addSeidLi
lastJob = gameData.job.get(jobGradeAndClass.jobid);
}
for (let stage = ABI_STAGE.START + 1; stage <= ABI_STAGE.END; stage++) {
let targetAttrId = ABI_TYPE_TO_STAGE.get(stage);
for (let stage = ABI_JOB_STAGE.START; stage < ABI_JOB_STAGE.END; stage++) {
if(hero.jobStage >= stage) {
let fixUp = currentJob.ceAttr.get(stage) * HERO_CE_RATIO;
let targetAttrId = currentJob.ceAttr.get(stage).id;
let fixUp = currentJob.ceAttr.get(stage).attr * HERO_CE_RATIO;
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp }})
} else {
if(lastJob) {
let fixUp = lastJob.ceAttr.get(stage) * HERO_CE_RATIO;
let targetAttrId = lastJob.ceAttr.get(stage).id;
let fixUp = lastJob.ceAttr.get(stage).attr * HERO_CE_RATIO;
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp } });
}
}