config->get('world.map.barbarians.waves.enabled', false); } /** Seconds until the next wave, from a roll in [0, 1): every_days drawn evenly, at world speed. */ public function interval(float $roll): int { [$min, $max] = $this->config->get('world.map.barbarians.waves.every_days', [7, 7]) + [7, 7]; return max(1, (int) round(($min + ($max - $min) * $roll) * 86400 / $this->config->speed())); } /** * New villages for one player in a wave, from a roll in [0, 1): the whole part of * per_player always, one more with the fractional part as its chance. */ public function perPlayer(float $roll): int { $average = max(0.0, (float) $this->config->get('world.map.barbarians.waves.per_player', 0)); return (int) floor($average) + ($roll < $average - floor($average) ? 1 : 0); } /** At most this many fields from the player's village they settle. */ public function near(): float { return (float) $this->config->get('world.map.barbarians.waves.near', 8); } }