diff --git a/core/src/com/unciv/models/ruleset/ModOptions.kt b/core/src/com/unciv/models/ruleset/ModOptions.kt index 334ca09bf8..34488670b2 100644 --- a/core/src/com/unciv/models/ruleset/ModOptions.kt +++ b/core/src/com/unciv/models/ruleset/ModOptions.kt @@ -14,6 +14,7 @@ class ModOptions : IHasUniques { var unitsToRemove = HashSet() var nationsToRemove = HashSet() var policyBranchesToRemove = HashSet() + var policiesToRemove = HashSet() val constants = ModConstants() var unitset: String? = null var tileset: String? = null diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index f5b3a89ce5..aabed11965 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -211,6 +211,22 @@ class Ruleset { } policyBranches.putAll(ruleset.policyBranches) policies.putAll(ruleset.policies) + + // Remove the policies + ruleset.modOptions.policiesToRemove + .flatMap { policyToRemove -> + policies.filter { it.value.matchesFilter(policyToRemove) }.keys + }.toSet().forEach { + policies.remove(it) + } + + // Remove the policies if they exist in the policy branches too + for (policyToRemove in ruleset.modOptions.policiesToRemove) { + for (branch in policyBranches.values) { + branch.policies.removeAll { it.matchesFilter(policyToRemove) } + } + } + quests.putAll(ruleset.quests) religions.addAll(ruleset.religions) ruinRewards.putAll(ruleset.ruinRewards) diff --git a/docs/Modders/Mod-file-structure/5-Miscellaneous-JSON-files.md b/docs/Modders/Mod-file-structure/5-Miscellaneous-JSON-files.md index 48b77bda06..9bf0da1a70 100644 --- a/docs/Modders/Mod-file-structure/5-Miscellaneous-JSON-files.md +++ b/docs/Modders/Mod-file-structure/5-Miscellaneous-JSON-files.md @@ -174,6 +174,7 @@ The file can have the following attributes, not including the values Unciv sets | unitsToRemove | List | empty | List of [Units](4-Unit-related-JSON-files.md#unitsjson) or [unitFilter](../../Unique-parameters#baseunitfilter) to remove (isBaseRuleset=false only) | | nationsToRemove | List | empty | List of [Nations](2-Civilization-related-JSON-files.md#nationsjson) or [nationFilter](../../Unique-parameters#nationfilter) to remove (isBaseRuleset=false only) | | policyBranchesToRemove | List | empty | List of [Policy Branches](2-Civilization-related-JSON-files.md#policyjson) to remove (isBaseRuleset=false only) | +| policiesToRemove | List | empty | List of [Policies](2-Civilization-related-JSON-files.md#policiesjson) to remove (isBaseRuleset=false only) | | constants | Object | empty | See [ModConstants](#modconstants) | | tileset | String | empty | Only applicable for base rulesets | | unitset | String | empty | Only applicable for base rulesets |