Results 1 to 3 of 3

Thread: Complicated deck set-up

  1. #1

    Complicated deck set-up

    I am trying to script my port of Sherlock Holmes The Card Game so it does the set up automatically for the first round and then in subsequent rounds. I have the script getting the number of players from the active seated players. All decks autoshuffle on load. Depending on the number of players, it then has to take x cards from the Draw Deck - 16 for 3 players, 22 for 4 players, 28 for 5 players, 34 for 6 players, 40 for 7 players, or 46 for 8 players. It then has to take one card from the Villain deck and The Game Is Afoot card from the Game Is Afoot deck, shuffle and deal these cards to the seated players. Then it has to take the other three villains and shuffle them into the remaining deck and leave this on the Draw Deck zone, which is probably the easier thing to do as it would just need to take all cards from villainsZone and add it onto the deckZone, then shuffle. I thought of using the deck.cut function to cut the specific number of cards, then tell it to place them on the Discard Zone to add one card from the other two decks, shuffle and deal. However, I am not 100% sure how to tell it to cut the card numbers needed depending on the number of players. Maybe there is an easier way than using the deck.cut function?

  2. #2
    Join Date
    Sep 2017
    Posts
    397
    Deck.cut takes a parameter to specify how many cards to cut. Make a table like this:
    Code:
    local cardCountByPlayerCount = {0, 0, 16, 22, 28, 34, 40, 46 } -- waste two spaces so you don't have to do arithmetic on the index 
    local deckParts = sourceDeck.cut(cardCountByPlayerCount[#getSeatedPlayers()])
      -- now deckParts [1] will be the deck you use, and deckParts[2] will be the remaining deck, if I remember correctly.
    Tabletop just stacks the decks at right angles, so you will want to move the part you're using somewhere else before adding the additional cards to each new deck.

  3. #3
    Quote Originally Posted by cche View Post
    [/code]
    Tabletop just stacks the decks at right angles, so you will want to move the part you're using somewhere else before adding the additional cards to each new deck.
    Thanks for that, yes, I was thinking of moving the cut deck onto the discard pile to prep and deal out since all cards will be dealt.

Similar Threads

  1. [SUPPORT] Resetting card deck with grouped cards or exhausted deck
    By Melds in forum Technical Support
    Replies: 0
    Last Post: 05-18-2020, 03:10 PM
  2. Less Complicated Way to insert new XML
    By berserk3k in forum Scripting
    Replies: 2
    Last Post: 08-05-2018, 04:37 PM
  3. Replies: 1
    Last Post: 11-10-2016, 07:05 PM
  4. Replies: 2
    Last Post: 07-07-2016, 05:15 PM
  5. Replies: 3
    Last Post: 06-02-2015, 07:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •