trucoshi 9.2.0 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,9 @@ export function Deck() {
6
6
  random: Random(),
7
7
  usedCards: [],
8
8
  takeCard() {
9
+ if (deck.cards.length <= 0) {
10
+ throw new Error("No cards left in deck");
11
+ }
9
12
  const card = deck.cards.shift();
10
13
  deck.usedCards.push(card);
11
14
  return card;
@@ -46,17 +49,12 @@ export function dealCards(table, deck) {
46
49
  }
47
50
  }
48
51
  if (cheat_cards) {
49
- try {
50
- const new_cards = JSON.parse(cheat_cards);
51
- deck.shuffle(players[0].idx);
52
- for (const [key, player] of players.entries()) {
53
- playerHands[player.idx] = new_cards[key]
54
- ? new_cards[key].map((c) => deck.pick(c) || deck.takeCard())
55
- : deck.takeThree();
56
- }
57
- }
58
- catch (_a) {
59
- //noop
52
+ const new_cards = JSON.parse(cheat_cards);
53
+ deck.shuffle(players[0].idx);
54
+ for (const [key, player] of players.entries()) {
55
+ playerHands[player.idx] = new_cards[key]
56
+ ? new_cards[key].map((c) => deck.pick(c) || deck.takeCard())
57
+ : deck.takeThree();
60
58
  }
61
59
  }
62
60
  if (cheat_lots_of_flowers) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trucoshi",
3
- "version": "9.2.0",
4
- "description": "Lightning Truco Server",
3
+ "version": "9.3.0",
4
+ "description": "Truco Game Server",
5
5
  "main": "dist/types.js",
6
6
  "license": "GPL-3.0",
7
7
  "author": "Fran <jfrader.com>",
@@ -77,7 +77,7 @@
77
77
  "dotenv-cli": "^7.3.0",
78
78
  "form-data": "^4.0.0",
79
79
  "jsonwebtoken": "^9.0.2",
80
- "lightning-accounts": "6.1.2",
80
+ "lightning-accounts": "6.2.1",
81
81
  "lodash.debounce": "^4.0.8",
82
82
  "lodash.memoize": "^4.1.2",
83
83
  "lodash.partialright": "^4.2.1",