I'm implementing a 4-player deck builder, where each player has its own deck/discard pile.
There will be a lot of cards that trigger a reshuffle from a discard pile to a deck (e.g. draw 3 from a deck with < 3 cards). This is why I would like to use the "autoreshuffle" function of a php Deck. But even with the 'autoreshuffle_cusom' config, it seems that functionality is limited to shuffling 1 source to 1 destination.
Currently I see two solutions for this problem.
Approach 1
Make 4 decks, 1 for each player, each with their own deck/discard pile and autoshuffle.
The downside of this approach is that moving the cards between players will require moving the cards between different Deck instances (so also different tables in the db).
Approach 2
Make a single Deck for all the cards in the game, with a deck and discard pile location for each player ('deck'+$playerid and 'discard'+$playerid, e.g. 'deck101', 'discard101', ..., 'deck104', 'discard104').
The downside of this approach is that I need to implement my own autoreshuffle function.
Both seem reasonable to me, but I would love to hear some thoughts (or new idea's) on this before I commit to a decision.
(Also, is the source code or a more descriptive documentation of a php 'Deck' available? I would like to see when/how autoreshuffle_trigger callback function is called for example.)
There will be a lot of cards that trigger a reshuffle from a discard pile to a deck (e.g. draw 3 from a deck with < 3 cards). This is why I would like to use the "autoreshuffle" function of a php Deck. But even with the 'autoreshuffle_cusom' config, it seems that functionality is limited to shuffling 1 source to 1 destination.
Code: Select all
$this->cards->autoreshuffle_custom = array('deck' => 'discard');Approach 1
Make 4 decks, 1 for each player, each with their own deck/discard pile and autoshuffle.
The downside of this approach is that moving the cards between players will require moving the cards between different Deck instances (so also different tables in the db).
Approach 2
Make a single Deck for all the cards in the game, with a deck and discard pile location for each player ('deck'+$playerid and 'discard'+$playerid, e.g. 'deck101', 'discard101', ..., 'deck104', 'discard104').
The downside of this approach is that I need to implement my own autoreshuffle function.
Both seem reasonable to me, but I would love to hear some thoughts (or new idea's) on this before I commit to a decision.
(Also, is the source code or a more descriptive documentation of a php 'Deck' available? I would like to see when/how autoreshuffle_trigger callback function is called for example.)