合成:修改消耗读取路径

This commit is contained in:
luying
2021-07-27 15:42:33 +08:00
parent 77ce47a35a
commit ff36c4b361

View File

@@ -23,7 +23,6 @@ export function checkMaterialEnough(consumes: Array<{ id: number, count: number
let jewelInfo = getJewelById(id);
if (!jewelInfo || !jewelInfo.count) //筛选出特殊材料特殊材料没有合成下一级需要的count数量
continue;
needConsumes.push({ id, count });//将该宝石加入消耗中
comJewelMap[id] = count + (comJewelMap[id] || 0);
for (let i = jewelInfo.lvLimited; i < gidJewelInfo.lvLimited; i++) {//当前消耗的宝石升级到目标宝石的消耗
if (((comJewelMap[id] || 0) % jewelInfo.count != 0)) {//jewelInfo的count表示宝石id合成下一级需要的数量
@@ -35,13 +34,15 @@ export function checkMaterialEnough(consumes: Array<{ id: number, count: number
}
comJewelMap[jewelInfo.nextJewelId] = comcount + (comJewelMap[jewelInfo.nextJewelId] || 0);//jewelInfo的nextJewelId表示宝石id合成下一级的宝石good_id
delete comJewelMap[id];
if (!!jewelInfo.specialCount)
needConsumes.push({ count: jewelInfo.specialCount * comcount, id: jewelInfo.nextSpecialId });//消耗中曾加合成下一级需要的特殊消耗物品的数量
for(let origin of gidJewelInfo.composeMaterial) {
needConsumes.push({ id: origin.id, count: origin.count * jewelCount });
}
id = jewelInfo.nextJewelId;
jewelInfo = getJewelById(jewelInfo.nextJewelId);
}
}
console.log('*******', JSON.stringify(needConsumes));
if (comJewelMap[jewel] != jewelCount || Object.keys(comJewelMap).length != 1)//检查最终是否可以合成目标宝石jewel以及对应的数量jewelCount
return false;
return needConsumes;