diff --git a/game-server/app/services/equipService.ts b/game-server/app/services/equipService.ts index c8b987e3e..c834bda7d 100644 --- a/game-server/app/services/equipService.ts +++ b/game-server/app/services/equipService.ts @@ -162,7 +162,7 @@ export function checkEquipCanPut(hid: number, id: number) { let dicHero = gameData.hero.get(hid); let dicJob = gameData.job.get(dicHero.jobid); if(dicGood.jobLimited.indexOf(0) == -1 && dicGood.jobLimited.indexOf(dicJob.job_class) == -1) return false; - if(dicGood.charLimited.indexOf(0) == -1 && dicGood.charLimited.indexOf(hid) != -1) return false; + if(dicGood.charLimited.indexOf(0) == -1 && dicGood.charLimited.indexOf(hid) == -1) return false; return true } diff --git a/game-server/app/services/pvpService.ts b/game-server/app/services/pvpService.ts index bb8d83228..2dd4e5ae5 100644 --- a/game-server/app/services/pvpService.ts +++ b/game-server/app/services/pvpService.ts @@ -556,7 +556,7 @@ export function getPlayerAttribute(heroAttrs: CeAttrData[] = [], roleAttrs: CeAt export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAttrDataRole[]) { let newAttribute = new AttributeCal(); newAttribute.setByDbData(roleAttrs, heroAttrs); - let mainAttributes = newAttribute.getReduceMainAttributes(); + let mainAttributes = newAttribute.getReduceAttributes(); return mainAttributes; } diff --git a/shared/consts/constModules/itemConst.ts b/shared/consts/constModules/itemConst.ts index 683d48e9a..7a326a6f5 100644 --- a/shared/consts/constModules/itemConst.ts +++ b/shared/consts/constModules/itemConst.ts @@ -83,8 +83,8 @@ export enum JEWEL_TYPE { CLOTHES = 43, // 宝甲(上装) SHOES = 45, // 行具(下装) CAP = 44, // 冠冕(头部) - BOOK = 47, // 典籍(饰品) - ACCESSORY = 46, // 礼器(饰品) + BOOK = 46, // 典籍(饰品) + ACCESSORY = 47, // 礼器(饰品) } export const ITEM_TABLE = { diff --git a/shared/pubUtils/playerCe.ts b/shared/pubUtils/playerCe.ts index 35eecc803..78642d103 100644 --- a/shared/pubUtils/playerCe.ts +++ b/shared/pubUtils/playerCe.ts @@ -173,10 +173,10 @@ export function calPlayerCe(hero: HeroType, update: HeroUpdate, type: number, ar heroAttrs = calRestrengthenIncAttr(hero, args.shift(), args, addSeidList, removeSeidList); break; case HERO_SYSTEM_TYPE.JEWEL_ON: - heroAttrs = calHeroCeWhenJewelOn(hero, args[0], args[1]); + heroAttrs = calHeroCeWhenJewelOnOrOff(hero, args[0], args[1]); break; case HERO_SYSTEM_TYPE.JEWEL_OFF: - heroAttrs = calHeroCeWhenJewelOff(hero, args); + heroAttrs = calHeroCeWhenJewelOnOrOff(hero, 0, args[0]); break; case HERO_SYSTEM_TYPE.SCROLL: heroAttrs = calHeroCeScrollIncAttr(hero, update); @@ -756,7 +756,7 @@ export function calHeroEquipIncAttr(hero: HeroType) { if (g) { let jGoods = g.goodsAbility; jGoods.forEach((value, key) => { - if (jewel.has(key)) { + if (!jewel.has(key)) { jewel.set(key, value); } else { jewel.set(key, jewel.get(key) + value); @@ -898,47 +898,28 @@ function addSeid(effectList: Array, seidId: number, rand: number, seidValue * @param {number} id 带上的宝石 * @param {number} oldId 脱下的宝石 */ -function calHeroCeWhenJewelOn(hero: HeroType, id: number, oldId: number) { +function calHeroCeWhenJewelOnOrOff(hero: HeroType, id: number, oldId: number) { let { attr: heroAttrs } = hero; - let goodInfo = gameData.goods.get(id); - let oldGoodInfo = gameData.goods.get(oldId); + let { goodsAbility } = gameData.goods.get(id)||{ goodsAbility: new Map() }; + let { goodsAbility: oldGoodsAbility } = gameData.goods.get(oldId)||{ goodsAbility: new Map() }; - if(goodInfo) { - let jGoods = goodInfo.goodsAbility; - jGoods.forEach((value, key) => { - let equipUp = value; - if(oldGoodInfo && oldGoodInfo.goodsAbility) { - equipUp -= oldGoodInfo.goodsAbility.get(key); - } - updateHeroAttr(heroAttrs, key, { set: { equipUp } }) - }); + let allIds: number[] = []; + for(let [ id ] of goodsAbility) { + allIds.push(id); + } + for(let [ id ] of oldGoodsAbility) { + if(allIds.indexOf(id) == -1) allIds.push(id); + } + for(let id of allIds) { + let value = goodsAbility.get(id)||0; + let oldValue = oldGoodsAbility.get(id)||0; + updateHeroAttr(heroAttrs, id, { inc: { equipUp: value - oldValue } }) } hero.attr = heroAttrs; return heroAttrs; } -/** - * 脱下宝石 - * @param {HeroType} hero 武将数据 - * @param {number[]} ids 脱下的宝石 - */ -function calHeroCeWhenJewelOff(hero: HeroType, ids: Array) { - let { attr: heroAttrs } = hero; - for (let id of ids) { - let goodInfo = gameData.goods.get(id); - if(goodInfo) { - let jGoods = goodInfo.goodsAbility; - jGoods.forEach((value, key) => { - let equipUp = -1 * value; - updateHeroAttr(heroAttrs, key, { set: { equipUp } }) - }); - } - } - hero.attr = heroAttrs; - return heroAttrs; -} - /** * 全局加成,百家学宫 * @param role 角色