This commit is contained in:
aozhiwei 2022-09-21 20:31:02 +08:00
parent c615ca8581
commit c719940c55

View File

@ -120,18 +120,17 @@ class Fragment {
); );
}); });
console.log(items, remainHour, hour);
return;
for (let i = 0; i < num; ++i) { for (let i = 0; i < num; ++i) {
const ret = utils.randItemByWeight(items, 'item_num'); const ret = utils.randItemByWeight(items, 'item_num');
if (ret.index >= 0) { if (ret.index >= 0) {
if (items[ret.index]['item_num'] > 0) { if (items[ret.index]['item_num'] > 0) {
--items[ret.index]['item_num']; --items[ret.index]['item_num'];
const item = allocNode.get(element); const item = allocNode.get(ret.item.item_id);
if (item) { if (!item) {
item.set(element, 1); allocNode.set(ret.item.item_id, 1);
} else { } else {
item.set(element, item.get(element) + 1); allocNode.set(ret.item.item_id, allocNode.get(ret.item.item_id) + 1);
} }
} }
} }