config->get('world.map.barbarians.growth.every_hours', 8); return max(1, (int) round($hours * 3600 / $this->config->speed())); } /** * Which building grows next, or null when all of them reached the cap. * * @param list $buildings * @param float $random uniform in [0, 1) */ public function pick(array $buildings, float $random): ?BuildingState { $cap = $this->config->get('world.map.barbarians.growth.max_level', 10); $open = array_values(array_filter($buildings, fn (BuildingState $b) => $b->level < $cap)); return $open ? $open[(int) floor($random * count($open))] : null; } }