##########################
# NATURAL DISASTER CONTRACT EVENTS
##########################
namespace = tgp_natural_disaster_contract_event

### Food Shortage
tgp_natural_disaster_contract_event.0001 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0001.t
	desc = tgp_natural_disaster_contract_event.0001.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_food_shortage
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = natural_disaster_contract_destination
			}
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0001.a
		
		custom_tooltip = tgp_natural_disaster_travel_to_contract_destination
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:natural_disaster_contract_destination
			ARRIVAL_EVENT = tgp_natural_disaster_contract_event.0002
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0001.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
		}
	}
}

tgp_natural_disaster_contract_event.0002 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0002.t
	desc = tgp_natural_disaster_contract_event.0002.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = {
		reference = ruined_holding
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_food_shortage
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 4 }
	}

	option = { # Special governor trait option
		name = tgp_natural_disaster_contract_event.0002.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = distribution_of_food
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0002.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = pay_from_own_pocket
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0002.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = haggle_with_merchants
		}
		duel = {
			skill = stewardship
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0002.c.tt.success
				scope:ongoing_contract ?= {
					complete_task_contract = haggle_with_merchants
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0002.c.tt.failure
				scope:ongoing_contract ?= {
					complete_task_contract = haggle_with_merchants_failure
				}
			}
		}
		ai_chance = {
			base = 50
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0002.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = demand_food_from_nobles
		}
		ai_chance = {
			base = 80
		}
	}
}

### Destroyed by Nature
tgp_natural_disaster_contract_event.0005 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0005.t
	desc = tgp_natural_disaster_contract_event.0005.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_ravaged_buildings
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = natural_disaster_contract_destination
			}
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0005.a
		
		custom_tooltip = tgp_natural_disaster_travel_to_contract_destination
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:natural_disaster_contract_destination
			ARRIVAL_EVENT = tgp_natural_disaster_contract_event.0006
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0005.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
		}
	}
}

tgp_natural_disaster_contract_event.0006 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0006.t
	desc = tgp_natural_disaster_contract_event.0006.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = {
		reference = ruined_holding
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_ravaged_buildings
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 4 }
	}

	option = { # Special governor trait option
		name = tgp_natural_disaster_contract_event.0006.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = rebuild_settlement
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0006.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = temporary_shelters
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0006.c
		trigger = { exists = scope:governance_option_c }
		duel = {
			skills = { martial stewardship }
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0006.c.tt.desc.success
				scope:ongoing_contract = {
					complete_task_contract = remove_debris
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0006.c.tt.desc.failure
				scope:ongoing_contract = {
					complete_task_contract = remove_debris_failure
				}
			}
		}
		ai_chance = {
			base = 80
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0006.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = labor_exchange
		}
		ai_chance = {
			base = 50
		}
	}
}

### Treating the Innocents
tgp_natural_disaster_contract_event.0010 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0010.t
	desc = tgp_natural_disaster_contract_event.0010.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_medieval_medicine
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = natural_disaster_contract_destination
			}
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0010.a
		
		custom_tooltip = tgp_natural_disaster_travel_to_contract_destination
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:natural_disaster_contract_destination
			ARRIVAL_EVENT = tgp_natural_disaster_contract_event.0011
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0010.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
		}
	}
}

tgp_natural_disaster_contract_event.0011 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0011.t
	desc = tgp_natural_disaster_contract_event.0011.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = {
		reference = ruined_holding
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_medieval_medicine
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 4 }
	}

	option = { # Special governor trait option
		name = tgp_natural_disaster_contract_event.0011.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		scope:ongoing_contract = {
			complete_task_contract = assisting_physician
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0011.b
		trigger = { exists = scope:governance_option_b }
		duel = {
			skill = learning
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0011.b.tt.success
				scope:ongoing_contract = {
					complete_task_contract = medical_assistance
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0011.b.tt.failure
				scope:ongoing_contract = {
					complete_task_contract = medical_assistance_failure
				}
			}
		}
		ai_chance = {
			base = 50
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0011.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = prayers_to_the_people
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0011.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = better_pay_up
		}
		ai_chance = {
			base = 100
		}
	}
}

### Provisional Relocation
tgp_natural_disaster_contract_event.0015 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0015.t
	desc = tgp_natural_disaster_contract_event.0015.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_disaster_displacement
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = natural_disaster_contract_destination
			}
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0015.a
		
		custom_tooltip = tgp_natural_disaster_travel_to_contract_destination
		governor_contract_travel_or_progress_effect = {
			DESTINATION = scope:natural_disaster_contract_destination
			ARRIVAL_EVENT = tgp_natural_disaster_contract_event.0016
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_natural_disaster_contract_event.0015.b
		scope:ongoing_contract = {
			complete_task_contract = failure_standard
		}
		
		ai_chance = {
			base = 0
		}
	}
}

tgp_natural_disaster_contract_event.0016 = {
	type = character_event
	title = tgp_natural_disaster_contract_event.0016.t
	desc = tgp_natural_disaster_contract_event.0016.desc
	theme = disaster
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = {
		reference = ruined_holding
	}
	
	immediate = {
		# Save the contract
		random_character_active_contract = {
			limit = {
				has_task_contract_type = tgp_disaster_displacement
			}
			save_scope_as = ongoing_contract
			
			# Save the location
			task_contract_location = {
				save_scope_as = ongoing_destination
			}
		}
		generate_governance_outcome_effect = { OPTIONS = 4 }
	}

	option = { # Special governor trait option
		name = tgp_natural_disaster_contract_event.0016.a
		trigger = {
			has_trait = governor # To show that the trait unlocks the option
			exists = scope:governance_option_a
		}
		duel = {
			skill = martial
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0016.a.tt.desc.success
				scope:ongoing_contract = {
					complete_task_contract = deployed_troops
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = tgp_natural_disaster_contract_event.0016.a.tt.desc.failure
				scope:ongoing_contract = {
					complete_task_contract = deployed_troops_failure
				}
			}
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0016.b
		trigger = { exists = scope:governance_option_b }
		scope:ongoing_contract = {
			complete_task_contract = setting_an_example
		}
		ai_chance = {
			base = 80
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0016.c
		trigger = { exists = scope:governance_option_c }
		scope:ongoing_contract = {
			complete_task_contract = confiscate_for_personal_inspection
		}
		ai_chance = {
			base = 50
		}
	}
	option = {
		name = tgp_natural_disaster_contract_event.0016.d
		trigger = { exists = scope:governance_option_d }
		scope:ongoing_contract = {
			complete_task_contract = paying_off_the_looters
		}
		ai_chance = {
			base = 100
		}
	}
}
