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