app/Game/GameBoard.php: in regenerate() generate 1 or 0 jackpot cards per board.
This commit is contained in:
parent
020645dbca
commit
862abe00a1
1 changed files with 3 additions and 1 deletions
|
|
@ -76,8 +76,10 @@ class GameBoard
|
||||||
*/
|
*/
|
||||||
public function regenerate(GameSettings $settings): self
|
public function regenerate(GameSettings $settings): self
|
||||||
{
|
{
|
||||||
|
$num_jackpot = (\rand() % 2);
|
||||||
|
|
||||||
$num_cards = $this->getSize();
|
$num_cards = $this->getSize();
|
||||||
$cards = Card::getBySettings($settings, $num_cards);
|
$cards = Card::getBySettings($settings, $num_cards, $num_jackpot);
|
||||||
|
|
||||||
if (count($cards) < $num_cards) {
|
if (count($cards) < $num_cards) {
|
||||||
$message = sprintf("Impossible to generate cards: requested %d but only %d returned", $num_cards, count($cards));
|
$message = sprintf("Impossible to generate cards: requested %d but only %d returned", $num_cards, count($cards));
|
||||||
|
|
|
||||||
Reference in a new issue