﻿law_serfdom = {
	group = lawgroup_land_reform
	
	icon = "gfx/interface/icons/law_icons/serfdom.dds"
	
	progressiveness = -50
	
	disallowing_laws = {
		law_interventionism
		law_laissez_faire
		law_command_economy
	}
	
	on_enact = {
		if = {
			limit = {
				OR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_homesteading
				}
			}
			custom_tooltip = farmers_pb_ig_shift_effect_negative_tt
		}
		if = {
			limit = {
				OR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_collectivized_agriculture
				}
			}
			custom_tooltip = rural_laborers_tu_ig_shift_effect_negative_tt
		}
	}
	
	modifier = {
		country_aristocrats_pol_str_mult = 0.5
		state_peasants_internal_migration_disallowed_bool = yes
		state_peasants_mass_migration_disallowed_bool = yes
	}
	
	# AI should never try to bring back serfdom
	ai_will_do = {
		always = no
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
}

law_tenant_farmers = {
	group = lawgroup_land_reform
	
	icon = "gfx/interface/icons/law_icons/tenant_farmers.dds"
	
	progressiveness = 0

	modifier = {
		country_aristocrats_pol_str_mult = 0.25
	}
	
	on_enact = {
		if = {
			limit = {
				OR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_homesteading
				}
			}
			custom_tooltip = farmers_pb_ig_shift_effect_negative_tt
		}
		if = {
			limit = {
				OR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_collectivized_agriculture
				}
			}
			custom_tooltip = rural_laborers_tu_ig_shift_effect_negative_tt
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
		
		if = {
			limit = { 
				OR = {
					has_journal_entry = je_meiji_main
					has_journal_entry = je_great_reforms_serfdom
				}
				has_law = law_type:law_serfdom
			}
			add = 10000 # Top priority for Meiji AI is to get out of Serfdom, likewise for Great Reforms
		}

		# AI should really try to get out of Serfdom under the right circumstances
		if = {
			limit = {
				has_law = law_type:law_serfdom
				NOT = { has_strategy = ai_strategy_reactionary_agenda }
				OR = {
					NOT = { has_strategy = ai_strategy_conservative_agenda }
					any_political_movement = {
						law_enactment_stance = {
							law = law_type:law_tenant_farmers
							value > neutral
						}	
						political_movement_support >= 0.10
					}			
				}			
			}
			add = 1000
		}		
	}
}

law_commercialized_agriculture = {
	group = lawgroup_land_reform
	
	icon = "gfx/interface/icons/law_icons/commercial_agriculture.dds"
	
	progressiveness = 0

	modifier = {
	}

	disallowing_laws = {
		law_traditionalism
	}

	unlocking_technologies = {
		mutual_funds
	}
	
	on_enact = {
		custom_tooltip = financial_districts_buy_farms_tt
		if = {
			limit = {
				NOR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_homesteading
				}
			}
			custom_tooltip = farmers_pb_ig_shift_effect_tt
		}
		if = {
			limit = {
				NOR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_collectivized_agriculture
				}
			}
			custom_tooltip = rural_laborers_tu_ig_shift_effect_tt
		}
		if = {
			limit = {
				has_journal_entry = je_pedro_brazil
				NOT = { has_variable = landreform_pedropoint }
			}
			set_variable = landreform_pedropoint
			remove_pedropoint_effect = yes
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0

		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
		
		if = {
			limit = { 
				has_journal_entry = je_meiji_main
				has_law = law_type:law_serfdom
			}
			add = 10000 # Top priority for Meiji AI is to get out of Serfdom
		}

		# AI should really try to get out of Serfdom under the right circumstances
		if = {
			limit = {
				has_law = law_type:law_serfdom
				NOT = { has_strategy = ai_strategy_reactionary_agenda }
				OR = {
					NOT = { has_strategy = ai_strategy_conservative_agenda }
					any_political_movement = {
						law_enactment_stance = {
							law = law_type:law_collectivized_agriculture
							value > neutral
						}	
						political_movement_support >= 0.10
					}				
				}
			}
			add = 1000
		}		
	}
}

law_homesteading = {
	group = lawgroup_land_reform
	
	icon = "gfx/interface/icons/law_icons/freeholders.dds"
	
	progressiveness = 25

	modifier = {
		country_farmers_pol_str_mult = 0.25
		building_group_bg_agriculture_allowed_collectivization_add = 0.5
		building_group_bg_ranching_allowed_collectivization_add = 0.5
		building_group_bg_plantations_allowed_collectivization_add = 0.5
		building_group_bg_subsistence_agriculture_allowed_collectivization_add = 0.5
		building_group_bg_subsistence_ranching_allowed_collectivization_add = 0.5
	}

	on_enact = {
		if = {
			limit = {
				NOR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_homesteading
				}
			}
			custom_tooltip = farmers_pb_ig_shift_effect_tt
		}
		if = {
			limit = {
				OR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_collectivized_agriculture
				}
			}
			custom_tooltip = rural_laborers_tu_ig_shift_effect_negative_tt
		}
		if = {
			limit = {
				has_journal_entry = je_pedro_brazil
				NOT = { has_variable = landreform_pedropoint }
			}
			set_variable = landreform_pedropoint
			remove_pedropoint_effect = yes
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
		
		# AI should really try to get out of Serfdom under the right circumstances
		if = {
			limit = {
				has_law = law_type:law_serfdom
				NOT = { has_strategy = ai_strategy_reactionary_agenda }
				OR = {
					NOT = { has_strategy = ai_strategy_conservative_agenda }
					any_political_movement = {
						law_enactment_stance = {
							law = law_type:law_homesteading
							value > neutral
						}	
						political_movement_support >= 0.10
					}				
				}
			}
			add = 1000
		}		
	}
}

law_collectivized_agriculture = {
	group = lawgroup_land_reform
	
	icon = "gfx/interface/icons/law_icons/collectivized_agriculture.dds"
	
	progressiveness = 50

	modifier = {
		building_group_bg_agriculture_allowed_collectivization_add = 0.99
		building_group_bg_ranching_allowed_collectivization_add = 0.99
		building_group_bg_plantations_allowed_collectivization_add = 0.99
		building_group_bg_subsistence_agriculture_allowed_collectivization_add = 0.99
		building_group_bg_subsistence_ranching_allowed_collectivization_add = 0.99
	}

	on_enact = {
		custom_tooltip = rural_laborers_tu_ig_shift_effect_tt
		if = {
			limit = {
				OR = {
					has_law = law_type:law_commercialized_agriculture
					has_law = law_type:law_homesteading
				}
			}
			custom_tooltip = farmers_pb_ig_shift_effect_negative_tt
		}
		if = {
			limit = {
				has_journal_entry = je_pedro_brazil
				NOT = { has_variable = landreform_pedropoint }
			}
			set_variable = landreform_pedropoint
			remove_pedropoint_effect = yes
		}
	}

	unlocking_laws = {
	}

	unlocking_technologies = { socialism }

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
		
		if = {
			limit = { 
				has_law = law_type:law_council_republic
			}
			add = 250
		}
	}
}
