﻿# group = this is the law_group a law belongs to
# icon = graphical icon shown in-game
# modifier = {} modifier on country for having adopted this law

law_chiefdom = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/chiefdom.dds"
	
	progressiveness = -100
	
	can_enact = {
		is_country_type = decentralized
	}
	
	is_visible = {
		is_country_type = decentralized
	}
	
	modifier = {
		country_legitimacy_headofstate_add = 20
		country_authority_add = 100
	}
	
	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
}

law_monarchy = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/monarchy.dds"
	
	progressiveness = 0

	disallowing_laws = {
		law_anarchy
	}

	can_enact = {
		NOT = { has_government_type = gov_chartered_company }
	}	

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_governance_principles_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}

	modifier = {
		country_legitimacy_headofstate_add = 20
		country_authority_add = 200
	}
	
	ai_will_do = {
		exists = ruler
		ruler = {
			has_monarchist_ideology = yes
		}
	}

	on_activate = {
		if = {
			limit = {
				c:FRA ?= this
				NOT = {
					has_variable = one_true_french_dynasty
				}
				has_dlc_feature = voice_of_the_people_content
				game_date > 1836.1.1
			}
			if = {
				limit = {
					has_variable = fra_divided_monarchists_freeze
				}
				remove_variable = fra_divided_monarchists_freeze
			}
			add_journal_entry = { type = je_divided_monarchists }
		}
		# Generates French monarch upon enaction.
		hidden_effect = {
			if = {
				limit = {
					c:FRA ?= this
					NOT = {
						has_variable = one_true_french_dynasty
					}
					has_dlc_feature = voice_of_the_people_content
					game_date > 1836.1.1
					NOR = {
						ruler_is_bonapartist = yes
						ruler_is_orleanist = yes
						ruler_is_legitimist = yes
					}
				}
				fra_handle_republic_monarch_assignment = yes
			}
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_monarchy
				has_strategy = ai_strategy_reactionary_agenda
				power_bloc ?= { has_identity = identity:identity_ideological_union }
				scope:target_country = { # Is their law different enough from what we want to impose?
					NOT = { has_law = law_type:law_theocracy }
				}				
			}
			
			add = base_impose_law_weight	
			if = {
				limit = { 
					scope:target_country = { has_law = law_type:council_republic } 
					NOT = { has_strategy = ai_strategy_egalitarian_agenda }
				}
				multiply = 5
			}	
			else = {
				multiply = 0.5 # AI is less likely to mess with governance principles unless dealing with council republics
			}
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}

law_presidential_republic = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/presidential_republic.dds"
	
	progressiveness = 100
	
	unlocking_technologies = {
		democracy
	}

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_governance_principles_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}
	
	modifier = {
		country_legitimacy_headofstate_add = 10
		country_legitimacy_govt_total_votes_add = 10
		country_legitimacy_ideological_incoherence_mult = -0.2
		country_authority_add = 100
		country_bureaucracy_investment_cost_factor_mult = -0.1
	}

	on_activate = {
		if = {
			limit = {
				has_variable = fra_republic_counter
			}
			change_variable = {
				name = fra_republic_counter
				add = 1
			}
		}
		if = {
			limit = {
				NOT = {
					c:BIC ?= this
				}
				any_interest_group = {
					has_ideology = ideology:ideology_constitutionalist
				}
			}
			every_interest_group = {
				limit = {
					has_ideology = ideology:ideology_constitutionalist
				}
				remove_ideology = ideology_constitutionalist
				add_ideology = ideology_republican
			}
		}
	}
	
	ai_will_do = {
		exists = ruler
		ruler = {
			has_ideology = ideology:ideology_republican_leader
		}
	}

	ai_enact_weight_modifier = {
		value = 0		
		if = {
			limit = {
				has_journal_entry = je_pedro_republic
			}
			add = 100
		}
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_presidential_republic
				has_strategy = ai_strategy_progressive_agenda
				power_bloc ?= { has_identity = identity:identity_ideological_union }
				scope:target_country = { # Is their law different enough from what we want to impose?
					NOT = { has_law = law_type:law_parliamentary_republic }
				}				
			}
			
			add = base_impose_law_weight
			if = {
				limit = { 
					scope:target_country = { has_law = law_type:council_republic } 
					NOT = { has_strategy = ai_strategy_egalitarian_agenda }
				}
				multiply = 5
			}	
			else = {
				multiply = 0.5 # AI is less likely to mess with governance principles unless dealing with council republics
			}
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}	
}

law_parliamentary_republic = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/parliamentary_republic.dds"
	
	progressiveness = 100
	
	can_enact = {
		NOT = { has_government_type = gov_chartered_company }
	}
	
	unlocking_technologies = {
		democracy
	}

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_governance_principles_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}
	
	modifier = {
		country_legitimacy_govt_total_votes_add = 20
		country_legitimacy_ideological_incoherence_mult = -0.4
		country_bureaucracy_investment_cost_factor_mult = -0.2
	}
	
	on_activate = {
		if = {
			limit = {
				has_variable = fra_republic_counter
			}
			change_variable = {
				name = fra_republic_counter
				add = 1
			}
		}
		if = {
			limit = {
				any_interest_group = {
					has_ideology = ideology:ideology_constitutionalist
				}
			}
			every_interest_group = {
				limit = {
					has_ideology = ideology:ideology_constitutionalist
				}
				remove_ideology = ideology_constitutionalist
				add_ideology = ideology_republican
			}
		}
	}
	
	ai_will_do = {
		exists = ruler
		ruler = {
			has_ideology = ideology:ideology_republican_leader
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_parliamentary_republic
				has_strategy = ai_strategy_progressive_agenda
				power_bloc ?= { has_identity = identity:identity_ideological_union }
				scope:target_country = { # Is their law different enough from what we want to impose?
					NOT = { has_law = law_type:law_presidential_republic }
				}				
			}
			
			add = base_impose_law_weight
			if = {
				limit = { 
					scope:target_country = { has_law = law_type:council_republic } 
					NOT = { has_strategy = ai_strategy_egalitarian_agenda }
				}
				multiply = 5
			}		
			else = {
				multiply = 0.5 # AI is less likely to mess with governance principles unless dealing with council republics
			}
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}

law_theocracy = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/theocracy.dds"
	
	progressiveness = -25

	disallowing_laws = {
		law_total_separation 
	}

	can_enact = {
		NOT = { has_government_type = gov_chartered_company }
	}		

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_governance_principles_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}

	modifier = {
		country_legitimacy_headofstate_add = 20
		country_clergymen_pol_str_mult = 1.0
		state_conversion_mult = 1
		country_authority_add = 200
	}
	
	ai_will_do = {
		exists = ruler
		ruler = {
			has_ideology = ideology:ideology_theocrat
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_theocracy
				has_strategy = ai_strategy_reactionary_agenda
				power_bloc ?= { has_identity = identity:identity_religious }
				religion = scope:target_country.religion
				scope:target_country = { # Is their law different enough from what we want to impose?					
					NOT = { has_law = law_type:law_monarchy }
				}				
			}
			
			add = base_impose_law_weight
			if = {
				limit = { 
					scope:target_country = { has_law = law_type:council_republic } 
					NOT = { has_strategy = ai_strategy_egalitarian_agenda }
				}
				multiply = 5
			}		
			else = {
				multiply = 0.5 # AI is less likely to mess with governance principles unless dealing with council republics
			}
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}

law_council_republic = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/council_republic.dds"
	
	progressiveness = 200

	unlocking_technologies = {
		socialism
	}

	can_enact = {
		NOT = { has_government_type = gov_chartered_company }
	}
	
	on_activate = {		
		custom_tooltip = {
			text = enact_law_radical_leftist_government_warning_desc
		}
		if = {
			limit = {
				any_interest_group = {
					has_ideology = ideology:ideology_constitutionalist
				}
			}
			every_interest_group = {
				limit = {
					has_ideology = ideology:ideology_constitutionalist
				}
				remove_ideology = ideology_constitutionalist
				add_ideology = ideology_republican
			}
		}	
		if = {
			limit = {
				has_global_variable = lenin_spawn
				country_has_primary_culture = cu:russian
				any_scope_state = {
					state_region = s:STATE_INGRIA
				}
			}
			random_scope_state = {
				limit = {
					state_region = s:STATE_INGRIA
				}
				STATE_INGRIA_state_name_assign = yes
			}
		}
	}		

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_governance_principles_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}	

	modifier = {
		country_legitimacy_headofstate_add = 10
		country_legitimacy_govt_total_votes_add = 10
		country_legitimacy_ideological_incoherence_mult = -0.2
		country_laborers_pol_str_mult = 1.0
		country_authority_add = 100
	}
	
	ai_will_do = {
		exists = ruler
		ruler = {
			OR = {
				has_ideology = ideology:ideology_communist
				has_ideology = ideology:ideology_anarchist
				has_ideology = ideology:ideology_vanguardist
			}
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_council_republic
				has_strategy = ai_strategy_egalitarian_agenda				
			}
			
			add = base_impose_law_weight
			multiply = 5.0
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}

law_corporate_state = {
	group = lawgroup_governance_principles
	
	icon = "gfx/interface/icons/law_icons/corporate_state.dds"
	
	progressiveness = 50

	unlocking_technologies = {
		corporatism
	}
	
	on_activate = {
		if = {
			limit = {
				any_interest_group = {
					has_ideology = ideology:ideology_constitutionalist
				}
			}
			every_interest_group = {
				limit = {
					has_ideology = ideology:ideology_constitutionalist
				}
				remove_ideology = ideology_constitutionalist
				add_ideology = ideology_republican
			}
		}	
		if = {
			limit = {
				var:corporatist_nominating_body_var ?= 1
			}
			add_modifier = { name = modifier_corporate_state_trade_unions_bias }
		}
		if = {
			limit = {
				var:corporatist_nominating_body_var ?= 2
			}
			add_modifier = { name = modifier_corporate_state_industrialists_bias }
		}
		if = {
			limit = {
				var:corporatist_nominating_body_var ?= 3
			}
			add_modifier = { name = modifier_corporate_state_intelligentsia_bias }
		}
	}		

	on_enact = {
		if = {
			limit = {
				var:corporatist_nominating_body_var ?= 1
			}
			custom_tooltip = corporate_state_trade_unions_bias_tt
		}
		if = {
			limit = {
				var:corporatist_nominating_body_var ?= 2
			}
			custom_tooltip = corporate_state_industrialists_bias_tt
		}
		if = {
			limit = {
				var:corporatist_nominating_body_var ?= 3
			}
			custom_tooltip = corporate_state_intelligentsia_bias_tt
		}
	}

	on_deactivate = {
		if = {
			limit = {
				has_modifier = modifier_corporate_state_trade_unions_bias
			}
			remove_modifier = modifier_corporate_state_trade_unions_bias
		}
		if = {
			limit = {
				has_modifier = modifier_corporate_state_industrialists_bias
			}
			remove_modifier = modifier_corporate_state_industrialists_bias
		}
		if = {
			limit = {
				has_modifier = modifier_corporate_state_intelligentsia_bias
			}
			remove_modifier = modifier_corporate_state_intelligentsia_bias
		}
	}

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_governance_principles_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}
	
	modifier = {
		country_legitimacy_govt_size_add = 2
		country_legitimacy_ideological_incoherence_mult = -0.2
		country_authority_add = 100
	}
	
	ai_will_do = {
		exists = ruler
		ruler = {
			OR = {
				has_ideology = ideology:ideology_fascist
				has_ideology = ideology:ideology_corporatist_leader
			}
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_corporate_state
				has_strategy = ai_strategy_nationalist_agenda				
			}
			
			add = base_impose_law_weight
			multiply = 5.0
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}