Cannot deal cards to location

Game development with Board Game Arena Studio
Post Reply
User avatar
AmadanNaBriona
Posts: 43
Joined: 17 March 2018, 18:52

Cannot deal cards to location

Post 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.
vincentt
Posts: 247
Joined: 01 September 2017, 17:25

Re: Cannot deal cards to location

Post 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
User avatar
AmadanNaBriona
Posts: 43
Joined: 17 March 2018, 18:52

Re: Cannot deal cards to location

Post 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?
vincentt
Posts: 247
Joined: 01 September 2017, 17:25

Re: Cannot deal cards to location

Post by vincentt »

Yes, but maybe you have an issue on $doorcards

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

Vincent
User avatar
DrKarotte
Posts: 279
Joined: 22 September 2015, 23:42

Re: Cannot deal cards to location

Post by DrKarotte »

Why are you using createCards twice?
User avatar
AmadanNaBriona
Posts: 43
Joined: 17 March 2018, 18:52

Re: Cannot deal cards to location

Post 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?
User avatar
DrKarotte
Posts: 279
Joined: 22 September 2015, 23:42

Re: Cannot deal cards to location

Post 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.
Post Reply

Return to “Developers”