官术网_书友最值得收藏!

Drawing cards

Before drawing the cards, we will need to add two properties to the app state in the state.js file:

var state = {
// ...
drawPile: pile,
discardPile: {},
}

The drawPile property is the pile of cards that can be drawn by the players. It is initialized with the pile object defined in the cards.js file. Each key is the ID of a card definition, and the value is the amount of cards of this type in the pile.

The discardPile property is the equivalent of the drawPile property, but it serves a different purpose--all the cards played by the player will be removed from their hand and put into the discard pile. At some point, if the draw pile is empty, it will be refilled with the discard pile (which will be emptied).

主站蜘蛛池模板: 新蔡县| 关岭| 耒阳市| 辽宁省| 石阡县| 阳山县| 唐山市| 临武县| 丰都县| 台中县| 深州市| 周至县| 大宁县| 左权县| 五原县| 鄂托克前旗| 东光县| 繁峙县| 米林县| 萍乡市| 尉犁县| 安丘市| 桦甸市| 苏尼特右旗| 利辛县| 镇巴县| 宝丰县| 邢台县| 平利县| 仁寿县| 肇庆市| 长宁区| 温宿县| 宜章县| 隆尧县| 大竹县| 饶河县| 清水县| 安仁县| 庆城县| 于都县|