VASSAL Reference Manual
Deck
A Deck functions like a deck of playing cards, but can also be used to hold a supply of other types of Game Piece, such as a fixed supply of counters or a "bag of chits" to be randomly drawn from. Each game begins with the contents of the Deck as specified in the Configuration window. During a game, players may remove cards from the deck by dragging them from the top of the deck with the mouse. This removes a card from the Deck and assigns ownership to the dragging player. Dragging a card onto the deck adds it back to the Deck.
The number of cards or pieces in the deck is exposed as a Map-level Property with the name <name>_numPieces.
The number of card or piece types in the deck can be exposed as a Map-level Property with the name <name><type>_ (see Perform Counting of Piece Types below).
Decks can be added to Maps, and also to Player Hands and Private Windows, each of which is simply a specialized type of Map. To add a Deck, navigate to the [Map], [Player Hand], or [Private Window] component entry in the Editor configuration window for the Map (or specialized map) you wish to add the Deck to. Right-click on that component and select Add Deck from the menu. After you have configured your Deck and clicked the OK button, your new [Deck] component will appear at the bottom of the map’s list of Sub-Components. You can then right-click on the [Deck] entry and begin adding Cards and other Deck Sub-Components.
Note
|
Because Decks are quite often used to hold "cards", the Game Pieces contained within a Deck will be frequently referred to in Vassal and in documentation as "cards". However, keep in mind that a "card" is simply a type of Game Piece, and a Deck can be used to contain any type of Game Piece. The difference between a "card" and a "piece" is only notional, and perhaps represented in the artwork and function of the piece/card. |
EXAMPLE: An ordinary deck of playing cards for, say, Crazy Eights would be set to: Allow Multiple = false, Allow Specific = false, Face Down = Always, Re-shuffle = Always, Reversible = false. The discard pile would be: Allow Multiple = false, Allow Specific = false, Face Down = Never, Re-shuffle = Never, Reversible = false.
A Deck may contain any kind of Game Piece, so it can also be used for draw piles of chits or counters that are drawn randomly and whose total number are limited by the game. If the pieces/cards do not need to be selected randomly, and you simply wish to provide a pile of them on the board at game start, consider an At-Start Stack.
EXAMPLE: A strategic game in which a nationality has a fixed force pool of variable-strength Infantry, Armor, etc. counters can be modeled by making a Map Window representing the force pool, with a Deck of Infantry counters, a Deck of Armor counters, etc. The decks would be set to Allow Multiple = false, Allow Specific = false, Face Down = Never, Re-shuffle = Never, Reversible = false. In order to guarantee that the number of each type of counter is fixed, any Clone and Delete traits of the Infantry and Armor counters should be removed.
EXAMPLE: You want to create a deck of playing cards and display the number of red cards, the number of black cards, the number of face cards, and the total number of cards in the deck. Create the Deck, check Perform counting of expressions. Add the expressions of red: color = red and black: color = black. Also add the expression facecards: value > 10. When creating your cards, give them a Marker trait named color with the values of red or black depending on the card. Also give your cards a Marker trait named value with the numeric value of the card. Then, you can refer to the counts with the map-level properties of <deckname>_red, <deckname>_black, and <deckname>_facecards. The total number of cards currently in the deck can be referenced by the map-level property of <deckname>_numPieces.
|
|
Sub-Components
Sub-Components can be added to a Deck by right-clicking on the [Deck] entry in the Module Editor and selecting the appropriate Add option.
CardA Card is identical to a Game Piece, but is initialized with a Mask trait appropriate for a playing card. Deck Global Key CommandGlobal Key Commands can be added to a Deck and will appear in the right-click context menu of the Deck. The resulting Global Key Command will be applied only to pieces contained in the Deck. Deck Send Key CommandA Deck Send Key Command adds a command to the right-click context menu of the Deck that provides extended options for sending cards in this Deck to another Deck. Deck Sort Key CommandA Deck Sort Key Commands adds a command to the right-click context menu of the Deck that allows the Deck to be sorted based on the values of properties on the contained cards. |