diff --git a/game-server/app/services/role/calCe.ts b/game-server/app/services/role/calCe.ts index a396f4767..a7591b2f2 100644 --- a/game-server/app/services/role/calCe.ts +++ b/game-server/app/services/role/calCe.ts @@ -46,15 +46,15 @@ export class CalCe { 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 { 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, jewelBase = 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, 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}`; + 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 + jewelBase; + 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 + jewelBase; + 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}+${jewelBase}`; + 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}+${jewelBase}`; } else { // attr1 + attr2 + attr4 + attr5 + attr6 + attr7 + attr9 val = subBase + job + teraph + school + title + jewel + equipStar; @@ -302,6 +302,7 @@ export class CalCe { this.data.clearHeroAttrByHid(hid, 'equipStar'); this.data.clearEquipAttrByHid(hid, 'equipStar'); this.data.clearHeroAttrByHid(hid, 'jewel'); + this.data.clearHeroAttrByHid(hid, 'jewelBase'); this.data.clearHeroAttrByHid(hid, 'stone'); } @@ -379,6 +380,8 @@ export class CalCe { public setJewel(hid: number, eplaceId: number, stones: Stone[], jewel: JewelType) { this.data.clearHeroAttrByHid(hid, 'jewel'); this.data.clearEquipAttrByHidAndEplace(hid, eplaceId, 'jewel'); + this.data.clearHeroAttrByHid(hid, 'jewelBase'); + this.data.clearEquipAttrByHidAndEplace(hid, eplaceId, 'jewelBase'); let seids: number[] = []; if(jewel) { for(let { id, seid, rand } of jewel.randSe) { @@ -389,6 +392,14 @@ export class CalCe { for(let { seid, rand } of jewel.rareSe) { seids.push(seid, rand); } + let dicJewel = gameData.jewel.get(jewel.id); + if(dicJewel) { + let attrBaseValues = dicJewel.rareEffectBaseAttr||[]; + for(let { id, num } of attrBaseValues) { + let equipAttr = this.data.getEquipAttrByHidAndId(hid, eplaceId, id); + equipAttr.jewelBase = num; + } + } } let { ratioUp } = this.addSeidEffect(seids); let map = new Map(); // attrId => val @@ -404,9 +415,10 @@ export class CalCe { equipAttr.jewel = val; } let equips = this.data.getEquipAttrsByHid(hid); - for(let { hid, attrId, jewel } of equips) { + for(let { hid, attrId, jewel, jewelBase } of equips) { let heroAttr = this.data.getHeroAttrByHidAndId(hid, attrId); heroAttr.jewel += jewel; + heroAttr.jewelBase += jewelBase; } } @@ -1083,6 +1095,7 @@ abstract class HeroAllAttr { artifactLv: number = 0; // hp14 宝物等级(dic_zyz_artifactLvPlan的attr) artifactQuality: number = 0; // hp14 宝物品质(dic_zyz_artifactQualityPlan的attr) artifactSeid: number = 0; // hp9 宝物词条(dic_zyz_artifactSeid算出来的) + jewelBase: number = 0; // hp15 天晶固定属性值(jewel的基础属性) constructor(hid: number, attrId: number, ) { this.hid = hid; @@ -1139,6 +1152,8 @@ class HeroMainAttr extends HeroAllAttr { this.artifactQuality = value; break; case HERO_MAIN_ATTR_INDEX.ARTIFACT_SEID: this.artifactSeid = value; break; + case HERO_MAIN_ATTR_INDEX.JEWEL_BASE: + this.jewelBase = value; break; } } } @@ -1196,6 +1211,9 @@ class HeroMainAttr extends HeroAllAttr { case HERO_MAIN_ATTR_INDEX.ARTIFACT_SEID: values.push(this.artifactSeid); break; + case HERO_MAIN_ATTR_INDEX.JEWEL_BASE: + values.push(this.jewelBase); + break; } } return values; @@ -1257,6 +1275,7 @@ abstract class EquipAllAttr { equipStar: number = 0; jewel: number = 0; stone: number = 0; + jewelBase: number = 0; constructor(hid: number, attrId: number) { this.hid = hid; @@ -1290,6 +1309,8 @@ class EquipMainAttr extends EquipAllAttr { this.jewel = value; break; case EQUIP_MAIN_ATTR_INDEX.STONE: this.stone = value; break; + case EQUIP_MAIN_ATTR_INDEX.JEWEL_BASE: + this.jewelBase = value; break; } } } @@ -1314,6 +1335,9 @@ class EquipMainAttr extends EquipAllAttr { case EQUIP_MAIN_ATTR_INDEX.STONE: values.push(this.stone); break; + case EQUIP_MAIN_ATTR_INDEX.JEWEL_BASE: + values.push(this.jewelBase); + break; } } return values; @@ -1388,6 +1412,7 @@ enum HERO_MAIN_ATTR_INDEX { ARTIFACT_LV = 13, // hp14, 宝物等级 ARTIFACT_QUALITY = 14, // hp14, 宝物品质 ARTIFACT_SEID = 15, // hp9,宝物词条 + JEWEL_BASE = 16, // hp15, 天晶基础属性(dic_zyz_jewel的rareEffectBaseAttr) END } @@ -1408,6 +1433,7 @@ enum EQUIP_MAIN_ATTR_INDEX { EQUIP_STAR = 2, // hp8, 装备(dic_zyz_equipStar) JEWEL = 3, // hp9, 天晶洗练出的主属性百分比加成,equipAttr加起来 STONE = 4, // hp10,地玉石增加的固定值,equipAttr加起来 + JEWEL_BASE = 5, // hp15, 天晶基础属性(dic_zyz_jewel的rareEffectBaseAttr) END } diff --git a/shared/pubUtils/dictionary/DicJewel.ts b/shared/pubUtils/dictionary/DicJewel.ts index 41b021eb3..59519119f 100644 --- a/shared/pubUtils/dictionary/DicJewel.ts +++ b/shared/pubUtils/dictionary/DicJewel.ts @@ -1,5 +1,5 @@ // 天晶石表 -import { readFileAndParse, parseGoodStr, parseNumberList } from '../util' +import { readFileAndParse, parseGoodStr, parseNumberList, decodeArrayListStr } from '../util' import { FILENAME } from '../../consts'; import { RewardInter } from '../interface'; @@ -22,6 +22,8 @@ export interface DicJewel { readonly randomEffect: number[]; // 稀有属性 readonly rareEffect: number[]; + // 基础属性 + readonly rareEffectBaseAttr: {id: number, num: number}[]; // 对应藏宝图id readonly mapGoodId: number; // 淬炼消耗 @@ -43,8 +45,10 @@ export function loadJewel() { arr.forEach(o => { o.randomEffect = parseNumberList(o.randomEffect); o.rareEffect = parseNumberList(o.rareEffect); + o.rareEffectBaseAttr = parseAttr(o.rareEffectBaseAttr); o.quenchConsume = parseGoodStr(o.quenchConsume); o.inheritConsume = parseGoodStr(o.inheritConsume); + dicJewel.set(o.good_id, o); dicBlueprt.set(o.mapGoodId, o.good_id); if(!dicBlueprtByLv.has(o.lv)) { @@ -53,4 +57,17 @@ export function loadJewel() { dicBlueprtByLv.get(o.lv).push(o.mapGoodId); }); arr = undefined; +} + +function parseAttr(str: string) { + let result = new Array<{id: number, num: number}>(); + if(!str) return result; + let decodeArr = decodeArrayListStr(str); + for(let [id, num] of decodeArr) { + if(isNaN(parseInt(id)) || isNaN(parseInt(num))) { + throw new Error('data table format wrong'); + } + result.push({id: parseInt(id), num: parseInt(num)}); + } + return result } \ No newline at end of file