From 6be121f70d3b6d77aa51f673fbffd27590ba5c1c Mon Sep 17 00:00:00 2001 From: TheSaminator Date: Wed, 6 Jul 2022 10:40:57 -0400 Subject: [PATCH] Make high-degree nodes less likely to spread faction control per edge --- src/jvmMain/kotlin/net/starshipfights/campaign/cluster_gen.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jvmMain/kotlin/net/starshipfights/campaign/cluster_gen.kt b/src/jvmMain/kotlin/net/starshipfights/campaign/cluster_gen.kt index e7fd3a3..6d63579 100644 --- a/src/jvmMain/kotlin/net/starshipfights/campaign/cluster_gen.kt +++ b/src/jvmMain/kotlin/net/starshipfights/campaign/cluster_gen.kt @@ -367,6 +367,7 @@ class ClusterGenerator(val settings: ClusterGenerationSettings) { borderingSystems += lane.systemA } + val degree = borderingSystems.size borderingSystems.retainAll(uncontrolledSystems) for (borderId in borderingSystems) { @@ -374,7 +375,7 @@ class ClusterGenerator(val settings: ClusterGenerationSettings) { uncontrolledSystems -= borderId - if (Random.nextDouble() < settings.contention.controlSpreadChance) + if (Random.nextDouble() < settings.contention.controlSpreadChance / degree) systemControllers[borderId] = systemControllers.getValue(systemId).let { faction -> if (Random.nextBoolean()) faction -- 2.25.1