##########################
# GOVERNOR CONTRACT EVENTS
##########################
namespace = governor_contract_event

### Overdue Taxes
# Intro event
governor_contract_event.1000 = {
	type = character_event
	title = governor_contract_event.1000.t
	desc = governor_contract_event.1000.desc
	theme = administrative
	left_portrait = {
		character = root
		animation = thinking
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = overdue_taxes
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = tax_destination
			}
		}
	}
	
	option = {
		name = governor_contract_event.1000.a
		
		custom_tooltip = governor_contract_event.1001.a_tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:tax_destination
			ARRIVAL_EVENT = governor_contract_event.1001
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 200
				has_trait = lazy
				NOT = { has_trait = greedy } # Greedy always wants more gold, even when lazy.
			}
		}
	}
}

# Arrival at the village location
governor_contract_event.1001 = {
	type = character_event
	title = governor_contract_event.1000.t
	desc = governor_contract_event.1001.desc
	theme = administrative
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_desert_trigger = yes }
		}
		reference = wilderness_desert
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = forest
					terrain = taiga
				}
				NOR = {
					geographical_region = world_africa
					geographical_region = world_india
					geographical_region = world_europe_west_iberia
					geographical_region = world_middle_east
				}
			}
		}
		reference = ep2_hunt_forest_hut
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = forest
					terrain = taiga
				}
				OR = {
					geographical_region = world_africa
					geographical_region = world_india
					geographical_region = world_europe_west_iberia
					geographical_region = world_middle_east
				}
			}
		}
		reference = wilderness_forest
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_jungle_trigger = yes }
		}
		reference = wilderness_jungle
	}

	override_background = {
		trigger = {
			root.location = { graphical_wilderness_steppe_trigger = yes }
		}
		reference = ep2_travel_settlement_steppe
	}
	override_background = {
		trigger = {
			root.location = {
				graphical_wilderness_desert_trigger = yes
				county = {
					OR = {
						culture = { culture_has_archer_cavalry_maa = yes }
						holder ?= { mpo_can_recruit_nomad_maa_trigger = yes }
					}	
				}
			}
		}
		reference = ep2_travel_nomad_settlement_desert
	}
	override_background = {
		trigger = {
			root.location = {
				graphical_wilderness_desert_trigger = yes
				county = {
					NOR = {
						culture = { culture_has_archer_cavalry_maa = yes }
						holder ?= { mpo_can_recruit_nomad_maa_trigger = yes  }
					}
				}
			}
		}
		reference = ep2_travel_settlement_desert
	}
	override_background = {
		trigger = {
			root.location = { graphical_hills_trigger = yes }
		}
		reference = ep2_travel_settlement_hills
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_mountains_trigger = yes }
		}
		reference = ep2_travel_settlement_mountains
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = farmlands
					terrain = plains
					terrain = floodplains
				}
			}
		}
		reference = ep2_travel_settlement_farm
	}
	left_portrait = {
		character = root
		animation = disapproval
	}
	
	immediate = {
		random_character_active_contract = {
			task_contract_type = overdue_taxes
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = tax_destination
			}
		}
	}
	
	option = {
		name = governor_contract_event.1001.a
		
		duel = {
			skill = diplomacy
			value = 10
			60 = {
				desc = governor_contract_event.1001.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2.5
				}
				save_scope_value_as = {
					name = governor_contract_event_1003_diplomacy
					value = yes
				}
				trigger_event = {
					id = governor_contract_event.1003
				}
				custom_tooltip = governor_contract_event.1001.success
			}
			40 = {
				desc = governor_contract_event.1001.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2.5
				}
				trigger_event = {
					id = governor_contract_event.1004
				}
				custom_tooltip = governor_contract_event.1001.failure
			}
		}
		
		ai_chance = {
			base = 10
			
			modifier = {
				factor = 2
				has_trait = education_diplomacy
			}
			modifier = {
				factor = 2
				has_trait = patient
			}
			modifier = {
				factor = 2
				has_trait = gregarious
			}
			modifier = {
				factor = 1.5
				has_trait = trusting
			}
			modifier = {
				factor = 1.5
				has_trait = compassionate
			}
		}
	}
	
	option = {
		name = governor_contract_event.1001.b
		
		duel = {
			skill = stewardship
			value = 10
			60 = {
				desc = governor_contract_event.1001.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2.5
				}
				save_scope_value_as = {
					name = governor_contract_event_1003_stewardship
					value = yes
				}
				trigger_event = {
					id = governor_contract_event.1003
				}
				custom_tooltip = governor_contract_event.1001.success
			}
			40 = {
				desc = governor_contract_event.1001.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2.5
				}
				trigger_event = {
					id = governor_contract_event.1004
				}
				custom_tooltip = governor_contract_event.1001.failure
			}
		}
		
		ai_chance = {
			base = 10
			
			modifier = {
				factor = 2
				has_trait = education_stewardship
			}
			modifier = {
				factor = 2
				has_trait = greedy
			}
			modifier = {
				factor = 2
				has_trait = diligent
			}
			modifier = {
				factor = 1.5
				has_trait = shy
			}
			modifier = {
				factor = 1.5
				has_trait = paranoid
			}
		}
	}
}

# Success event
governor_contract_event.1003 = {
	type = character_event
	title = governor_contract_event.1003.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:governor_contract_event_1003_diplomacy
				}
				desc = governor_contract_event.1003.desc_diplomacy
			}
			triggered_desc = {
				trigger = {
					exists = scope:governor_contract_event_1003_stewardship
				}
				desc = governor_contract_event.1003.desc_stewardship
			}
		}
		desc = governor_contract_event.1003.desc_outro
	}
	theme = administrative
	left_portrait = {
		character = root
		animation = thinking
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_desert_trigger = yes }
		}
		reference = wilderness_desert
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = forest
					terrain = taiga
				}
				NOR = {
					geographical_region = world_africa
					geographical_region = world_india
					geographical_region = world_europe_west_iberia
					geographical_region = world_middle_east
				}
			}
		}
		reference = ep2_hunt_forest_hut
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = forest
					terrain = taiga
				}
				OR = {
					geographical_region = world_africa
					geographical_region = world_india
					geographical_region = world_europe_west_iberia
					geographical_region = world_middle_east
				}
			}
		}
		reference = wilderness_forest
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_jungle_trigger = yes }
		}
		reference = wilderness_jungle
	}

	override_background = {
		trigger = {
			root.location = { graphical_wilderness_steppe_trigger = yes }
		}
		reference = ep2_travel_settlement_steppe
	}
	override_background = {
		trigger = {
			root.location = {
				graphical_wilderness_desert_trigger = yes
				county = {
					OR = {
						culture = { culture_has_archer_cavalry_maa = yes }
						holder ?= { mpo_can_recruit_nomad_maa_trigger = yes  }
					}	
				}
			}
		}
		reference = ep2_travel_nomad_settlement_desert
	}
	override_background = {
		trigger = {
			root.location = {
				graphical_wilderness_desert_trigger = yes
				county = {
					NOR = {
						culture = { culture_has_archer_cavalry_maa = yes }
						holder ?= { mpo_can_recruit_nomad_maa_trigger = yes  }
					}	
				}
			}
		}
		reference = ep2_travel_settlement_desert
	}
	override_background = {
		trigger = {
			root.location = { graphical_hills_trigger = yes }
		}
		reference = ep2_travel_settlement_hills
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_mountains_trigger = yes }
		}
		reference = ep2_travel_settlement_mountains
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = farmlands
					terrain = plains
					terrain = floodplains
				}
			}
		}
		reference = ep2_travel_settlement_farm
	}
	
	immediate = {
		generate_governance_outcome_effect = { OPTIONS = 6 }
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.1003.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = taxes_governor
		}
	}
	option = {
		name = governor_contract_event.1003.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = taxes_paid_in_full
		}
	}
	option = {
		name = governor_contract_event.1003.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = taxes_paid_partially
		}
	}
	option = {
		name = governor_contract_event.1003.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = taxes_station_troops
		}
	}
	option = {
		name = governor_contract_event.1003.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = taxes_assign_administrator
		}
	}
	option = {
		name = governor_contract_event.1003.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = taxes_lower_taxes
		}
	}
}

# Failure 
governor_contract_event.1004 = {
	type = character_event
	title = governor_contract_event.1004.t
	desc = governor_contract_event.1004.desc
	theme = administrative
	left_portrait = {
		character = root
		animation = dismissal
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_desert_trigger = yes }
		}
		reference = wilderness_desert
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = forest
					terrain = taiga
				}
				NOR = {
					geographical_region = world_africa
					geographical_region = world_india
					geographical_region = world_europe_west_iberia
					geographical_region = world_middle_east
				}
			}
		}
		reference = ep2_hunt_forest_hut
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = forest
					terrain = taiga
				}
				OR = {
					geographical_region = world_africa
					geographical_region = world_india
					geographical_region = world_europe_west_iberia
					geographical_region = world_middle_east
				}
			}
		}
		reference = wilderness_forest
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_jungle_trigger = yes }
		}
		reference = wilderness_jungle
	}

	override_background = {
		trigger = {
			root.location = { graphical_wilderness_steppe_trigger = yes }
		}
		reference = ep2_travel_settlement_steppe
	}
	override_background = {
		trigger = {
			root.location = {
				graphical_wilderness_desert_trigger = yes
				county.culture = {
					culture_has_archer_cavalry_maa = yes
				}
			}
		}
		reference = ep2_travel_nomad_settlement_desert
	}
	override_background = {
		trigger = {
			root.location = {
				graphical_wilderness_desert_trigger = yes
				county.culture = {
					NOT = { culture_has_archer_cavalry_maa = yes }
				}
			}
		}
		reference = ep2_travel_settlement_desert
	}
	override_background = {
		trigger = {
			root.location = { graphical_hills_trigger = yes }
		}
		reference = ep2_travel_settlement_hills
	}
	override_background = {
		trigger = {
			root.location = { graphical_wilderness_mountains_trigger = yes }
		}
		reference = ep2_travel_settlement_mountains
	}
	override_background = {
		trigger = {
			root.location = {
				OR = {
					terrain = farmlands
					terrain = plains
					terrain = floodplains
				}
			}
		}
		reference = ep2_travel_settlement_farm
	}
	
	option = {
		name = governor_contract_event.1004.a
		scope:ongoing_contract ?= {
			complete_task_contract = failure_standard
		}
	}
}

### Hoarding Mayor
# Intro event
governor_contract_event.1010 = {
	type = character_event
	title = governor_contract_event.1010.t
	desc = governor_contract_event.1010.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = worry
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = hoarding_mayor
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = mayor_destination
			}
			
			# Save the employer
			task_contract_employer = {
				save_scope_as = hoarding_mayor
			}
		}
	}
	
	option = {
		name = governor_contract_event.1010.a
		
		custom_tooltip = governor_contract_event.1010.a_tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:mayor_destination
			ARRIVAL_EVENT = governor_contract_event.1011
		}
	}
}

# Arrival at mayor's residence
governor_contract_event.1011 = {
	type = character_event
	title = governor_contract_event.1010.t
	desc = {
		desc = governor_contract_event.1011.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:hoarding_mayor = {
						OR = {
							has_trait = craven
							has_trait = shy
						}
					}
				}
				desc = governor_contract_event.1011.desc_fear
			}
			triggered_desc = {
				trigger = {
					scope:hoarding_mayor = {
						OR = {
							has_trait = brave
							has_trait = arrogant
							has_trait = greedy
						}
					}
				}
				desc = governor_contract_event.1011.desc_upset
			}
			desc = governor_contract_event.1011.desc_worried
		}
	}
	theme = administrative
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		animation = debating
	}
	right_portrait = {
		character = scope:hoarding_mayor
		triggered_animation = {
			trigger = {
				scope:hoarding_mayor = {
					OR = {
						has_trait = craven
						has_trait = shy
					}
				}
			}
  			animation = fear
  		}
		triggered_animation = {
			trigger = {
				scope:hoarding_mayor = {
					OR = {
						has_trait = brave
						has_trait = arrogant
						has_trait = greedy
					}
				}
			}
  			animation = anger
  		}
		animation = shock
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = hoarding_mayor
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = mayor_destination
			}
			
			# Save the employer
			task_contract_employer = {
				save_scope_as = hoarding_mayor
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 6 }
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.1011.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = mayor_governor
		}
	}
	option = {
		name = governor_contract_event.1011.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = mayor_claim_gold
		}
	}
	option = {
		name = governor_contract_event.1011.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = mayor_invest_in_buildings
		}
	}
	option = {
		name = governor_contract_event.1011.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = mayor_hold_festivities
		}
	}
	option = {
		name = governor_contract_event.1011.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = mayor_reprimand
		}
	}
	option = {
		name = governor_contract_event.1011.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = mayor_hook
		}
	}
	
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

# Cancel travel plan confirmation - Do you really want to forgoe the contract?
governor_contract_event.1012 = {
	type = character_event
	title = governor_contract_event.1012.t
	desc = governor_contract_event.1012.desc
	theme = administrative
	left_portrait = {
		character = root
		animation = thinking
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
			
			# Save the employer
			task_contract_employer ?= {
				save_scope_as = contract_employer
			}

			# Save your character
			task_contract_taker = { 
				save_scope_as = contract_taker
			}
		}
	}
	
	option = { # On second thought, let's go!
		name = governor_contract_event.1012.a
		custom_tooltip = governor_contract_event.1012.a_tt
		start_travel_plan = {
			destination = scope:ongoing_destination
			on_arrival_event = governor_contract_event.1013
			on_travel_planner_cancel_event = governor_contract_event.1012
			on_arrival_destinations = all_but_last
		}
	}
	
	option = { # I have more important matters to deal with.
		name = governor_contract_event.1012.b
		
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
	}
}

governor_contract_event.1013 = {
	hidden = yes

	immediate = {
		scope:ongoing_contract = {
			switch = {
				trigger = has_task_contract_type
				overdue_taxes = {
					scope:contract_taker = { trigger_event = governor_contract_event.1001 }
				}
				hoarding_mayor = {
					scope:contract_taker = { trigger_event = governor_contract_event.1011 }
				}
				rampant_bandits = {
					scope:contract_taker = { trigger_event = governor_contract_event.1031 }
				}
				inept_mayor = {
					scope:contract_taker = { trigger_event = governor_contract_event.2011 }
				}
				raiding_peasants = {
					scope:contract_taker = { trigger_event = governor_contract_event.2031 }
				}
				wild_predators = {
					scope:contract_taker = { trigger_event = governor_contract_event.2041 }
				}
				evil_presence = {
					scope:contract_taker = { trigger_event = governor_contract_event.2051 }
				}
				buried_treasure = {
					scope:contract_taker = { trigger_event = governor_contract_event.2071 }
				}
				public_land = {
					scope:contract_taker = { trigger_event = governor_contract_event.2081 }
				}
				mad_prophet = {
					scope:contract_taker = { trigger_event = governor_contract_event.2091 }
				}
				hungry_times = {
					scope:contract_taker = { trigger_event = governor_contract_event.2111 }
				}
				jail_inspection = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0001 }
				}
				potent_physick = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0002 }
				}
				irregular_accounting = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0003 }
				}
				salt_smugglers = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0004 }
				}
				hoarding_grain = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0005 }
				}
				hoarding_grain = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0005 }
				}
				doddering_magistrate = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0006 }
				}
				burdensome_taxes = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0007 }
				}
				unsafe_highways = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0008 }
				}
				dam_in_disrepair = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0009 }
				}
				lines_in_the_soil = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0010 }
				}
				fraud_in_broad_daylight = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0011 }
				}
				crumbling_bridge = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0012 }
				}
				confusion_of_tongues = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0013 }
				}
				seditious_storytelling = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0014 }
				}
				quaking_in_panic = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0015 }
				}
				monopoly_in_the_marketplace = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0033 }
				}
				contested_inheritance = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.0035 }
				}
				unsanctioned_deity = {
					scope:contract_taker = { trigger_event = governor_contract_events_tova.0051 }
				}
				escaped_justice = {
					scope:contract_taker = { trigger_event = governor_contract_events_tova.0056 }
				}
				forced_conscription = {
					scope:contract_taker = { trigger_event = governor_contract_events_tova.0061 }
				}
				combat_train_monks = {
					scope:contract_taker = { trigger_event = governor_contract_events_tova.0066 }
				}
				missing_equipment = {
					scope:contract_taker = { trigger_event = tgp_governor_contract_event.2001 }
				}
			}
		}
	}
}

### Bountiful Harvest
# Intro event
governor_contract_event.1020 = {
	type = character_event
	title = governor_contract_event.1020.t
	desc = governor_contract_event.1020.desc
	theme = administrative
	override_background = { reference = bp1_wine_cellar }
	left_portrait = {
		character = root
		animation = happiness
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = bountiful_harvest
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = mayor_destination
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 6 }
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.1020.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = harvest_governor
		}
	}
	option = {
		name = governor_contract_event.1020.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = harvest_distribute
		}
	}
	option = {
		name = governor_contract_event.1020.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = harvest_capital
		}
	}
	option = {
		name = governor_contract_event.1020.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = harvest_charity
		}
	}
	option = {
		name = governor_contract_event.1020.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = harvest_sell_excess
		}
	}
	option = {
		name = governor_contract_event.1020.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = harvest_claim_it_yourself
		}
	}
}

### Rampaging Bandits
# Intro event
governor_contract_event.1030 = {
	type = character_event
	title = governor_contract_event.1030.t
	desc = governor_contract_event.1030.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = worry
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = rampant_bandits
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = bandit_destination
			}
		}
		
		show_as_tooltip = { # To make sure the player sees it
			scope:bandit_destination.county = {
				add_county_modifier = {
					modifier = ep3_governance_rampant_bandits
					years = 40
				}
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.a
		
		custom_tooltip = governor_contract_event.1038.a_tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:bandit_destination
			ARRIVAL_EVENT = governor_contract_event.1031
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at bandit camp
governor_contract_event.1031 = {
	type = character_event
	title = governor_contract_event.1030.t
	desc = governor_contract_event.1031.desc
	theme = administrative
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = marshal
	}
	
	immediate = {
		add_character_flag = need_military_outfit
		# Save the contract
		random_character_active_contract = {
			task_contract_type = rampant_bandits
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = bandit_destination
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= {
				delay_travel_plan = { days = 180 }
			}
		}
	}
	
	option = { # Overwhelm the bandits!
		name = governor_contract_event.1031.a
		
		random_list = {
			60 = { # Success
				trigger_event = {
					id = governor_contract_event.1032
					days = 3
				}
				custom_tooltip = governor_contract_event.1031.success
				
				modifier = {
					factor = 1.2
					has_trait = brave
				}
				modifier = {
					factor = 1.2
					has_trait = reckless
				}
				modifier = {
					factor = 1.2
					has_trait = aggressive_attacker
				}
				modifier = {
					factor = 1.4
					OR = {
						has_trait = zealous
						has_trait = holy_warrior
					}
					scope:bandit_destination.county = {
						faith != root.faith
					}
				}
			}
			40 = { # Failure
				trigger_event = {
					id = governor_contract_event.1033
					days = 3
				}
				custom_tooltip = governor_contract_event.1031.failure
				
				modifier = {
					factor = 1.2
					scope:ongoing_contract.task_contract_tier >= define:NTaskContract|MEDIUM_TASK_CONTRACT_TIER
					scope:ongoing_contract.task_contract_tier < define:NTaskContract|HIGH_TASK_CONTRACT_TIER
				}
				modifier = {
					factor = 1.4
					scope:ongoing_contract.task_contract_tier >= define:NTaskContract|HIGH_TASK_CONTRACT_TIER
				}
			}
		}
		
		ai_chance = {
			base = 10
			
			modifier = {
				factor = 2
				has_trait = brave
			}
			modifier = {
				factor = 2
				has_trait = reckless
			}
			modifier = {
				factor = 1.5
				has_trait = aggressive_attacker
			}
			modifier = {
				factor = 1.5
				has_trait = wrathful
			}
		}
	}
	
	option = { # Let's lay out a tactic before we attack.
		name = governor_contract_event.1031.b
		
		duel = {
			skill = martial
			value = 10
			60 = {
				desc = governor_contract_event.1031.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2.5
				}
				save_scope_value_as = {
					name = governor_contract_event_1031_tactical
					value = yes
				}
				trigger_event = {
					id = governor_contract_event.1032
					days = 3
				}
				custom_tooltip = governor_contract_event.1031.success
			}
			40 = {
				desc = governor_contract_event.1031.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2.5
				}
				trigger_event = {
					id = governor_contract_event.1033
					days = 3
				}
				custom_tooltip = governor_contract_event.1031.failure
			}
		}
		
		ai_chance = {
			base = 10
			
			modifier = {
				factor = 2
				has_trait = education_martial
			}
			modifier = {
				factor = 2
				has_trait = patient
			}
			modifier = {
				factor = 1.5
				has_trait = ambitious
			}
		}
	}
	
	option = { # Lure them into a trap.
		name = governor_contract_event.1031.c
		
		duel = {
			skill = intrigue
			value = 10
			60 = {
				desc = governor_contract_event.1031.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2.5
				}
				save_scope_value_as = {
					name = governor_contract_event_1031_trap
					value = yes
				}
				trigger_event = {
					id = governor_contract_event.1032
					days = 3
				}
				custom_tooltip = governor_contract_event.1031.success
			}
			40 = {
				desc = governor_contract_event.1031.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2.5
				}
				trigger_event = {
					id = governor_contract_event.1033
					days = 3
				}
				custom_tooltip = governor_contract_event.1031.failure
			}
		}
		
		ai_chance = {
			base = 10
			
			modifier = {
				factor = 2
				has_trait = education_intrigue
			}
			modifier = {
				factor = 2
				has_trait = deceitful
			}
			modifier = {
				factor = 1.5
				has_trait = paranoid
			}
			modifier = {
				factor = 1.5
				has_trait = craven
			}
		}
	}
}

# Success!
governor_contract_event.1032 = {
	type = character_event
	title = governor_contract_event.1030.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:governor_contract_event_1031_tactical
				}
				desc = governor_contract_event.1032.desc_tactical
			}
			triggered_desc = {
				trigger = {
					exists = scope:governor_contract_event_1031_trap
				}
				desc = governor_contract_event.1032.desc_trap
			}
			desc = governor_contract_event.1032.desc_charge
		}
		desc = governor_contract_event.1032.desc_outro
	}
	theme = administrative
	override_background = { reference = ep2_hunt_poachers_camp }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				exists = scope:governor_contract_event_1031_tactical
			}
  			animation = inspect_weapon
  		}
		triggered_animation = {
			trigger = {
				exists = scope:governor_contract_event_1031_trap
			}
  			animation = scheme
  		}
		animation = celebrate_sword
		camera = camera_event_left_forward
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = rampant_bandits
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = bandit_destination
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 6 }
		
		scope:bandit_destination.county = {
			if = {
				limit = {
					has_county_modifier = ep3_governance_rampant_bandits
				}
				remove_county_modifier = ep3_governance_rampant_bandits
			}
		}
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.1032.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = bandit_governor
		}
	}
	option = {
		name = governor_contract_event.1032.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = bandit_pardon
		}
	}
	option = {
		name = governor_contract_event.1032.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = bandit_recruit
		}
	}
	option = {
		name = governor_contract_event.1032.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = bandit_payment
		}
	}
	option = {
		name = governor_contract_event.1032.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = bandit_execute
		}
	}
	option = {
		name = governor_contract_event.1032.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = bandit_gold
		}
	}
	
	after = {
		hidden_effect = {
			#current_travel_plan ?= { resume_travel_plan = yes }
		}
		current_travel_plan ?= { resume_travel_plan = yes }
		remove_character_flag = need_military_outfit
	}
}

# Failure!
governor_contract_event.1033 = {
	type = character_event
	title = governor_contract_event.1030.t
	desc = governor_contract_event.1033.desc
	theme = administrative
	override_background = { reference = ep2_hunt_poachers_camp }
	left_portrait = {
		character = root
		animation = debating
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = rampant_bandits
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = bandit_destination
			}
		}
	}
	
	option = {
		name = governor_contract_event.1033.a
		
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		current_travel_plan ?= { resume_travel_plan = yes }
	}
	
	after = {
		hidden_effect = {
			#current_travel_plan ?= { resume_travel_plan = yes }
		}
		remove_character_flag = need_military_outfit
	}
}

### Discontent Soldiers
# Intro event
governor_contract_event.2000 = {
	type = character_event
	title = governor_contract_event.2000.t
	desc = governor_contract_event.2000.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = worry
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = discontent_soldiers
			save_scope_as = ongoing_contract
		}
		random_neighboring_and_across_water_realm_same_rank_owner = {
			limit = { liege = root.liege }
			save_scope_as = other_gov
		}
		scope:ongoing_contract = { # Save other gov for reward effects
			set_variable = {
				name = other_gov
				value = scope:other_gov
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 5 }
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.2000.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = soldiers_land
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2000.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = soldiers_rival
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2000.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = soldiers_break
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2000.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = soldiers_punish
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_greed = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2000.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = soldiers_pay
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -1
			}
		}
	}
}

### Inept Mayor
# Intro event
governor_contract_event.2010 = {
	type = character_event
	title = governor_contract_event.2010.t
	desc = governor_contract_event.2010.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = inept_mayor
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = mayor_destination
			}
			
			# Save the employer
			task_contract_employer = {
				save_scope_as = inept_mayor
			}
		}
	}
	
	option = {
		name = governor_contract_event.2010.a
		custom_tooltip = governor_contract_event.1010.a_tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:mayor_destination
			ARRIVAL_EVENT = governor_contract_event.2011
		}
	}
}

# Arrival at mayor's residence
governor_contract_event.2011 = {
	type = character_event
	title = governor_contract_event.2010.t
	desc = {
		desc = governor_contract_event.2011.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:inept_mayor = {
						OR = {
							has_trait = lazy
							has_trait = craven
							has_trait = loyal
							has_trait = contrite
							has_trait = honest
						}
					}
				}
				desc = governor_contract_event.2011.desc_fear
			}
			triggered_desc = {
				trigger = {
					scope:inept_mayor = {
						OR = {
							has_trait = brave
							has_trait = arrogant
							has_trait = diligent
						}
					}
				}
				desc = governor_contract_event.2011.desc_upset
			}
			desc = governor_contract_event.2011.desc_worried
		}
	}
	theme = administrative
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		animation = debating
	}
	right_portrait = {
		character = scope:inept_mayor
		triggered_animation = {
			trigger = {
				scope:inept_mayor = {
					OR = {
						has_trait = craven
						has_trait = shy
					}
				}
			}
  			animation = fear
  		}
		triggered_animation = {
			trigger = {
				scope:inept_mayor = {
					OR = {
						has_trait = brave
						has_trait = arrogant
						has_trait = greedy
					}
				}
			}
  			animation = anger
  		}
		animation = shock
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = inept_mayor
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = mayor_destination
			}
			
			# Save the employer
			task_contract_employer = {
				save_scope_as = inept_mayor
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 4 }
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.2011.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = mayor_in_govt
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2011.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = mayor_in_fire
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2011.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = mayor_in_help
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2011.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = mayor_in_punish
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

### Provincial Investment
# Intro event
governor_contract_event.2020 = {
	type = character_event
	title = governor_contract_event.2020.t
	desc = governor_contract_event.2020.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = betting
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = prov_investment
			save_scope_as = ongoing_contract
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		liege = { save_scope_as = emperor }
		generate_governance_outcome_effect = { OPTIONS = 6 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2020.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = invest_infrastructure
		}
		add_character_flag = {
			flag = admin_invest_infrastructure
			days = 5
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2020.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = invest_church
		}
		add_character_flag = {
			flag = admin_invest_church
			days = 5
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2020.c
		flavor = governor_contract_event.2020.c_tt
		trigger = { exists = scope:governance_option_c }
		duel = {
			skill = intrigue
			value = average_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					has_trait = governor
					add = 25
				}
				save_scope_value_as = {
					name = governor_contract_event_2020_duel
					value = flag:invest_monument
				}
				desc = governor_contract_event.2020.success
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = invest_monument
					}
				}
				add_character_flag = {
					flag = admin_invest_monument_success
					days = 5
				}
				trigger_event = governor_contract_event.2021
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = governor_contract_event.2020.failure
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
				add_character_flag = {
					flag = admin_invest_monument_fail
					days = 5
				}
				trigger_event = governor_contract_event.2022
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -0.5
				ai_boldness = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2020.d
		trigger = { exists = scope:governance_option_d }
		duel = {
			skill = stewardship
			value = average_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					has_trait = governor
					add = 25
				}
				save_scope_value_as = {
					name = governor_contract_event_2020_duel
					value = flag:invest_traders
				}
				desc = governor_contract_event.2020.success
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = invest_traders
					}
				}
				add_character_flag = {
					flag = admin_invest_traders_success
					days = 5
				}
				trigger_event = governor_contract_event.2021
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = governor_contract_event.2020.failure
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
				add_character_flag = {
					flag = admin_invest_traders_fail
					days = 5
				}
				trigger_event = governor_contract_event.2022
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2020.e
		trigger = { exists = scope:governance_option_e }
		duel = {
			skill = martial
			value = average_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					has_trait = governor
					add = 25
				}
				save_scope_value_as = {
					name = governor_contract_event_2020_duel
					value = flag:invest_military
				}
				desc = governor_contract_event.2020.success
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = invest_military
					}
				}
				add_character_flag = {
					flag = admin_invest_military_success
					days = 5
				}
				
				trigger_event = governor_contract_event.2021
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = governor_contract_event.2020.failure
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
				add_character_flag = {
					flag = admin_invest_military_fail
					days = 5
				}
				
				trigger_event = governor_contract_event.2022
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_boldness = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2020.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = invest_food
		}
		add_character_flag = {
			flag = admin_invest_food
			days = 5
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
}

#Success
governor_contract_event.2021 = {
	type = character_event
	title = governor_contract_event.2021.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_infrastructure
				}
				desc = governor_contract_event.2021.desc_infrastructure
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_church
				}
				desc = governor_contract_event.2021.desc_church
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_monument_success
				}
				desc = governor_contract_event.2021.desc_monument
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_traders_success
				}
				desc = governor_contract_event.2021.desc_traders
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_military_success
				}
				desc = governor_contract_event.2021.desc_military
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_food
				}
				desc = governor_contract_event.2021.desc_food
			}
		}
		desc = governor_contract_event.2021.desc
	} 
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = personality_bold
	}

	option = {
		name = governor_contract_event.2021.a
		if = {
			limit = {
				scope:governor_contract_event_2020_duel ?= flag:invest_monument
			}
			scope:ongoing_contract = {
				complete_task_contract = invest_monument
			}
		}
		else_if = {
			limit = {
				scope:governor_contract_event_2020_duel ?= flag:invest_traders
			}
			scope:ongoing_contract = {
				complete_task_contract = invest_traders
			}
		}
		else_if = {
			limit = {
				scope:governor_contract_event_2020_duel ?= flag:invest_military
			}
			scope:ongoing_contract = {
				complete_task_contract = invest_military
			}
		}
	}
}

#Failure
governor_contract_event.2022 = {
	type = character_event
	title = governor_contract_event.2022.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_monument_fail
				}
				desc = governor_contract_event.2022.desc_monument
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_traders_fail
				}
				desc = governor_contract_event.2022.desc_traders
			}
			triggered_desc = {
				trigger = {
					has_character_flag = admin_invest_military_fail
				}
				desc = governor_contract_event.2022.desc_military
			}
		}
		desc = governor_contract_event.2022.desc
	} 
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = disapproval
	}

	option = {
		name = governor_contract_event.2022.a
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
	}
}

### Raiding Peasants
# Intro event
governor_contract_event.2030 = {
	type = character_event
	title = governor_contract_event.2030.t
	desc = governor_contract_event.2030.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = worry
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = raiding_peasants
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		scope:ongoing_destination.county = {
			random_neighboring_county = {
				limit = {
					holder.top_liege = {
						this != root.top_liege
					}
				}
				holder.top_liege = { save_scope_as = neighbor }
			}
		}
	}
	
	option = {
		name = governor_contract_event.2030.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2031
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the village
governor_contract_event.2031 = {
	type = character_event
	title = governor_contract_event.2030.t
	desc = governor_contract_event.2031.desc
	theme = administrative
	override_background = { reference = ep2_hunt_poachers_camp }
	left_portrait = {
		character = root
		animation = debating
	}
	right_portrait = {
		character = scope:peasant
		animation = celebrate_spear
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = raiding_peasants
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}

		hidden_effect = {
			random_pool_character = {
				province = root.location
				limit = {
					has_dynasty = no
					martial >= 8
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				save_scope_as = peasant
			}
			scope:peasant ?= { add_trait = peasant_leader }
			if = {
				limit = {
					NOT = { exists = scope:peasant }
				}
				create_character = {
					template = peasant_faction_leader_template
					location = root.location
					culture = scope:ongoing_destination.county.culture
					faith = scope:ongoing_destination.county.faith
					gender_female_chance = root_soldier_female_chance
					save_scope_as = peasant
				}
				if = {
					limit = {
						is_ai = yes
					}
					scope:peasant = { add_character_flag = generated }
				}
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 5 }
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.2031.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:peasant = { add_to_court_and_entourage_only_effect = yes }
		if = {
			limit = {
				maa_regiments_count < maa_regiments_max_count
			}
			create_maa_regiment = {
				type = light_footmen
				check_can_recruit = yes
				size = 3
			}
		}
		scope:ongoing_contract = {
			complete_task_contract = peasant_enroll
		}
		scope:peasant = {
			remove_character_flag = generated
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2031.b
		trigger = { exists = scope:governance_option_b }
		scope:peasant = {
			death = { death_reason = death_execution killer = root }
		}
		scope:ongoing_contract = {
			complete_task_contract = peasant_punish
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
				ai_vengefulness = 0.5	
			}
		}
	}
	option = {
		name = governor_contract_event.2031.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = peasant_encourage
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2031.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = peasant_work
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2031.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = peasant_take
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
			if = {
				limit = {
					scope:peasant ?= { has_character_flag = generated }
				}
				scope:peasant = { silent_disappearance_effect = yes }
			}
		}
	}
}

### Wild Predators
# Intro event
governor_contract_event.2040 = {
	type = character_event
	title = governor_contract_event.2040.t
	desc = governor_contract_event.2040.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = wild_predators
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		select_local_animal_effect = { TYPE = prowling }
	}
	
	option = {
		name = governor_contract_event.2040.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2041
		}
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the place
governor_contract_event.2041 = {
	type = character_event
	title = governor_contract_event.2040.t
	desc = governor_contract_event.2041.desc
	theme = administrative
	override_background = { reference = ep2_hunt_poachers_camp }
	left_portrait = {
		character = root
		animation = personality_bold
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = wild_predators
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 6 }
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.2041.a
		flavor = governor_contract_event.2041.a.tt
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = predators_poisoners
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2041.b
		trigger = { exists = scope:governance_option_b }
		duel = {
			skill = prowess
			value = decent_skill_rating
			50 = {
				desc = governor_contract_event.2041.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					has_trait = lifestyle_hunter
					add = 20
				}
				modifier = {
					has_trait_xp = {
						trait = lifestyle_hunter
						track = hunter
						value >= trait_second_level
					}
					add = 20
				}
				save_scope_value_as = {
					name = governor_contract_event_2041_duel
					value = flag:predators_hunt
				}
				trigger_event = governor_contract_event.2042
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = predators_hunt
					}
				}
			}
			50 = {
				desc = governor_contract_event.2041.b.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				trigger_event = governor_contract_event.2043
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
					increase_wounds_no_death_effect = { REASON = wild_animal }
				}
				add_character_flag = {
					flag = governor_contract_event_2043_wounded
					days = 5
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2041.c
		trigger = { exists = scope:governance_option_c }
		duel = {
			skill = stewardship
			value = average_skill_rating
			50 = {
				desc = governor_contract_event.2041.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				save_scope_value_as = {
					name = governor_contract_event_2041_duel
					value = flag:predators_hunters
				}
				trigger_event = governor_contract_event.2042
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = predators_hunters
					}
				}
			}
			50 = {
				desc = governor_contract_event.2041.c.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				trigger_event = governor_contract_event.2043
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_boldness = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2041.d
		trigger = { exists = scope:governance_option_d }
		random_list = {
			50 = {
				desc = governor_contract_event.2041.d.success
				modifier = {
					scope:ongoing_destination.county = {
						development_level >= medium_development_level
					}
					add = 10
				}
				modifier = {
					add = scope:ongoing_destination.holder.prowess
					exists = scope:ongoing_destination.holder
				}
				save_scope_value_as = {
					name = governor_contract_event_2041_duel
					value = flag:predators_locals
				}
				trigger_event = governor_contract_event.2042
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = predators_locals
					}
				}
			}
			50 = {
				desc = governor_contract_event.2041.d.fail
				modifier = {
					scope:ongoing_destination.county = {
						development_level <= bad_development_level
					}
					add = 10
				}
				trigger_event = governor_contract_event.2043
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
			}
		}
	}
	option = {
		name = governor_contract_event.2041.e
		flavor = governor_contract_event.2041.e.tt
		trigger = { exists = scope:governance_option_e }
		duel = {
			skill = martial
			value = decent_skill_rating
			50 = {
				desc = governor_contract_event.2041.e.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				save_scope_value_as = {
					name = governor_contract_event_2041_duel
					value = flag:predators_capture
				}
				trigger_event = governor_contract_event.2042
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = predators_capture
					}
				}
			}
			50 = {
				desc = governor_contract_event.2041.e.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				trigger_event = governor_contract_event.2043
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_rationality = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2041.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = predators_preys
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -0.5
				ai_greed = -0.5
			}
		}
	}
	
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

#Success
governor_contract_event.2042 = {
	type = character_event
	title = governor_contract_event.2040.t
	desc = governor_contract_event.2042.desc
	theme = administrative
	override_background = { reference = ep2_hunt_poachers_camp }
	left_portrait = {
		character = root
		animation = personality_bold
	}

	option = {
		name = governor_contract_event.2042.a
		scope:ongoing_contract = {
			if = {
				limit = {
					scope:governor_contract_event_2041_duel ?= flag:predators_hunt
				}
				complete_task_contract = predators_hunt
			}
			else_if = {
				limit = {
					scope:governor_contract_event_2041_duel ?= flag:predators_hunters
				}
				complete_task_contract = predators_hunters
			}
			else_if = {
				limit = {
					scope:governor_contract_event_2041_duel ?= flag:predators_locals
				}
				complete_task_contract = predators_locals
			}
			else_if = {
				limit = {
					scope:governor_contract_event_2041_duel ?= flag:predators_capture
				}
				complete_task_contract = predators_capture
			}
		}
	}
}

#Failure
governor_contract_event.2043 = {
	type = character_event
	title = governor_contract_event.2040.t
	desc = governor_contract_event.2043.desc
	theme = administrative
	override_background = {
		trigger = {
			has_character_flag = governor_contract_event_2043_wounded
		}
		reference = wilderness
	}
	override_background = {
		trigger = {
			NOT = { has_character_flag = governor_contract_event_2043_wounded }
		}
		reference = ep2_hunt_poachers_camp
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_character_flag = governor_contract_event_2043_wounded
			}
			animation = stayback
		}
		triggered_animation = {
			trigger = {
				NOT = {
					has_character_flag = governor_contract_event_2043_wounded
				}
			}
			animation = disapproval
		}
	}

	option = {
		name = governor_contract_event.2043.a
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		if = {
			limit = {
				has_character_flag = governor_contract_event_2043_wounded
			}
			increase_wounds_no_death_effect = { REASON = wild_animal }
		}
	}
}

### Evil Presence
# Intro event
governor_contract_event.2050 = {
	type = character_event
	title = governor_contract_event.2050.t
	desc = {
		desc = governor_contract_event.2050.desc
		random_valid = {
			desc = governor_contract_event.2051.desc_a
			desc = governor_contract_event.2051.desc_b
			desc = governor_contract_event.2051.desc_c
			desc = governor_contract_event.2051.desc_d
			desc = governor_contract_event.2051.desc_e
		}
		random_valid = {
			desc = governor_contract_event.2051.desc_f
			desc = governor_contract_event.2051.desc_g
			desc = governor_contract_event.2051.desc_h
			desc = governor_contract_event.2051.desc_i
		}
		random_valid = {
			desc = governor_contract_event.2051.desc_l
			desc = governor_contract_event.2051.desc_m
			desc = governor_contract_event.2051.desc_n
			desc = governor_contract_event.2051.desc_o
			desc = governor_contract_event.2051.desc_p
			desc = governor_contract_event.2051.desc_q
		}
		desc = governor_contract_event.2051.desc_end
	}
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = worry
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = evil_presence
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
	}
	
	option = {
		name = governor_contract_event.2050.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2051
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the place
governor_contract_event.2051 = {
	type = character_event
	title = governor_contract_event.2050.t
	desc = governor_contract_event.2051.desc
	theme = administrative
	override_background = { reference = ep2_hunt_foggy_forest }
	override_effect_2d = { reference = fog }
	left_portrait = {
		character = root
		animation = worry
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = evil_presence
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		
		generate_governance_outcome_effect = { OPTIONS = 5 }
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
	}
	
	option = { # Special governor trait option
		name = governor_contract_event.2051.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = presence_official
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2051.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = presence_exorcize
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2051.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = presence_sorcerer
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_vengefulness = 0.5
				ai_rationality = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2051.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = presence_local
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -0.5
				ai_sociability = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2051.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = presence_rationalize
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

### Miraculous Healing
# Intro event
governor_contract_event.2060 = {
	type = character_event
	title = governor_contract_event.2060.t
	desc = governor_contract_event.2060.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:scammer
		animation = beg
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = miraculous_healing
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		random_pool_character = {
			province = scope:ongoing_destination
			limit = {
				is_adult = yes
				OR = {
					has_trait = eccentric
					has_trait = deceitful
					has_trait = zealous
					has_trait = lifestyle_mystic
				}
				intrigue >= 12
			}
			save_scope_as = scammer
		}
		if = {
			limit = {
				NOT = { exists = scope:scammer }
			}
			create_character = {
				location = root.location
				template = scammer_template
				save_scope_as = scammer
				after_creation = {
					add_character_flag = created
				}
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 6 }
		scope:scammer = { assign_quirk_effect = yes }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2060.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = healing_example
		}
		# We blind the scammer as punishment
		scope:scammer = { add_trait = blind }
		
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2060.b
		trigger = { exists = scope:governance_option_b }
		scope:scammer = { remove_character_flag = created_character }
		add_courtier = scope:scammer
		scope:ongoing_contract = {
			complete_task_contract = healing_hire
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2060.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = healing_relic
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = -0.5
				ai_greed = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2060.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = healing_fine
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2060.e
		trigger = { exists = scope:governance_option_e }
		scope:scammer = { remove_character_flag = created_character }
		rightfully_imprison_character_effect = {
			TARGET = scope:scammer
			IMPRISONER = root
		}
		scope:ongoing_contract = {
			complete_task_contract = healing_imprison
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2060.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = healing_faith
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	after = {
		scope:scammer = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

### Buried Treasure
# Intro event
governor_contract_event.2070 = {
	type = character_event
	title = governor_contract_event.2070.t
	desc = governor_contract_event.2070.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = buried_treasure
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
	}

	option = {
		name = governor_contract_event.2070.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2071
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the place
governor_contract_event.2071 = {
	type = character_event
	title = governor_contract_event.2070.t
	desc = {
		desc = governor_contract_event.2071.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					liege = { has_title = title:e_byzantium }
				}
				desc = governor_contract_event.2071.desc.byz
			}
			desc = governor_contract_event.2071.desc.fallback
		}
		desc = governor_contract_event.2071.desc.end
	}
	theme = administrative
	override_background = { reference = market }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
			animation = acknowledging # anim uses crucifix scepter
		}
		animation = war_over_tie
	}
	right_portrait = {
		character = scope:peasant
		animation = beg
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = buried_treasure
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}

		random_pool_character = {
			province = scope:ongoing_destination
			limit = {
				is_adult = yes
				has_dynasty = no
			}
			save_scope_as = peasant
		}
		if = {
			limit = {
				NOT = { exists = scope:peasant }
			}
			create_character = {
				location = root.location
				template = generic_peasant_character
				save_scope_as = peasant
			}
			if = {
				limit = {
					is_ai = yes
				}
				scope:peasant = { add_character_flag = created_character }
			}
		}
		hidden_effect = {
			scope:peasant = { add_gold = root.medium_gold_value }
		}
		generate_governance_outcome_effect = { OPTIONS = 5 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2071.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = treasure_invest
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2071.b
		trigger = { exists = scope:governance_option_b }
		scope:peasant = {
			pay_treasury_or_gold = {
				target = root
				value = root.minor_treasury_or_gold_value
			}
		}
		scope:ongoing_contract = {
			complete_task_contract = treasure_tax
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2071.c
		trigger = { exists = scope:governance_option_c }
		scope:peasant = {
			pay_treasury_or_gold = {
				target = root
				value = root.medium_treasury_or_gold_value
			}
		}
		scope:ongoing_contract = {
			complete_task_contract = treasure_commandeer
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_honor = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2071.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = treasure_acknowledge
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2071.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = treasure_distribute
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
	after = {
		scope:peasant = {
			if = {
				limit = {
					 has_character_flag = created_character
				}
				silent_disappearance_effect = yes
			}
		}
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

### Public Land
# Intro event
governor_contract_event.2080 = {
	type = character_event
	title = governor_contract_event.2080.t
	desc = governor_contract_event.2080.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
	}
	lower_right_portrait = scope:magnate
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = public_land
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
			task_contract_employer = {
				save_scope_as = magnate
			}
		}
	}

	option = {
		name = governor_contract_event.2080.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2081
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the place
governor_contract_event.2081 = {
	type = character_event
	title = governor_contract_event.2080.t
	desc = governor_contract_event.2081.desc
	theme = administrative
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:magnate
		animation = beg
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = buried_treasure
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
			task_contract_employer = {
				save_scope_as = magnate
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}

		generate_governance_outcome_effect = { OPTIONS = 5 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2081.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:magnate = {
			add_opinion = {
				target = root
				modifier = disrespect_opinion
				opinion = -20
			}
		}
		scope:ongoing_contract = {
			complete_task_contract = land_reinstate
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2081.b
		trigger = { exists = scope:governance_option_b }
		scope:magnate = {
			add_opinion = {
				target = root
				modifier = disrespect_opinion
				opinion = -20
			}
		}
		scope:ongoing_contract = {
			complete_task_contract = land_confiscate
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2081.c
		trigger = { exists = scope:governance_option_c }
		scope:magnate = {
			pay_short_term_gold = {
				target = root
				gold = medium_gold_value
			}
		}
		scope:ongoing_contract = {
			complete_task_contract = land_bribe
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_honor = -0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2081.d
		trigger = { exists = scope:governance_option_d }
		add_hook = {
			target = scope:magnate
			type = favor_hook
		}
		scope:ongoing_contract = {
			complete_task_contract = land_favor
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
				ai_vengefulness = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2081.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = land_people
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

### The Mad Prophet
# Intro event
governor_contract_event.2090 = {
	type = character_event
	title = governor_contract_event.2090.t
	desc = governor_contract_event.2090.desc
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = mad_prophet
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
	}

	option = {
		name = governor_contract_event.2090.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2091
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the place
governor_contract_event.2091 = {
	type = character_event
	title = governor_contract_event.2090.t
	desc = governor_contract_event.2091.desc
	theme = administrative
	override_background = {
		trigger = {
			location.county.culture = {
				OR = {
					has_graphical_mediterranean_culture_group_trigger = yes
					has_graphical_mena_culture_group_trigger = yes
					has_graphical_african_culture_group_trigger = yes
				}
			}
			location.barony.holder = {
				NOT = { government_has_flag = government_is_tribal }
			}
		}
		reference = ep3_city_gate
	} 
	override_background = {
		trigger = {
			OR = {
				location.county.culture = {
					NOR = {
						has_graphical_mediterranean_culture_group_trigger = yes
						has_graphical_mena_culture_group_trigger = yes
						has_graphical_african_culture_group_trigger = yes
					}
				}
				location.barony.holder = {
					government_has_flag = government_is_tribal
				}
			}
		}
		reference = market
	}
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:prophet
		animation = rage
		outfit_tags = { beggar_rags }
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = mad_prophet
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}

		random_pool_character = {
			province = root.location
			limit = {
				is_adult = yes
				has_trait = zealous
				learning >= 12
				faith = scope:ongoing_destination.county.faith
			}
			save_scope_as = prophet
		}
		if = {
			limit = {
				NOT = { exists = scope:prophet }
			}
			create_character = {
				location = root.location
				template = local_saint_template
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = prophet
				after_creation = {
					add_character_flag = created
				}
			}
		}
		hidden_effect = {
			scope:prophet = {
				give_nickname = nick_the_prophet
				add_trait = eccentric
			}
		}

		generate_governance_outcome_effect = { OPTIONS = 6 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2091.a
		flavor = governor_contract_event.2091.a.tt
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = prophet_reassure
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2091.b
		trigger = { exists = scope:governance_option_b }
		duel = {
			skill = martial
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				save_scope_value_as = {
					name = governor_contract_event_2091_duel
					value = flag:prophet_persecute
				}
				trigger_event = governor_contract_event.2092
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = prophet_persecute
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				save_scope_value_as = {
					name = governor_contract_event_2091_duel
					value = flag:prophet_persecute
				}
				trigger_event = governor_contract_event.2093
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2091.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = prophet_arrest
		}
		rightfully_imprison_character_less_verbose_effect = {
			TARGET = scope:prophet
			IMPRISONER = root
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_honor = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2091.d
		trigger = { exists = scope:governance_option_d }
		duel = {
			skill = learning
			target = scope:prophet
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				save_scope_value_as = {
					name = governor_contract_event_2091_duel
					value = flag:prophet_debate
				}
				trigger_event = governor_contract_event.2092
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = prophet_debate
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				save_scope_value_as = {
					name = governor_contract_event_2091_duel
					value = flag:prophet_debate
				}
				trigger_event = governor_contract_event.2093
				show_as_tooltip = {
					scope:ongoing_contract = {
						complete_task_contract = failure_standard
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2091.e
		flavor = governor_contract_event.2091.e.tt
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = prophet_ceremonies
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2091.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = prophet_clergy
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_energy = -0.5
			}
		}
	}
	after = {
		hidden_effect = {
			if = {
				limit = {
					NOT = {
						exists = scope:governor_contract_event_2091_duel
					}
				}
				current_travel_plan ?= { resume_travel_plan = yes }
			}
		}
		scope:prophet = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

#Success
governor_contract_event.2092 = {
	type = character_event
	title = governor_contract_event.2090.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:governor_contract_event_2091_duel ?= flag:prophet_persecute
				}
				desc = governor_contract_event.2092.desc_persecute
			}
			desc = governor_contract_event.2092.desc_debate
		}
	}
	theme = administrative
	override_background = { reference = market }
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:prophet
		animation = war_over_loss
		outfit_tags = { beggar_rags }
	}

	option = {
		name = governor_contract_event.2092.a
		scope:ongoing_contract = {
			if = {
				limit = {
					scope:governor_contract_event_2091_duel ?= flag:prophet_persecute
				}
				complete_task_contract = prophet_persecute
			}
			else_if = {
				limit = {
					scope:governor_contract_event_2091_duel ?= flag:prophet_debate
				}
				complete_task_contract = prophet_debate
			}
		}
	}

	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

#Failure
governor_contract_event.2093 = {
	type = character_event
	title = governor_contract_event.2090.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:governor_contract_event_2091_duel ?= flag:prophet_persecute
				}
				desc = governor_contract_event.2093.desc_persecute
			}
			desc = governor_contract_event.2093.desc_debate
		}
	}
	theme = administrative
	override_background = { reference = market }
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:prophet
		animation = personality_bold
		outfit_tags = { beggar_rags }
	}

	option = {
		name = governor_contract_event.2093.a
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
	}

	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
		}
	}
}

### Titles for Sale
# Intro event
governor_contract_event.2100 = {
	type = character_event
	title = governor_contract_event.2100.t
	desc = governor_contract_event.2100.desc
	theme = administrative
	override_background = { reference = holy_site_generic }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion } }
			animation = emotion_thinking_scepter
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:priest
		animation = sadness
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = titles_sale
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		random_pool_character = {
			province = root.location
			limit = {
				is_adult = yes
				learning >= 10
				intrigue >= 10
				NOR = {
					has_trait = honest
					has_trait = generous
					has_trait = zealous
				}
				faith = root.faith
				trigger_if = {
					limit = { faith = { has_doctrine_parameter = clergy_must_be_male } }
					is_female = no
				}
				trigger_else_if = {
					limit = { faith = { has_doctrine_parameter = clergy_must_be_female } }
					is_female = yes
				}
				trigger_else = { always = yes }
			}
			save_scope_as = priest
			add_character_flag = need_priest_outfit
		}
		if = {
			limit = {
				NOT = { exists = scope:priest }
			}
			create_character = {
				location = root.location
				template = priest_character_template
				save_scope_as = priest
			}
			scope:priest = { add_character_flag = created }
		}
		generate_governance_outcome_effect = { OPTIONS = 4 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2100.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = titles_repay
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2100.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = titles_commandeer
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2100.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = titles_back
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2100.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = titles_bribe
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
			}
		}
	}
	after = {
		if = {
			limit = {
				is_ai = yes
				scope:priest = { has_character_flag = created }
			}
			scope:priest = { silent_disappearance_effect = yes }
		}
	}
}

### Hungry Times
# Intro event
governor_contract_event.2110 = {
	type = character_event
	title = governor_contract_event.2110.t
	desc = {
		desc = governor_contract_event.2110.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					any_character_active_contract = {
						task_contract_type = hungry_times
						task_contract_tier >= define:NTaskContract|HIGH_TASK_CONTRACT_TIER
					}
				}
				desc = governor_contract_event.2110.desc_murder
			}
			triggered_desc = {
				trigger = {
					any_character_active_contract = {
						task_contract_type = hungry_times
						task_contract_tier = define:NTaskContract|MEDIUM_TASK_CONTRACT_TIER
					}
				}
				desc = governor_contract_event.2110.desc_cannibal
			}
			desc = governor_contract_event.2110.desc_animal
		}
	}
	theme = administrative
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = hungry_times
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
	}

	option = {
		name = governor_contract_event.2110.a
		custom_tooltip = governor_contract_event.2030.a.tt
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:ongoing_destination
			ARRIVAL_EVENT = governor_contract_event.2111
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				is_available = no
			}
			modifier = {
				factor = 0.5
				has_trait = lazy
			}
		}
	}
	
	option = {
		name = governor_contract_event.1030.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
			
			modifier = {
				add = 100
				is_available = no
			}
			modifier = {
				add = 100
				has_trait = lazy
			}
		}
	}
}

# Arrival at the place
governor_contract_event.2111 = {
	type = character_event
	title = governor_contract_event.2110.t
	desc = governor_contract_event.2111.desc
	theme = administrative
	override_background = { reference = market }
	left_portrait = {
		character = root
		animation = disgust
	}
	right_portrait = {
		character = scope:cannibal
		animation = prisondungeon
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = hungry_times
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}

		random_pool_character = {
			province = root.location
			limit = {
				is_adult = yes
				culture = scope:ongoing_destination.county.culture
				faith = scope:ongoing_destination.county.faith
				has_dynasty = no
			}
			save_scope_as = cannibal
			add_character_flag = peasant_outfit
		}
		if = {
			limit = {
				NOT = { exists = scope:cannibal }
			}
			create_character = {
				location = root.location
				template = generic_peasant_character
				save_scope_as = cannibal
			}
			scope:cannibal = { add_character_flag = created }
		}

		generate_governance_outcome_effect = { OPTIONS = 5 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2111.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = hungry_support
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2111.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = hungry_amnesty
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2111.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = hungry_punish
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_vengefulness = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2111.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = hungry_persecute
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
	option = {
		name = governor_contract_event.2111.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = hungry_control
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	after = {
		hidden_effect = {
			current_travel_plan ?= { resume_travel_plan = yes }
			scope:cannibal = {
				if = {
					limit = {
						has_character_flag = created
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}

### Wartime Measures
# Intro event
governor_contract_event.2120 = {
	type = character_event
	title = governor_contract_event.2120.t
	desc = governor_contract_event.2120.desc
	theme = administrative
	left_portrait = {
		character = root
		animation = reading
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			task_contract_type = wartime_measures
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 6 }
	}

	option = { # Special governor trait option
		name = governor_contract_event.2120.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = wartime_support
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = governor_contract_event.2120.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = wartime_supplies
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_energy = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2120.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = wartime_lodgings
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_honor = 0.5
			}
		}
	}
	option = {
		name = governor_contract_event.2120.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = wartime_gold
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
			}
			modifier = {
				gold <= major_gold_value
				factor = 0
			}
		}
	}
	option = {
		name = governor_contract_event.2120.e
		trigger = { exists = scope:governance_option_e }
		scope:ongoing_contract = {
			complete_task_contract = wartime_lookouts
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_boldness = -0.5
			}
			modifier = {
				gold <= medium_gold_value
				factor = 0
			}
		}
	}
	option = {
		name = governor_contract_event.2120.f
		trigger = { exists = scope:governance_option_f }
		scope:ongoing_contract = {
			complete_task_contract = wartime_compensations
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
}
