战力:修复bug

This commit is contained in:
luying
2021-08-14 13:45:53 +08:00
parent 231da09528
commit b118eebaed
4 changed files with 21 additions and 40 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ export function checkEquipCanPut(hid: number, id: number) {
let dicHero = gameData.hero.get(hid); let dicHero = gameData.hero.get(hid);
let dicJob = gameData.job.get(dicHero.jobid); let dicJob = gameData.job.get(dicHero.jobid);
if(dicGood.jobLimited.indexOf(0) == -1 && dicGood.jobLimited.indexOf(dicJob.job_class) == -1) return false; 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 return true
} }
+1 -1
View File
@@ -556,7 +556,7 @@ export function getPlayerAttribute(heroAttrs: CeAttrData[] = [], roleAttrs: CeAt
export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAttrDataRole[]) { export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAttrDataRole[]) {
let newAttribute = new AttributeCal(); let newAttribute = new AttributeCal();
newAttribute.setByDbData(roleAttrs, heroAttrs); newAttribute.setByDbData(roleAttrs, heroAttrs);
let mainAttributes = newAttribute.getReduceMainAttributes(); let mainAttributes = newAttribute.getReduceAttributes();
return mainAttributes; return mainAttributes;
} }
+2 -2
View File
@@ -83,8 +83,8 @@ export enum JEWEL_TYPE {
CLOTHES = 43, // 宝甲(上装) CLOTHES = 43, // 宝甲(上装)
SHOES = 45, // 行具(下装) SHOES = 45, // 行具(下装)
CAP = 44, // 冠冕(头部) CAP = 44, // 冠冕(头部)
BOOK = 47, // 典籍(饰品) BOOK = 46, // 典籍(饰品)
ACCESSORY = 46, // 礼器(饰品) ACCESSORY = 47, // 礼器(饰品)
} }
export const ITEM_TABLE = { export const ITEM_TABLE = {
+17 -36
View File
@@ -173,10 +173,10 @@ export function calPlayerCe(hero: HeroType, update: HeroUpdate, type: number, ar
heroAttrs = calRestrengthenIncAttr(hero, args.shift(), args, addSeidList, removeSeidList); heroAttrs = calRestrengthenIncAttr(hero, args.shift(), args, addSeidList, removeSeidList);
break; break;
case HERO_SYSTEM_TYPE.JEWEL_ON: case HERO_SYSTEM_TYPE.JEWEL_ON:
heroAttrs = calHeroCeWhenJewelOn(hero, args[0], args[1]); heroAttrs = calHeroCeWhenJewelOnOrOff(hero, args[0], args[1]);
break; break;
case HERO_SYSTEM_TYPE.JEWEL_OFF: case HERO_SYSTEM_TYPE.JEWEL_OFF:
heroAttrs = calHeroCeWhenJewelOff(hero, args); heroAttrs = calHeroCeWhenJewelOnOrOff(hero, 0, args[0]);
break; break;
case HERO_SYSTEM_TYPE.SCROLL: case HERO_SYSTEM_TYPE.SCROLL:
heroAttrs = calHeroCeScrollIncAttr(hero, update); heroAttrs = calHeroCeScrollIncAttr(hero, update);
@@ -756,7 +756,7 @@ export function calHeroEquipIncAttr(hero: HeroType) {
if (g) { if (g) {
let jGoods = g.goodsAbility; let jGoods = g.goodsAbility;
jGoods.forEach((value, key) => { jGoods.forEach((value, key) => {
if (jewel.has(key)) { if (!jewel.has(key)) {
jewel.set(key, value); jewel.set(key, value);
} else { } else {
jewel.set(key, jewel.get(key) + value); jewel.set(key, jewel.get(key) + value);
@@ -898,47 +898,28 @@ function addSeid(effectList: Array<any>, seidId: number, rand: number, seidValue
* @param {number} id 带上的宝石 * @param {number} id 带上的宝石
* @param {number} oldId 脱下的宝石 * @param {number} oldId 脱下的宝石
*/ */
function calHeroCeWhenJewelOn(hero: HeroType, id: number, oldId: number) { function calHeroCeWhenJewelOnOrOff(hero: HeroType, id: number, oldId: number) {
let { attr: heroAttrs } = hero; let { attr: heroAttrs } = hero;
let goodInfo = gameData.goods.get(id); let { goodsAbility } = gameData.goods.get(id)||{ goodsAbility: new Map<number, number>() };
let oldGoodInfo = gameData.goods.get(oldId); let { goodsAbility: oldGoodsAbility } = gameData.goods.get(oldId)||{ goodsAbility: new Map<number, number>() };
if(goodInfo) { let allIds: number[] = [];
let jGoods = goodInfo.goodsAbility; for(let [ id ] of goodsAbility) {
jGoods.forEach((value, key) => { allIds.push(id);
let equipUp = value; }
if(oldGoodInfo && oldGoodInfo.goodsAbility) { for(let [ id ] of oldGoodsAbility) {
equipUp -= oldGoodInfo.goodsAbility.get(key); if(allIds.indexOf(id) == -1) allIds.push(id);
} }
updateHeroAttr(heroAttrs, key, { set: { equipUp } }) 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; hero.attr = heroAttrs;
return heroAttrs; return heroAttrs;
} }
/**
* 脱下宝石
* @param {HeroType} hero 武将数据
* @param {number[]} ids 脱下的宝石
*/
function calHeroCeWhenJewelOff(hero: HeroType, ids: Array<number>) {
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 角色 * @param role 角色