Question: how to randomly draw a type of card from a deck

Hey all,

I have a question concerning card game mechanics, one that I have been dealing with for a few days to no good effect. Here’s what I am trying to do:

I have a deck of cards that has a few different types of cards in it (buildings, advancements, leaders, etc.). There are multiple cards of each type in the same deck (i.e. there are 10 buildings, 10 advancements, 10 leaders). At the beginning of the game, every player (based on the side they choose) gets to draw at random a specific type of card from the deck and put it in play for free. For example, Player A gets to put a ‘building’ card in play for free, whereas Player B gets to put an ‘advancement’ card in play for free. Both of these card types are in the same deck. Is there a way to create an action button that randomly draws one of these types of cards from the main deck? It doesn’t have to go into the player’s hand, if that adds additional complexity.

I imagine I will have to set a global property identifying advancements, buildings, etc., however I’m not sure how to create an action button to perform this…action.

Does this make sense? I hope so. Thanks for any and all help you can give. I have looked through the forums extensively and couldn’t find an answer to this question anywhere else.

Thanks again!

Give your cards a marker for the type of card they are. For example

CardType = Building
CardType = Leaders

Each card would also have a Send to Location trait with the location it’s being sent to defined.

Then use a Global Key Command to send the Send to Location trigger to…

CurrentMap = (map the deck is on) && DeckName = (name of deck) && CardType = Building

If the deck is set to always shuffle, this should draw a random Building card.

Thanks for the quick feedback. I’ve implemented what you said, however it isn’t doing anything. I’ve added 4 traits to the card itself (marker – Card Type = Building, Send to Location – Building, Global Key Command – Building and Trigger Action – Building) and I made a Global Key Command in the Module pane for the action- any thoughts?

Well, I figured out that the trigger itself works, but the button on the module’s main window doesn’t work. What gives?

Ok, so I got the command to work, however I have one last problem: when I trigger the global action, ALL building cards in the deck are drawn. Is there a way to prevent this?

Your global action should have a setting for “Within a deck, apply to”

You probably have it set for all pieces. Change that to “fixed number of pieces” = 1

I tried setting it to one first, however that command only applies the GKC to the first card in the deck. Since the deck is mixed, the “1” setting doesn’t always work (as there isn’t always a building card on top). Any other ideas? Thanks again for your help!!

Yeah, I forgot that. I’ll probably bring that up in the Requested Features forum. If you’re specifically addressing a marker in the filter, it should find the first card with that marker. But rather, it always addresses the first card in the deck and if that card doesn’t have that marker, it doesn’t work.

What you’ll probably need to do is create a phantom deck and add some Return to Deck traits in a prototype for the cards. Here’s how it would work.

Let’s say your cards are in a deck called CardDeck1. You can create a second deck called CardDeck2. This deck would be empty and you can put it on a hidden window if you want.

In a prototype for the cards, you can add the following:

Return to Deck
Keyboard command - ALT 2
Send to CardDeck2

Return to Deck
Keyboard command - ALT 4
Send to CardDeck1

I’m going to assume you’re using a button to do this so here’s the traits you would use to accomplish this.

Action Button
Fires a CTRL 1

Trigger Action
Triggered on CTRL 1
Fires CTRL 2, CTRL 3, CTRL 4

Global Key Command
Triggered on CTRL 2
Fires ALT 2
CurrentMap = (map name) && DeckName = CardDeck1 && CardType = Buildings
Apply to all pieces

(this will move all the Buildings cards to CardDeck2

Global Key Command
Triggered on CTRL 3
Gets a single card from CardDeck2 just like you’ve been doing

Global Key Command
Triggered on CTRL 4
Fires ALT 4
CurrentMap = (map name) && DeckName = CardDeck2
Apply to all pieces

(this will send all the Buildings cards back to CardDeck1

Basically, you’re temporarily weeding out a set of cards with the same Marker so that you can get one and them sending them back to the original deck.

Hope that makes sense.

As an alternate idea, what about the following, since this is done at the start of the game.

Begin the game with three decks, one for each type of card. The player can then draw from the appropriate deck. After this free draw, but all the cards into a single deck where you will get a random choice.

That would actually be a better choice. I wasn’t aware that this only needed to be done at the beginning of the game. I thought it was something that would occur at various times. That would work just fine.

I think too that the tar’s solution is fine … and well designed for setup the game.

If you need to do it several times a single “temporary deck” can be used.

a) You have your maker trait MyCardType = Type 1, Type 2 or … on each card

b) You send all cards wanted to the temporary deck with the “Within a deck, apply to ALL” and MyCardType= parameters

c) the temporary deck is automatically reshuffled to provide random drawing … with a full set of a single MyCardType value at the same time

d) Then GKC “Return to deck” with the number wanted "Within a deck, apply to " from the temporary deck to the working final deck … and then return to deck to all remaining cards from the temporary deck … to and initial deck or discard or delete trait for example.

Excellent solutions guys. I did the solution put forward by DrNostromo this weekend and it worked like a charm! Thanks again for your help!