diff --git a/app/core/matter/mini-game.ts b/app/core/matter/mini-game.ts index 4af3b071b5..c63a3ef671 100644 --- a/app/core/matter/mini-game.ts +++ b/app/core/matter/mini-game.ts @@ -353,6 +353,7 @@ export class MiniGame { if (specialGameRule === SpecialGameRule.SYNERGY_WHEEL) { itemsSet = SynergyStones + maxCopiesPerItem = 4 } if (specialGameRule === SpecialGameRule.KECLEONS_SHOP) { @@ -362,11 +363,14 @@ export class MiniGame { } for (let j = 0; j < nbItemsToPick; j++) { - let item, count + let item, + count, + tries = 0 do { item = pickRandomIn(itemsSet) count = items.filter((i) => i === item).length - } while (count >= maxCopiesPerItem) + tries++ + } while (count >= maxCopiesPerItem && tries < 10) items.push(item) } return items