Page 1 of 1

Cannot deal cards to location

Posted: 28 September 2018, 03:59
by AmadanNaBriona
One card is dealt (from a deck of four) to each player. Then 4 cards (from a separate deck) are dealt to the center display.

I have the first part working, but not the second.

In the game.php file:

Code: Select all

$door = $this->cards->pickCard( 'doordeck', $player_id );

$cards = $this->cards->pickCardsForLocation(4, 'deck', 'cluecarddisplay');
and:

Code: Select all

    protected function getAllDatas()
    {
        $result = array();

         ...		

        // The card in the player's hand      
        $result['hand'] = $this->cards->getCardsInLocation( 'hand', $current_player_id );
  
        // Cards played on the table
        $result['cardsontable'] = $this->cards->getCardsInLocation( 'cluecarddisplay' );
  
        return $result;
    }
however, when I inspect the result (by using console.log(this.gamedatas) in the js file), I see "hand" as a card (as it should be) but "cardsontable" is an empty array.

Re: Cannot deal cards to location

Posted: 28 September 2018, 11:04
by vincentt
Hi,

Try to analyse it through the database directly, I find it easier :)
Check that you have indeed a 'deck' location. It may come from that

Vincent

Re: Cannot deal cards to location

Posted: 28 September 2018, 20:28
by AmadanNaBriona
Okay, looking in the database, it looks like there is a 'doordeck' but not a 'deck' location in my 'cards' db.

Here is the code in the setupNewGame method of my game.php file:

Code: Select all

        $this->cards->createCards( $cluecards, 'deck' );      
        $this->cards->createCards( $doorcards, 'doordeck' );      
You are able to create multiple locations in one DB, right?

Re: Cannot deal cards to location

Posted: 28 September 2018, 20:31
by vincentt
Yes, but maybe you have an issue on $doorcards

Check that with debug info (http://en.doc.boardgamearena.com/Practical_debugging)

Vincent

Re: Cannot deal cards to location

Posted: 29 September 2018, 11:22
by DrKarotte
Why are you using createCards twice?

Re: Cannot deal cards to location

Posted: 01 October 2018, 01:09
by AmadanNaBriona
DrKarotte wrote:Why are you using createCards twice?

There are two different decks to deal from. How do I maintain two separate decks of cards in the same db?

Re: Cannot deal cards to location

Posted: 01 October 2018, 18:07
by DrKarotte
The docomentation of the deck component explains this, at "Create a new Deck component". You will need a database for each deck, which cannot share the same name. Having 2 decks probably is not recommended if there is any interaction between the decks.