Hello! I am trying to create a randomized card deck for my game, but have ran into the following problems:
1. I can’t use the same key in a table twice
2. when shuffling cards, the deck doesn’t get shuffled efficiently, and a lot of the same cards are next to each other
For my second problem I thought of using a filter list that would add a card to the list if it was just added to the deck so none of those types of cards would be added right after, and would be removed after the next card was added, but that would lead to my first problem of not being able to use the same key.
items = {
nuke = {
name = "Nuke";
imageId = nil;
amount = 6
};
defuser = {
name = "Defuser";
imageId = nil;
amount = 6
};
attack = {
name = "Attack";
imageId = nil;
amount = 4
};
steal = {
name = "Steal";
imageId = nil;
amount = 4
};
stop = {
name = "Stop";
imageId = nil;
amount = 5
};
shuffle_blocks = {
name = "Shuffle Blocks";
imageId = nil;
amount = 4
};
skip = {
name = "Skip";
imageId = nil;
amount = 4
};
see_the_future = {
name = "See the Furture";
imageId = nil;
amount = 5
};
}
I’d figured I would create a table of all the cards in my game and add properties to them. The amount represents the amount of those cards I’d like to add to the deck, but I am having trouble doing that since you can’t use the same key multiple times. Any help is appreciated!