Create use effect command #419

Open
Vylpes wants to merge 26 commits from feature/380-use-effect into develop
Showing only changes of commit 0092d91ee6 - Show all commits

View file

@ -97,6 +97,8 @@ export default class CardDropHelperMetadata {
.filter(x => x.type == rarity)
.filter(x => !claimedCards.find(y => y.CardNumber == x.id));
if (!allCards) return undefined;
const randomCardIndex = Math.floor(Math.random() * allCards.length);
Vylpes marked this conversation as resolved Outdated

The variable 'card' can be undefined if 'allCards' is empty. Add a check to ensure 'allCards' is not empty before accessing an element by index.

- const card = allCards[randomCardIndex];
+ if (allCards.length === 0) return undefined;
The variable 'card' can be undefined if 'allCards' is empty. Add a check to ensure 'allCards' is not empty before accessing an element by index. ```diff - const card = allCards[randomCardIndex]; + if (allCards.length === 0) return undefined; ```
const card = allCards[randomCardIndex];