diff --git a/game-server/app/services/playerCeService.ts b/game-server/app/services/playerCeService.ts index 9e239b89b..85e79de66 100644 --- a/game-server/app/services/playerCeService.ts +++ b/game-server/app/services/playerCeService.ts @@ -10,8 +10,8 @@ import { resResult } 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 } from '../pubUtils/gamedata'; -import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst'; +import { 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'; const HERO_CE_RATIO = 100; //战力计算TODO export function calPlayerCe(hero: any, type: number, args: Array) { @@ -28,7 +28,7 @@ export function calPlayerCe(hero: any, type: number, args: Array) { reIncAttr = calHeroTrainIncAttr(hero); } - addSeidEffect(reIncAttr, addSeidList, removeSeidList); // 处理加值 + addSeidEffect(hero, reIncAttr, addSeidList, removeSeidList); // 处理加值 if(!hero.ceAttr) hero.ceAttr = new CeAttr(); for (let attrName in reIncAttr) { let originalAttrData: CeAttrData = hero.ceAttr[attrName]||new CeAttrData(); @@ -95,6 +95,24 @@ export function calHeroStarIncAttr (hero: Hero, args: Array, addSeidList res[field] = { base: newBase, ratioUp, fixUp}; // base变动,增量为△base * ratio + 0 } + // 解锁技能 + if(dicHero.skill){ + let {starSeidArr, colorStarSeidArr} = getHeroSkillById(dicHero.skill); + if(isWake) { + for(let {star, value} of starSeidArr){ + if(hero.star == star){ + addSeidList.push(value); + } + } + } else { + for(let {star, value} of colorStarSeidArr){ + if(hero.colorStar == star){ + addSeidList.push(value); + } + } + } + } + return res;//属性增量可以是多个 } @@ -155,6 +173,41 @@ function getFieldByStage(stage: number, jobid: number) { } -function addSeidEffect(reIncAttr: CeAttr, addSeidList: Array, removeSeidList: Array) { - +// 添加技能增加的被动属性 +function addSeidEffect(hero: Hero, reIncAttr: CeAttr, addSeidList: Array, removeSeidList: Array) { + + let effectList = new Array(); // any: dic_zyz_se表内容 + for(let seid of addSeidList) { + let dicSeid = getSeidById(seid); + if(dicSeid && dicSeid.id > 0){ + addSeid(effectList, dicSeid.id, dicSeid.gainValueArr) + } + } + + for(let {type, gainValueArr: [ability, value]} of effectList) { + if(!reIncAttr[HERO_ATTR[ability]]) { + reIncAttr[HERO_ATTR[ability]] = new CeAttrData(); + } + if(type == SEID_TYPE.TYPE101) { // 加值 + reIncAttr[HERO_ATTR[ability]].ratioUp += value; + } else if (type == SEID_TYPE.TYPE102) { // 加百分比 + reIncAttr[HERO_ATTR[ability]].fixUp += value; + } + } +} + +// 获取dic_zyz_se内容 +function addSeid(effectList: Array, seidId:number, seidValue = new Array()){ + // console.log('addSeidEffect', seidId, seidValue) + let curSeid = getSeidById(seidId); + if(!curSeid) {console.log("seidId not found:"+seidId);return;} + if(!seidValue) seidValue = curSeid.gainValueArr; + + if(curSeid.type === 999){ + for(let i = 0;i < seidValue.length;i++){ + addSeid(effectList, seidValue[i]); + } + return; + } + effectList.push(curSeid); } \ No newline at end of file diff --git a/shared/pubUtils/actor.ts b/shared/pubUtils/actor.ts index c8aba0dda..b0db175f4 100644 --- a/shared/pubUtils/actor.ts +++ b/shared/pubUtils/actor.ts @@ -50,18 +50,18 @@ export default class Actor { let dicHero = getHeroInfoById(this.hid); // console.log('updateSkillInfo', dicHero.skill, getHeroSkillById(dicHero.skill)) //被动技能 - if(dicHero.skill){ - let {seidLvUpArr} = getHeroSkillById(dicHero.skill); - for(let ii = 0;ii < seidLvUpArr.length;ii+=2){ - if(this.lv >= seidLvUpArr[ii + 1]){ - let dicSeid = getSeidById(seidLvUpArr[ii]); - // console.log('updateSkillInfo*', seidLvUpArr[ii], dicSeid) - if(dicSeid){ - this.seidList[Math.floor(ii/2)] = dicSeid; - } - } - } - } + // if(dicHero.skill){ + // let {seidLvUpArr} = getHeroSkillById(dicHero.skill); + // for(let ii = 0;ii < seidLvUpArr.length;ii+=2){ + // if(this.lv >= seidLvUpArr[ii + 1]){ + // let dicSeid = getSeidById(seidLvUpArr[ii]); + // // console.log('updateSkillInfo*', seidLvUpArr[ii], dicSeid) + // if(dicSeid){ + // this.seidList[Math.floor(ii/2)] = dicSeid; + // } + // } + // } + // } } addSeidEffect(seidId:number, seidValue?:Array){ diff --git a/shared/pubUtils/gamedata.ts b/shared/pubUtils/gamedata.ts index 5f3efa2c7..99a832c8b 100644 --- a/shared/pubUtils/gamedata.ts +++ b/shared/pubUtils/gamedata.ts @@ -170,21 +170,23 @@ function parseHeroSkill() { const data = gamedata['jsons'][file] || []; data.forEach(elem => { if (elem && elem.skillid) { - const seidLvUpArr = new Array(); - let skillArr = (elem.starSeid as string).split('&'); - let lvUpArr = (elem.starSkill as string).split('&'); + let starSeidArr = new Array<{star: number, value: number}>(); + let colorStarSeidArr = new Array<{star: number, value: number}>(); + + (elem.starSeid as string).split('|').forEach(cur => { + if(cur) { + let a = cur.split('&'); + starSeidArr.push({star: parseInt(a[0]), value: parseInt(a[1])}); + } + }); + (elem.colorStarSeid as string).split('|').forEach(cur => { + if(cur) { + let a = cur.split('&'); + colorStarSeidArr.push({star: parseInt(a[0]), value: parseInt(a[1])}); + } + }); - for(let i = 0;i < skillArr.length;i++){ - if(skillArr[i]==="") continue; - seidLvUpArr.push(parseInt(skillArr[i])); - if(lvUpArr[i]){ - seidLvUpArr.push(parseInt(lvUpArr[i])); - } - else{ - seidLvUpArr.push(1000); - } - } - heroSkillInfo.set(elem.skillid, {seidLvUpArr}); + heroSkillInfo.set(elem.skillid, {starSeidArr, colorStarSeidArr}); } }); }