Archived
1
0
Fork 0

app/Game/GameBoard.php: in regenerate() generate 1 or 0 jackpot cards per board.

This commit is contained in:
Henrik Hautakoski 2023-02-19 17:12:26 +01:00
parent 020645dbca
commit 862abe00a1

View file

@ -76,8 +76,10 @@ class GameBoard
*/
public function regenerate(GameSettings $settings): self
{
$num_jackpot = (\rand() % 2);
$num_cards = $this->getSize();
$cards = Card::getBySettings($settings, $num_cards);
$cards = Card::getBySettings($settings, $num_cards, $num_jackpot);
if (count($cards) < $num_cards) {
$message = sprintf("Impossible to generate cards: requested %d but only %d returned", $num_cards, count($cards));