diff --git a/game-server/app/services/role/calCe.ts b/game-server/app/services/role/calCe.ts index b38ca2377..625009ca2 100644 --- a/game-server/app/services/role/calCe.ts +++ b/game-server/app/services/role/calCe.ts @@ -15,7 +15,7 @@ export class CalCe { originCes: Map = new Map(); // hid => ce resultCes: Map = new Map(); // hid => ce data: CalCeData; - attrsByHid: Map = new Map(); + attrsByHid: Map = new Map(); originTopHeroCe: number; constructor(roleId: string) { @@ -41,25 +41,29 @@ export class CalCe { } public calHeroCe() { - let attrs = new Map(); // hid => [{attrId, val}] + let attrs = new Map(); // hid => [{attrId, val}] for(let [hid ] of this.data.heroAttrsByHid) { let lv = this.data.heroLv.get(hid)||1; for(let attrId = ABI_TYPE.ABI_HP; attrId < ABI_TYPE.ABI_MAX; attrId++) { if(!this.data.heroAttrs.has(`${hid}_${attrId}`) && !this.data.globalAttrs.has(attrId)) continue; let { mainBase = 0, mainBaseUp = 0, subBase = 0, job = 0, starUp = 0, connect = 0, talent = 0, equipQuality = 0, equipStrength = 0, equipStar = 0, equipSuit = 0, jewel = 0, stone = 0, artifactLv = 0, artifactQuality = 0, artifactSeid = 0 } = this.data.heroAttrs.get(`${hid}_${attrId}`)||{}; let { school = 0, teraph = 0, title = 0, scroll = 0, skin = 0 } = this.data.getGlobalAttrById(attrId)||{}; - let val = 0, str = ''; + let val = 0, ceVal = 0, str = '', ceStr = ''; if(ABI_TYPE_MAIN.indexOf(attrId) != -1) { // {[ hp1 + lv * hp2 ] * ( 1 + hp5 ) + [( hp6 + hp7 ) * ( 1 + hp8 )]} * ( 1 + hp9 ) + hp10 + hp11 + hp14 val = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality; + ceVal = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality; str += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}`; + ceStr += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}`; } else { // attr1 + attr2 + attr4 + attr5 + attr6 + attr7 + attr9 val = subBase + job + teraph + school + title + jewel + equipStar; + ceVal = job + teraph + school + title + jewel + equipStar; str += `${subBase}+${job}+${teraph}+${school}+${title}+${jewel}+${equipStar}`; + ceStr += `${job}+${teraph}+${school}+${title}+${jewel}+${equipStar}`; } if(!attrs.has(hid)) attrs.set(hid, []); - attrs.get(hid).push({ id: attrId, val, str }); + attrs.get(hid).push({ id: attrId, val, ceVal, str, ceStr }); } } let result = new Map(); @@ -67,7 +71,7 @@ export class CalCe { let lv = this.data.heroLv.get(hid)||1; let obj = new AttributeCal(); obj.setLv(lv); - obj.setByWarJson(arr); + obj.setByCeArr(arr); let ce = obj.calCe(); this.resultCes.set(hid, ce); result.set(hid, ce); diff --git a/shared/db/RoleCe.ts b/shared/db/RoleCe.ts index 7c979a406..9c9017426 100644 --- a/shared/db/RoleCe.ts +++ b/shared/db/RoleCe.ts @@ -63,6 +63,8 @@ export class SingleAttribute { @prop({ required: true }) val: number; // 值 @prop({ required: true }) + ceVal: number; // 值 + @prop({ required: true }) str: string; // 公式 } diff --git a/shared/domain/roleField/attribute.ts b/shared/domain/roleField/attribute.ts index 9f7dd91bb..997ca0a07 100644 --- a/shared/domain/roleField/attribute.ts +++ b/shared/domain/roleField/attribute.ts @@ -22,6 +22,16 @@ export class AttributeCal { } } + public setByCeArr(attributes: {id: number, ceVal: number}[], ratio: number = 1) { + for(let {id, ceVal} of attributes) { + if(ABI_TYPE_MAIN.includes(id)) { + this.attrs.set(id, Math.floor(ceVal * ratio)); + } else { + this.attrs.set(id, Math.floor(ceVal)); + } + } + } + public setByMap( attributes: Map, ratio: number = 1 ) { for(let [id, val] of attributes) { if(ABI_TYPE_MAIN.includes(id)) {