装备:镶嵌或卸载地玉石
This commit is contained in:
@@ -180,6 +180,9 @@ export async function calPlayerCe(hero: HeroType, update: HeroUpdate, type: numb
|
||||
case HERO_SYSTEM_TYPE.EQUIP_JEWEL:
|
||||
heroAttrs = await calEquipPutOnOrOffJewelIncAttr(hero, update, args, addSeidList, removeSeidList);
|
||||
break;
|
||||
case HERO_SYSTEM_TYPE.EQUIP_STONE:
|
||||
heroAttrs = await calEquipPutOnOrOffStoneIncAttr(hero, update, args, addSeidList, removeSeidList);
|
||||
break;
|
||||
case HERO_SYSTEM_TYPE.EQUIP: //
|
||||
heroAttrs = calEquipPutOnOffIncAttr(hero, args, addSeidList, removeSeidList);
|
||||
break;
|
||||
@@ -753,6 +756,32 @@ function isRandSeUnLock(jewelId: number, randSeId: number, stones: Stone[]) {
|
||||
return stoneCnt >= dicJewelCondition.stoneCnt && stoneLv >= dicJewelCondition.stoneLv;
|
||||
}
|
||||
|
||||
export async function calEquipPutOnOrOffStoneIncAttr(hero: HeroType, update: HeroUpdate, eplaceIds: number[], addSeidList: number[], removeSeidList: number[]) {
|
||||
let { attr: heroAttrs, ePlace: oldEplace } = hero;
|
||||
let { ePlace: newEplace } = update;
|
||||
for(let eplaceId of eplaceIds) {
|
||||
let oldEquip = oldEplace.find(cur => cur.id == eplaceId);
|
||||
updateHeroAttrOfStone(heroAttrs, oldEquip, -1);
|
||||
await setRandSeToSeidList(oldEquip, removeSeidList);
|
||||
let newEquip = newEplace.find(cur => cur.id == eplaceId);
|
||||
updateHeroAttrOfStone(heroAttrs, newEquip, 1);
|
||||
await setRandSeToSeidList(newEquip, addSeidList); // 地玉石阶数变化可能导致属性词条解锁变化
|
||||
}
|
||||
return heroAttrs;
|
||||
}
|
||||
|
||||
function updateHeroAttrOfStone(heroAttrs: CeAttrData[], equip: EPlace, ratio: number) {
|
||||
for(let { stone } of equip.stones) {
|
||||
let dicStone = gameData.stone.get(stone);
|
||||
if(dicStone) {
|
||||
for(let attr of dicStone.attribute) {
|
||||
updateHeroAttr(heroAttrs, attr.id, { inc: { fixUp: ratio * attr.num * HERO_CE_RATIO } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 穿脱, removeSeidList原来身上穿着的所有装备的seid,包括套装的
|
||||
* @param {HeroType} hero 武将
|
||||
|
||||
Reference in New Issue
Block a user