###################################
#
# Province Lordship Events
#
# Id 77000 - 77999 is reserved
#
###################################
#
# Designed by Johan Andersson
# Written by Sara Wendel-rtqvist

# The Clergy demands a stop to commerce in all church squares
province_event = {
	id = 77000
	desc = EVTDESC77000
	picture = GFX_evt_market

	trigger = {
		religion_group = christian
		religion_group = owner

		owner = {
			is_theocracy = no
		}

		any_province_lord = {
			is_theocracy = yes
		}

		any_province_lord = {
			is_republic = yes
			NOT = { owns = ROOT }
		}

		NOT = { has_province_modifier = stop_commerce }
	}

	mean_time_to_happen = {
		years = 3000
	}

	immediate = {
		random_province_lord = {
			limit = {
				is_republic = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_burgher
		}

		random_province_lord = {
			limit = { is_theocracy = yes }
			save_event_target_as = target_bishop
		}
	}

	option = {
		name = EVTOPTA77000

		add_province_modifier = {
			name = stop_commerce
			years = 10
		}

		owner = {
			show_scope_change = no

			piety = 5

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_bishop
				years = 5
			}

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_burgher
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTB77000

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_bishop
				years = 5
			}
		}
	}
}

# Burghers demands that city laws is set higher than canonical law
province_event = {
	id = 77001
	desc = EVTDESC77001
	picture = GFX_evt_cathedral

	trigger = {
		religion_group = christian
		religion_group = owner

		any_province_lord = {
			is_theocracy = yes
			NOT = { owns = ROOT }
		}

		any_province_lord = {
			is_republic = yes
			NOT = { owns = ROOT }
		}
	}

	mean_time_to_happen = {
		years = 3000
	}

	immediate = {
		random_province_lord = {
			limit = {
				is_republic = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_burgher
		}

		random_province_lord = {
			limit = {
				is_theocracy = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_bishop
		}
	}

	option = {
		name = EVTOPTA77001

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_bishop
				years = 5
			}

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_burgher
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTB77001

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_burgher
				years = 5
			}
		}
	}
}

# The Nobility demands Prima Noctae rights
province_event = {
	id = 77002
	desc = EVTDESC77002
	picture = GFX_evt_peasants

	trigger = {
		religion_group = christian

		any_province_lord = {
			is_feudal = yes
			is_adult = yes
			is_female = no
			NOT = { owns = ROOT }
		}

		NOT = { has_province_modifier = prima_noctae }
	}

	mean_time_to_happen = {
		years = 3000
	}

	immediate = {
		random_province_lord = {
			limit = {
				is_adult = yes
				is_female = no
				is_feudal = yes
				NOT = { owns = ROOT }
			}

			save_event_target_as = target_province_lord
		}
	}

	option = {
		name = EVTOPTA77002

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_province_lord
				years = 5
			}
		}

		add_province_modifier = {
			name = prima_noctae
			years = 10
		}
	}

	option = {
		name = EVTOPTB77002

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_province_lord
				years = 5
			}
		}
	}
}

# The Burgers demands that peasants be forbidden to sell goods within the city walls
province_event = {
	id = 77003
	desc = EVTDESC77003
	picture = GFX_evt_market

	trigger = {
		any_province_lord = {
			is_republic = yes
		}

		owner = {
			NOR = {
				religion_group = muslim
				religion_group = jewish_group
			}
		}

		NOT = { has_province_modifier = peasants_forbidden_sale }
	}

	mean_time_to_happen = {
		years = 3000
	}

		immediate = {
		random_province_lord = {
			limit = {
				is_republic = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_province_lord
		}
	}

	option = {
		name = EVTOPTA77003

		add_province_modifier = {
			name = peasants_forbidden_sale
			years = 10
		}

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_province_lord
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTB77003

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_province_lord
				years = 5
			}
		}
	}
}

# The Nobles demands hunting rights on church lands
province_event = {
	id = 77004
	desc = EVTDESC77004
	picture = GFX_evt_hunt

	trigger = {
		religion_group = christian
		religion_group = owner

		any_province_lord = {
			OR = {
				is_feudal = yes
				is_patrician = yes
			}

			is_adult = yes
			is_female = no
			is_incapable = no
		}

		any_province_lord = {
			is_theocracy = yes
			is_incapable = no
		}
	}

	mean_time_to_happen = {
		years = 3000
	}

	immediate = {
		random_province_lord = {
			limit = {
				OR = {
					is_feudal = yes
					is_patrician = yes
				}

				is_adult = yes
				is_female = no
				is_incapable = no
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_feudal
		}

		random_province_lord = {
			limit = {
				is_theocracy = yes
				is_incapable = no
			}
			save_event_target_as = target_bishop
		}
	}

	option = {
		name = EVTOPTA77004

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_feudal
				years = 5
			}

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_bishop
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTB77004

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_bishop
				years = 5
			}

			reverse_opinion = {
				name = opinion_dislike
				who = event_target:target_feudal
				years = 5
			}
		}
	}
}

# The Clergy demands right to collect extra tithe on free peasants
province_event = {
	id = 77005
	desc = EVTDESC77005
	picture = GFX_evt_stone_church

	trigger = {
		religion_group = christian
		religion_group = owner

		owner = {
			is_theocracy = no
		}

		any_province_lord = {
			is_theocracy = yes
		}

		NOT = { has_province_modifier = clergy_extra_tithe }
	}

	mean_time_to_happen = {
		years = 3000
	}

	option = {
		name = EVTOPTA77005

		add_province_modifier = {
			name = clergy_extra_tithe
			years = 10
		}
	}

	option = {
		name = EVTOPTB77005

		random_province_lord = {
			limit = {
				is_theocracy = yes
				NOT = { owns = ROOT }
			}

			opinion = {
				name = opinion_dislike
				who = ROOT
				years = 5
			}
		}
	}
}

# Sell titles to rich merchants
province_event = {
	id = 77006
	desc = EVTDESC77006
	picture = GFX_evt_market

	trigger = {
		any_province_lord = {
			is_feudal = yes
			NOT = { owns = ROOT }
		}

		any_province_lord = {
			is_republic = yes
			NOT = { owns = ROOT }
		}
	}

	mean_time_to_happen = {
		years = 3000
	}

	option = {
		name = EVTOPTA77006

		owner = {
			show_scope_change = no

			scaled_wealth = 0.25
		}

		random_province_lord = {
			limit = {
				is_feudal = yes
				NOT = { owns = ROOT }
			}

			opinion = {
				name = opinion_dislike
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTB77006

		random_province_lord = {
			limit = { is_republic = yes }

			opinion = {
				name = opinion_dislike
				who = ROOT
				years = 5
			}
		}
	}
}

# Rights to spoils from shipwrecks
province_event = {
	id = 77007
	desc = EVTDESC77007
	picture = GFX_evt_merchant_ship_at_sea_republic

	trigger = {
		is_coastal = yes
		religion_group = christian
		religion_group = owner

		trigger_if = {
			limit = { owner = { is_feudal = no } }
			any_province_lord = { is_feudal = yes }
		}

		trigger_if = {
			limit = { owner = { is_republic = no } }
			any_province_lord = { is_republic = yes }
		}

		trigger_if = {
			limit = { owner = { is_theocracy = no } }
			any_province_lord = { is_theocracy = yes }
		}
	}

	mean_time_to_happen = {
		years = 3000
	}

	immediate = {
		random_province_lord = {
			limit = {
				is_republic = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_burgher
		}

		random_province_lord = {
			limit = {
				is_theocracy = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_bishop
		}

		random_province_lord = {
			limit = {
				is_feudal = yes
				NOT = { owns = ROOT }
			}
			save_event_target_as = target_feudal
		}
	}

	option = {
		name = EVTOPTA77007

		trigger = {
			owner = { is_theocracy = no }
		}

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_bishop
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTB77007

		trigger = {
			owner = { is_republic = no }
		}

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_burgher
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTC77007

		trigger = {
			owner = { is_feudal = no }
		}

		owner = {
			show_scope_change = no

			reverse_opinion = {
				name = opinion_happy
				who = event_target:target_feudal
				years = 5
			}
		}
	}

	option = {
		name = EVTOPTD77007

		owner = {
			show_scope_change = no

			scaled_wealth = {
				value = 0.05
				min = 10
			}
		}
	}
}