战力:修复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

View File

@@ -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
}

View File

@@ -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;
}

View File

@@ -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 = {

View File

@@ -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<any>, 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<number, number>() };
let { goodsAbility: oldGoodsAbility } = gameData.goods.get(oldId)||{ goodsAbility: new Map<number, number>() };
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<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 角色