getWidth(); $h = $map->getHeight(); for ($i = 0; $i < max(3, (int)floor(($w*$h)/50)); $i++) { $q = rand(0, max(0, $w-1)); $r = rand(0, max(0, $h-1)); if ($map->isValidCoordinate($q, $r)) { $map->setTile($q, $r, new Tile(['type' => 'forest'])); } } } public static function tileDefinitions(): array { return [ 'empty' => ['label' => 'Vide', 'walkable' => true], 'forest' => ['label' => 'Forêt', 'walkable' => false], 'field' => ['label' => 'Champ', 'walkable' => true] ]; } } }