﻿INJECT:law_commercialized_agriculture = {
	ai_enact_weight_modifier = { #Petitions
		value = 0

		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}

		# KAI: Commercialized Agriculture is a valid alternative to Tenant Farmers
		if = {
			limit = {
				has_law_or_variant = law_type:law_serfdom
			}

			add = 1000
		}

		if = {
			limit = {
				OR = {
					has_journal_entry = je_meiji_main
					has_journal_entry = je_great_reforms_serfdom
				}
				has_law_or_variant = 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_or_variant = 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_commercialized_agriculture
							value > neutral
						}
						political_movement_support >= 0.10
					}
				}
			}
			add = 1000
		}
	}
}

INJECT:law_peasant_proprietorship = { # Homesteading for old world countries
	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_or_variant = law_type:law_serfdom
			}
			add = 10000 # Top priority for Meiji AI is to get out of Serfdom
		}

		if = {
			limit = {
				NOT = {
					has_variable = is_carlist_spain
				}
				OR = {
					has_journal_entry = je_portugal_regeneration_agriculture
					has_journal_entry = je_spa_economic_regeneration_land_reform
				}
				NOT = {
					has_law = law_type:law_peasant_proprietorship
				}
			}
			add = 1000
		}

		# AI should really try to get out of Serfdom under the right circumstances
		if = {
			limit = {
				has_law_or_variant = 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 = {
							# KAI: The vanilla trigger has the wrong law here
							law = law_type:law_peasant_proprietorship
							value > neutral
						}
						political_movement_support >= 0.10
					}
				}
			}
			add = 1000
		}
	}
}
