"Shuffling" specific card into top 20 cards

Greetings, hivemind.

I’m just getting started with module design and while the basics are coming along just fine, I’m having issues with the more advanced stuff. My main concern right now is that I need a specific card to be among the first 20 to be drawn from a deck.

I know that Vassal doesn’t really shuffle cards, but the idea is to simulate this specific card being shuffled together with 19 other (random) cards and then placed with them on top of the rest of the deck. In a way it’s similar to what the COIN games do with propaganda cards.

Any tips and instructions would be most welcome.

You can steal everything you need from the Pax Porfiriana module (there are probably lots of other modules that do this, but it’s the one I know because I added it).

In particular, you want to look in the Game Piece Prototype definitions for the “DeckSetup” prototype, and then look at the mess of Global Key Commands in the Setup map window. The reason there are so many is that the deck construction varies according to the number of players, so you might well avoid that with your game if the rule is always the same.

Broadly speaking, this module has a deck with all the standard cards and then a deck with all the Topple cards (the ones that get shuffled into the top X number of cards). Then there is a hidden Shuffler deck, and the actual Draw Pile deck on the main map. Using Multi-Action Buttons to “sequence” a bunch of Global Key Commands, the module grabs X number of random standard cards, moves them to the temporary Shuffler deck, grabs 1 Topple card, moves it to the Shuffler deck, then sends that combined group en masse to the Draw Pile deck on the map. It repeats this over and over the requisite number of times. Pay particular attention to the Reshuffle setting of each deck–you want “Always” on your staging deck and shuffler deck, but “Never” on what ends up being the actual Draw Pile, to ensure the cards you’re mixing in at your intervals don’t come out when they shouldn’t.

Thanks a lot Joel, that really helps!