public function play() { trace($this->name . ' play'); $game = Game::getGame(); foreach ($game->players as $playerTmp) { if ($playerTmp->character instanceof static) { $this->player = $playerTmp; } } }
public function draw() { $game = Game::getGame(); if (array_key_exists(0, $game->districts)) { $this->hand[] = $game->districts[0]; unset($game->districts[0]); $game->districts = array_values($game->districts); trace($this->name . ' draw'); } else { die('Districts is empty'); } }
public function play() { parent::play(); # Devient le premier joueur $game = Game::getGame(); foreach ($game->players as $playerTmp) { $playerTmp->crown = false; if ($playerTmp->character instanceof self) { $player = $playerTmp; $playerTmp->crown = true; } } # Ses quartiers nobles raportent $this->districtGold($this->player); }
<html class="no-js" lang="fr-FR"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Citadelles</title> <meta name="description" content="Citadelles est un jeu de société créé en 2000 par Bruno Faidutti."> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> </head> <body> <div class="container"> <?php require 'vendor/autoload.php'; spl_autoload_register(function ($class) { include __DIR__ . '/classes/' . $class . '.php'; }); function d($v) { \utilphp\util::var_dump($v); } function trace($v) { echo $v . '<br/>'; } $game = Game::getGame(); $game->init(4); ?> </div> </body> </html>