#Mandala Task Contract Events

namespace = tgp_east_asia_mandala_task_contract_events


#Cancel travel plan confirmation
tgp_east_asia_mandala_task_contract_events.0990 = {
    type = character_event
    title = tgp_east_asia_mandala_task_contract_events.0990.t
    desc = tgp_east_asia_mandala_task_contract_events.0990.desc
    theme = mandala
    left_portrait = {
        character = root
        animation = pondering
    }
    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
            }
        }
    }
    # On second thought, let's go!
    option = {
        name = tgp_east_asia_mandala_task_contract_events.0990.a
        custom_tooltip = tgp_east_asia_mandala_task_contract_events.0990.a_tt
		if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0001 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1000
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0002 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1100
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0003 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1200
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0004 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1300
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0005 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1400
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0006 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1500
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0007 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1600
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0008 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1700
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0009 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1800
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0010 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.1900
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0011 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2000
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0012 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2100
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0013 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2200
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0014 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2300
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0015 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2400
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0016 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2500
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0017 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2600
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0018 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2700
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0019 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2800
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0020 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.2900
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0021 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3000
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0022 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3100
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0023 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3200
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0024 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3300
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0025 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3400
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0026 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3500
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0027 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3600
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0028 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3700
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0029 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3800
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0030 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.3900
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0031 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4000
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0032 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4100
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0033 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4200
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0034 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4300
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0035 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4400
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0036 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4500
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0037 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4600
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0038 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4700
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0039 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4800
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0040 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.4900
			}
        }
		else_if = {
            limit = { 
                scope:ongoing_contract = { has_task_contract_type = mandala_realm_contract_0041 }
            }
			mandala_travel_to_contract_location_effect = {
				DESTINATION = scope:ongoing_destination
				ARRIVAL_EVENT = tgp_east_asia_mandala_task_contract_events.5000
			}
        }
    }
    # I have more important matters to deal with.
    option = { 
        name = tgp_east_asia_mandala_task_contract_events.0990.b
        scope:ongoing_contract = { complete_task_contract = failure_standard }
        hidden_effect = {
            current_travel_plan ?= {
                resume_travel_plan = yes 
            }
        }
        custom_tooltip = tgp_east_asia_mandala_task_contract_events.0990.b_tt
    }
}


scripted_trigger default_local_character_1000_trigger = {
	is_available_adult = yes
	culture = scope:ritual_location.culture
	faith = scope:ritual_location.faith
	NOR = { 
		has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
		has_any_good_relationship_with_character_trigger = { CHARACTER = root }
	}
	trigger_if = {
		limit = {
			faith = { has_doctrine_parameter = clergy_must_be_female }
		}
		is_female = yes
	}
	trigger_if = {
		limit = {
			faith = { has_doctrine_parameter = clergy_must_be_male }
		}
		is_male = yes
	}
}

tgp_east_asia_mandala_task_contract_events.1000 = {
	type = character_event
	window = big_event_window
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { 
					house = { has_house_aspiration_parameter = aspect_of_creation } 
				}
				desc = tgp_east_asia_mandala_task_contract_events.1000.t.creation
			}
			triggered_desc = {
				trigger = { 
					house = { has_house_aspiration_parameter = aspect_of_serenity } 
				}
				desc = tgp_east_asia_mandala_task_contract_events.1000.t.serenity
			}
			triggered_desc = {
				trigger = { 
					house = { has_house_aspiration_parameter = aspect_of_destruction } 
				}
				desc = tgp_east_asia_mandala_task_contract_events.1000.t.destruction
			}
			desc = tgp_east_asia_mandala_task_contract_events.1000.t.trickery
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { 
					house = { has_house_aspiration_parameter = aspect_of_creation } 
				}
				desc = tgp_east_asia_mandala_task_contract_events.1000.desc.creation
			}
			triggered_desc = {
				trigger = { 
					house = { has_house_aspiration_parameter = aspect_of_serenity } 
				}
				desc = tgp_east_asia_mandala_task_contract_events.1000.desc.serenity
			}
			triggered_desc = {
				trigger = { 
					house = { has_house_aspiration_parameter = aspect_of_destruction } 
				}
				desc = tgp_east_asia_mandala_task_contract_events.1000.desc.destruction
			}
			desc = tgp_east_asia_mandala_task_contract_events.1000.desc.trickery
		}
	}
	theme = mandala
	#Indenting background overrides for easier overview
		override_background = {
			trigger = { 
				house = { has_house_aspiration_parameter = aspect_of_creation }
			}
			reference = holy_site_generic
		}
		override_background = {
			trigger = { 
				house = { has_house_aspiration_parameter = aspect_of_serenity }
			}
			reference = garden
		}
		override_background = {
			trigger = { 
				house = { has_house_aspiration_parameter = aspect_of_destruction } 
			}
			reference = ep2_tournament
		}
		override_background = {
			trigger = { 
				house = { has_house_aspiration_parameter = aspect_of_trickery } 
			}
			reference = temple
		}
		override_header_background = { 
			trigger = {
				house = { has_house_aspiration_parameter = aspect_of_creation } 
			}
			reference = "gfx/interface/window_event/event_header_green.dds"
		}
		override_header_background = { 
			trigger = {
				house = { has_house_aspiration_parameter = aspect_of_destruction } 
			}
			reference = "gfx/interface/window_event/event_header_red.dds"
		}
		override_header_background = { 
			trigger = {
				house = { has_house_aspiration_parameter = aspect_of_trickery } 
			}
			reference = "gfx/interface/window_event/event_header_purple.dds"
		}
	left_portrait = {
		character = root
		animation = personality_compassionate
	}
	right_portrait = {
		character = scope:local_character
		triggered_animation = {
			trigger = { 
				root.house = { has_house_aspiration_parameter = aspect_of_destruction } 
			}
			animation = marshal_random_weapon
		}
		animation = obsequious_bow
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = { save_scope_as = ritual_location }
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					default_local_character_1000_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = { default_local_character_1000_trigger = yes }
				save_scope_as = local_character
			}
		}
		else = {
			hidden_effect_new_object = {
				random_list = {
					90 = {
						create_character = {
							template = pool_repopulate_learning
							faith = scope:ritual_location.faith
							culture = scope:ritual_location.culture
							location = scope:ritual_location
							save_scope_as = local_character
							after_creation = {
								add_character_flag = created
							}
						}
					}
					5 = {
						create_character = {
							template = default_mystic_character
							faith = scope:ritual_location.faith
							culture = scope:ritual_location.culture
							location = scope:ritual_location
							save_scope_as = local_character
							after_creation = {
								add_character_flag = created
							}
						}
					}
					5 = {
						trigger = {
							OR = {
								AND = {
									is_attracted_to_women = yes
									scope:ritual_location.faith = { 
										OR = {
											has_doctrine_parameter = clergy_must_be_female
											has_doctrine_parameter = clergy_can_be_either_gender
										}
									}
								}
								AND = {
									is_attracted_to_men = yes
									scope:ritual_location.faith = { 
										OR = {
											has_doctrine_parameter = clergy_must_be_male
											has_doctrine_parameter = clergy_can_be_either_gender
										}
									}
								}
							}
						}
						if = {
							limit = {
								scope:ritual_location.faith	= { has_doctrine_parameter = clergy_must_be_female }
							}
							dummy_female = { save_scope_as = dummy_clergy_gender }
						}
						else_if = {
							limit = {
								scope:ritual_location.faith	= { has_doctrine_parameter = clergy_must_be_male }
							}
							dummy_male = { save_scope_as = dummy_clergy_gender }
						}
						else = {
							random_list = {
								50 = {
									dummy_female = { save_scope_as = dummy_clergy_gender }
								}
								50 = {
									dummy_male = { save_scope_as = dummy_clergy_gender }
								}
							}
						}
						create_character = {
							template = beautiful_peasant_character
							age = { age_compared_to_root_minus_ten_always_adult age_compared_to_root_plus_ten_always_adult }
							gender = scope:dummy_clergy_gender
							faith = scope:ritual_location.faith
							culture = scope:ritual_location.culture
							location = scope:ritual_location
							after_creation = {
								#Sometimes adjust sexuality to create compatibility with root
								if = {
									limit = {
										root = { is_attracted_to_gender_of = prev }
										NOT = { is_attracted_to_gender_of = root }
									}
									set_sexuality = bisexual
								}
								add_character_flag = created
							}
							save_scope_as = local_character
							save_scope_as = tempting_character
						}
					}
				}
			}	
		}
	}
	#Piety, please
	option = { 
		name = tgp_east_asia_mandala_task_contract_events.1000.a

		mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}
	#Legitimacy!
	option = { 
		name = tgp_east_asia_mandala_task_contract_events.1000.b

		small_mandala_legitimacy_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Barren Cattle
tgp_east_asia_mandala_task_contract_events.1100 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1100.t
	desc = tgp_east_asia_mandala_task_contract_events.1100.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	
	#left_portrait = {
	#	character = scope:entourage_character
	#	animation = instrument_active
	#}
	center_portrait = {
		character = root
		animation = physician
	}
	right_portrait = {
		character = scope:local_character
		animation = shepherd_with_sheep
		camera = camera_herder_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1100.a
		
		big_mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location.county = { change_development_progress_with_overflow = 25 }

		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 30 }
		}
		
		stress_impact = {
			base = medium_stress_impact_gain
			diligent = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = { 
		name = tgp_east_asia_mandala_task_contract_events.1100.b
		
		mandala_piety_reward_effect = yes

		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 7 }
		}

		ai_chance = {
			base = 100
		}
	}
	option = { 
		name = tgp_east_asia_mandala_task_contract_events.1100.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:ritual_location.county = { change_development_progress_with_overflow = -25 }
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# The First Seed
tgp_east_asia_mandala_task_contract_events.1200 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1200.t
	desc = tgp_east_asia_mandala_task_contract_events.1200.desc
	theme = mandala
	override_background = wilderness
	
	left_portrait = {
		character = root
		animation = interested
	}
	center_portrait = {
		character = scope:local_character
		animation = obsequious_bow
		camera = camera_event_scheme_far_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = fanning_coyly
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					OR = {
						has_sexuality = heterosexual
						has_sexuality = bisexual
					}
					fertility > 30
					age <= 30
					NOT = {
						has_trait = chaste
					}
					trigger_if = {
						limit = {
							root = { is_male = yes }
						}
						is_female = yes
					}
					trigger_else = {
						is_male = yes
					}
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					OR = {
						has_sexuality = heterosexual
						has_sexuality = bisexual
					}
					fertility > 30
					age <= 30
					NOT = {
						has_trait = chaste
					}
					trigger_if = {
						limit = {
							root = { is_male = yes }
						}
						is_female = yes
					}
					trigger_else = {
						is_male = yes
					}
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = opposite_gender_peasant_template
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1200.a
		
		big_mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		save_scope_value_as = {
			name = ignore_cheating_error_check
			value = yes
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character_2
			PREGNANCY_CHANCE = 100
		}
		
		if = {
			limit ={
				can_contract_disease_trigger = { DISEASE = ill }
			}
			random = {
				chance = 30
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}
		
		scope:ritual_location = {
			if = {
				limit = {
					province_has_no_holding_trigger = yes
				}
				begin_create_holding = {
					type = temple_citadel_holding
				}
			}
		}

		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 30 }
		}
		
		stress_impact = {
			chaste = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = { 
		name = tgp_east_asia_mandala_task_contract_events.1200.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character_2
			PREGNANCY_CHANCE = pregnancy_chance
		}
		
		scope:ritual_location = {
			if = {
				limit = {
					province_has_no_holding_trigger = yes
				}
				random = {
					chance = 50
					begin_create_holding = {
						type = temple_citadel_holding
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1200.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Sacred Heifer
tgp_east_asia_mandala_task_contract_events.1300 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1300.t
	desc = tgp_east_asia_mandala_task_contract_events.1300.desc
	theme = mandala
	override_background = tgp_farm_asia
	override_effect_2d = { reference = flies }
	
	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = stress
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1300.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		add_prestige = major_prestige_loss
		
		add_character_modifier = {
			modifier = diplomacy_majesty_4090_no_raiment_modifier
			days = 7
		}
		
		hidden_effect = {
			change_current_weight = -25
		}
		
		if = {
			limit ={
				can_contract_disease_trigger = { DISEASE = ill }
			}
			random = {
				chance = 30
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 7 }
		}
		
		stress_impact = {
			arrogant = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1300.b
		
		small_mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		add_prestige = minor_prestige_loss
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 7 }
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1300.c
		
		small_mandala_piety_reward_effect = yes
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Divine Witness
tgp_east_asia_mandala_task_contract_events.1400 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1400.t
	desc = tgp_east_asia_mandala_task_contract_events.1400.desc
	theme = mandala
	override_background = garden
	
	left_portrait = {
		character = root
		animation = chaplain
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = flirtation_left
		camera = camera_event_scheme_far_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = fanning_coyly
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				scope:ritual_location.barony.holder = {
					is_ai = yes
					is_married = yes
					primary_spouse = { is_ai = yes }
					NOR = {
						any_child = { is_alive = yes }
						any_spouse = { 
							is_female = yes
							has_trait = pregnant
						}
					}
				}
			}
			scope:ritual_location.barony.holder = { save_scope_as = local_character }
			scope:ritual_location.barony.holder.primary_spouse = { save_scope_as = local_character_2 }
		}
		else = {
			create_character = {
				template = local_noble_character
				dynasty = none
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				gender_female_chance = 0
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
			create_character = {
				template = local_noble_character
				age = { 25 35 }
				dynasty = none
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				gender_female_chance = 100
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
			hidden_effect_new_object = {
				scope:local_character = {
					if = {
						limit = {
							is_lowborn = yes
							root = { is_ai = no }
						}
						create_dynasty = {
							spread_to_descendants = yes
						}
					}
					marry = scope:local_character_2
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1400.a
		
		mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		save_scope_value_as = {
			name = ignore_cheating_error_check
			value = yes
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character
			PREGNANCY_CHANCE = 100
		}
		
		save_scope_value_as = {
			name = ignore_cheating_error_check
			value = yes
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character_2
			PREGNANCY_CHANCE = 100
		}
		
		scope:local_character = {
			save_scope_value_as = {
				name = ignore_cheating_error_check
				value = yes
			}
			
			had_sex_with_effect = {
				CHARACTER = scope:local_character_2
				PREGNANCY_CHANCE = pregnancy_chance
			}
		}
		
		create_character_memory = {
			type = had_a_threesome_memory
			participants = {
				partner_1 = scope:local_character
				partner_2 = scope:local_character_2
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}
		
		stress_impact = {
			chaste = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1400.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 14 }
		}
		
		scope:local_character = {
			save_scope_value_as = {
				name = ignore_cheating_error_check
				value = yes
			}
			
			had_sex_with_effect = {
				CHARACTER = scope:local_character_2
				PREGNANCY_CHANCE = 100
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1400.c
		
		small_mandala_piety_reward_effect = yes
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Midwives' Dream
tgp_east_asia_mandala_task_contract_events.1500 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1500.t
	desc = {
		desc = tgp_east_asia_mandala_task_contract_events.1500.desc
		first_valid = {
			triggered_desc = {
				trigger = { 
					is_female = yes
					scope:1500_stand_in_character ?= { has_character_flag = created }
				}
				desc = tgp_east_asia_mandala_task_contract_events.1500.desc.stand_in.acolyte
			}
			desc = tgp_east_asia_mandala_task_contract_events.1500.desc.stand_in
		}
	}
	theme = mandala
	override_background = bp1_crossroads_inn
	
	left_portrait = {
		character = root
		animation = worry
	}
	center_portrait = {
		character = scope:local_character
		animation = storyteller
		camera = camera_event_scheme_far_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = fanning_coyly
	}
	lower_left_portrait = {
		character = scope:1500_stand_in_character
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = { exists = scope:ritual_location }
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					is_female = yes
					age >= 45
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					is_female = yes
					age >= 45
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				age = { 45 65 }
				location = scope:ritual_location
				gender_female_chance = 100
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		create_character = {
			template = opposite_gender_peasant_template
			location = scope:ritual_location
			gender_female_chance = 100
			culture = scope:ritual_location.culture
			faith = scope:ritual_location.faith
			save_scope_as = local_character_2
			after_creation = {
				add_character_flag = created
			}
		}
		hidden_effect_new_object = {
			scope:local_character_2 = {
				random_list = {
					30 = {
						add_trait = albino
					}
					20 = {
						add_trait = scaly
					}
					10 = {
						add_trait = beauty_bad_3
					}
				}
				random_list = {
					30 = {
						add_trait = scarred
					}
					20 = {
						add_trait = clubfooted
					}
					10 = {
						add_trait = hunchbacked
					}
				}
			}
		}
		#Hmm, find a stand-in
		if = {
			limit = { is_female = yes }
			current_travel_plan = {
				if = {
					limit = {
						any_entourage_character = {
							this != root
							is_healthy = yes
							is_ai = yes
							is_adult = yes
							is_married = no
							is_male = yes
							NOR = {
								has_trait = devoted
								has_trait = chaste
								has_trait = celibate
								has_sexuality = homosexual
							}				
						}
					}
					random_entourage_character = {
						limit = {
							this != root
							is_healthy = yes
							is_ai = yes
							is_adult = yes
							is_married = no
							is_male = yes
							NOR = {
								has_trait = devoted
								has_trait = chaste
								has_trait = celibate
								has_sexuality = homosexual
							}
						}
						weight = {
							base = 1
							modifier = {
								is_child_of = root
								add = 200
							}
							modifier = {
								any_spouse = { this = root }
								add = 300
							}
							modifier = {
								is_close_family_of = root
								add = 100
							}	
						}
						save_scope_as = 1500_stand_in_character 
					}
				}
			}
			if = {
				limit = {
					NOT = { exists = scope:1500_stand_in_character }
				}
				hidden_effect_new_object = {
					create_character = {
						template = tgp_aspect_acolyte_template
						location = scope:ritual_location
						save_scope_as = 1500_stand_in_character
						after_creation = { add_character_flag = created }
					}
					add_to_entourage_court_and_activity_effect = { 
						CHAR_TO_ADD = scope:1500_stand_in_character
						NEW_COURT_OWNER = root 
					}
				}
			}
		}
	}
	
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { 
							is_female = yes
							scope:1500_stand_in_character ?= { has_character_flag = created }
						}
						desc = tgp_east_asia_mandala_task_contract_events.1500.a.stand_in.acolyte
					}
					triggered_desc = {
						trigger = { is_female = yes }
						desc = tgp_east_asia_mandala_task_contract_events.1500.a.stand_in
					}
					desc = tgp_east_asia_mandala_task_contract_events.1500.a
				}
			}
		}
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		#We do the deed
		if = {
			limit = { is_female = no }
			save_scope_value_as = {
				name = ignore_cheating_error_check
				value = yes
			}
			had_sex_with_effect = {
				CHARACTER = scope:local_character_2
				PREGNANCY_CHANCE = pregnancy_chance
			}
			#This relation should be a blank slate
			if = {
				limit = {
					can_set_relation_potential_lover_trigger = { CHARACTER = scope:local_character_2 }
				}
				set_relation_potential_lover = scope:local_character_2
			}
			add_to_entourage_court_and_activity_effect = { 
				CHAR_TO_ADD = scope:local_character_2
				NEW_COURT_OWNER = root 
			}
			stress_impact = {
				base = minor_stress_impact_gain
				chaste = medium_stress_impact_gain
			}
		}
		#We need a proxy
		else = {
			#Ehm, no incest please
			if = {
				limit = {
					scope:1500_stand_in_character = {
						NOT = { is_close_family_of = root }
					}
				}
				save_scope_value_as = {
					name = ignore_cheating_error_check
					value = yes
				}
				had_sex_with_effect = {
					CHARACTER = scope:1500_stand_in_character
					PREGNANCY_CHANCE = pregnancy_chance
				}
				had_sex_with_effect = {
					CHARACTER = scope:local_character_2
					PREGNANCY_CHANCE = pregnancy_chance
				}
				#This relation should be a blank slate
				if = {
					limit = {
						can_set_relation_potential_lover_trigger = { CHARACTER = scope:local_character_2 }
					}
					set_relation_potential_lover = scope:local_character_2
				}
				create_character_memory = {
					type = had_a_threesome_memory
					participants = {
						partner_1 = scope:1500_stand_in_character
						partner_2 = scope:local_character_2
					}
				}
			}
			#They do the deed	
			scope:1500_stand_in_character = {
				save_scope_value_as = {
					name = ignore_cheating_error_check
					value = yes
				}	
				had_sex_with_effect = {
					CHARACTER = scope:local_character_2
					PREGNANCY_CHANCE = pregnancy_chance
				}
				add_to_entourage_court_and_activity_effect = { 
					CHAR_TO_ADD = scope:local_character_2
					NEW_COURT_OWNER = root 
				}
				stress_impact = {
					base = minor_stress_impact_gain
				}
			}
			stress_impact = {
				base = minor_stress_impact_gain
				chaste = medium_stress_impact_gain
				lustful = major_stress_impact_loss
			}
		}
		#*shock*
		every_consort = {
			add_opinion = {
				target = root
				modifier = outraged_opinion
				opinion = -50
			}
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:1500_stand_in_character }
						desc = tgp_east_asia_mandala_task_contract_events.1500.b.stand_in
					}
					desc = tgp_east_asia_mandala_task_contract_events.1500.b
				}
			}
		}
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		#We do the deed
		if = {
			limit = { is_female = no }
			save_scope_value_as = {
				name = ignore_cheating_error_check
				value = yes
			}
			had_sex_with_effect = {
				CHARACTER = scope:local_character_2
				PREGNANCY_CHANCE = pregnancy_chance
			}
			stress_impact = {
				base = minor_stress_impact_gain
				chaste = medium_stress_impact_gain
				lustful = minor_stress_impact_loss
			}
		}
		#We need a proxy
		else = {
			scope:1500_stand_in_character = {
				save_scope_value_as = {
					name = ignore_cheating_error_check
					value = yes
				}
				had_sex_with_effect = {
					CHARACTER = scope:local_character_2
					PREGNANCY_CHANCE = pregnancy_chance
				}
				stress_impact = {
					base = minor_stress_impact_gain
				}
			}
			stress_impact = {
				lustful = minor_stress_impact_loss
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1500.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:1500_stand_in_character ?= {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Weeping Statue
tgp_east_asia_mandala_task_contract_events.1600 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1600.t
	desc = tgp_east_asia_mandala_task_contract_events.1600.desc
	theme = mandala
	override_background = tgp_farm_asia
	
	left_portrait = {
		character = root
		animation = newborn
	}
	center_portrait = {
		character = scope:local_character
		animation = obsequious_bow
		camera = camera_event_scheme_center
	}
	right_portrait = {
		character = scope:statue_head
		animation = dead
		camera = camera_event_right_massive_head
		hide_info = yes
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		create_character = {
			template = generic_peasant_character
			location = scope:background_terrain_scope
			culture = scope:background_terrain_scope.culture
			faith = scope:background_terrain_scope.faith
			save_scope_as = statue_head
			after_creation = {
				add_character_flag = created
			}
		}
		hidden_effect = {
			scope:statue_head = {
				add_trait = disfigured
				add_trait = albino
				add_character_flag = no_headgear
				death = { death_reason = death_vanished }
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1600.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		remove_short_term_gold = medium_gold_value
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = stone_head_shrine_modifier
				years = 25
			}
		}

		ai_chance = {
			base = 50
			modifier = {
				gold <= major_gold_value
				factor = 0
			}
			modifier = {
				scope:ritual_location.county.holder.top_liege != root.top_liege
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1600.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		remove_short_term_gold = tiny_gold_value

		ai_chance = {
			base = 100
			modifier = {
				gold <= minor_gold_value
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1600.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Sprouting Flowers
tgp_east_asia_mandala_task_contract_events.1700 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1700.t
	desc = tgp_east_asia_mandala_task_contract_events.1700.desc
	theme = mandala
	override_background = tgp_rice_fields
	override_effect_2d = { reference = rain }
	
	left_portrait = {
		character = root
		animation = interested
	}
	center_portrait = {
		character = scope:local_character
		animation = grief
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1700.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		capital_county = { change_development_progress_with_overflow = -75 }
		scope:ritual_location.county = { change_development_progress_with_overflow = 75 }
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = fertile_ground_modifier
				years = 15
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1700.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		if = {
			limit ={
				can_contract_disease_trigger = { DISEASE = ill }
			}
			random = {
				chance = 30
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1700.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# River Ritual
tgp_east_asia_mandala_task_contract_events.1800 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1800.t
	desc = tgp_east_asia_mandala_task_contract_events.1800.desc
	theme = mandala
	override_background = bp3_riverside
	
	left_portrait = {
		character = root
		animation = frontend_left_idle
	}
	center_portrait = {
		character = scope:local_character_2
		animation = flirtation_left
		camera = camera_event_scheme_far_right
	}
	right_portrait = {
		character = scope:local_character
		animation = relaxed_spear
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		create_character = {
			template = opposite_gender_peasant_template
			location = scope:ritual_location
			gender_female_chance = 100
			culture = scope:ritual_location.culture
			faith = scope:ritual_location.faith
			save_scope_as = local_character_2
			after_creation = {
				add_character_flag = created
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1800.a
		
		mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		save_scope_value_as = {
			name = ignore_cheating_error_check
			value = yes
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character_2
			PREGNANCY_CHANCE = pregnancy_chance
		}
		
		if = {
			limit ={
				can_contract_disease_trigger = { DISEASE = ill }
			}
			random = {
				chance = 30
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}
		
		stress_impact = {
			chaste = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1800.b
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1800.c
		
		small_mandala_piety_reward_effect = yes
		add_gold = minor_gold_value
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_peasants_modifier
				years = 10
			}
		}

		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				has_trait = generous
				factor = 0
			}
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Cursed Fields
tgp_east_asia_mandala_task_contract_events.1900 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.1900.t
	desc = tgp_east_asia_mandala_task_contract_events.1900.desc
	theme = mandala
	override_background = tgp_farm_asia
	
	left_portrait = {
		character = scope:entourage_character
		animation = holding_staff
		camera = camera_event_scheme_far_right
	}
	center_portrait = {
		character = root
		animation = survey
		camera = camera_event_scheme_left
	}
	right_portrait = {
		character = scope:local_character
		animation = rage
		camera = camera_event_scheme_left
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			if = {
				limit = {
					any_entourage_character = {
						age >= 13
						is_healthy = yes
					}
				}
			}
			random_entourage_character = {
				limit = {
					age >= 13
					is_healthy = yes
				}
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1900.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		add_character_modifier = {
			modifier = stress_smelling_of_sweat
			years = 3
		}
		
		stress_impact = {
			base = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1900.b
		trigger = { exists = scope:entourage_character }
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		scope:entourage_character = {
			add_character_modifier = {
				modifier = stress_smelling_of_sweat
				years = 3
			}
		}
		
		reverse_add_opinion = {
			modifier = cruelty_opinion
			target = scope:entourage_character
			opinion = -30
		}
		
		stress_impact = {
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = humble
					has_trait = just
				}
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.1900.c
		
		small_mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_peasants_modifier
				years = 3
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Withered Grove
tgp_east_asia_mandala_task_contract_events.2000 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2000.t
	desc = tgp_east_asia_mandala_task_contract_events.2000.desc
	theme = mandala
	override_background = wilderness
	override_effect_2d = { reference = smoke }
	
	left_portrait = {
		character = root
		animation = personality_zealous
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = stunned
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age <= 40
					trigger_if = {
						limit = {
							root = { is_male = yes }
						}
						is_female = yes
					}
					trigger_else = {
						is_female = yes
					}
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age <= 40
					trigger_if = {
						limit = {
							root = { is_male = yes }
						}
						is_female = yes
					}
					trigger_else = {
						is_female = yes
					}
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = opposite_gender_peasant_template
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_female = yes }
						desc = tgp_east_asia_mandala_task_contract_events.2000.a.female
					}
					desc = tgp_east_asia_mandala_task_contract_events.2000.a
				}
			}
		}
		
		big_mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		remove_short_term_gold = minor_gold_value
		
		add_prestige = minor_prestige_loss
		
		save_scope_value_as = {
			name = ignore_cheating_error_check
			value = yes
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character
			PREGNANCY_CHANCE = pregnancy_chance
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = lush_grove_modifier
				years = 25
			}
		}
		
		stress_impact = {
			chaste = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				gold <= medium_gold_value
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2000.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		add_prestige = minor_prestige_loss
		
		save_scope_value_as = {
			name = ignore_cheating_error_check
			value = yes
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:local_character
			PREGNANCY_CHANCE = pregnancy_chance
		}
		
		stress_impact = {
			chaste = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2000.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Pig Slaughter Oath
tgp_east_asia_mandala_task_contract_events.2100 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2100.t
	desc = tgp_east_asia_mandala_task_contract_events.2100.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	
	left_portrait = {
		character = root
		animation = spymaster
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = throne_room_two_handed_passive_1
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
			county = {
				random_neighboring_county = {
					limit = {
						holder = {
							is_ai = yes
						}
					}
					weight = {
						base = 1
						modifier = {
							add = 100
							holder = {
								NOR = {
									top_liege ?= root
									top_suzerain ?= root
								}
							}
						}
					}
					save_scope_as = vengeance_target
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
				county = {
					random_neighboring_county = {
						limit = {
							holder = {
								is_ai = yes
							}
						}
						weight = {
							base = 1
							modifier = {
								add = 100
								holder = {
									NOR = {
										top_liege ?= root
										top_suzerain ?= root
									}
								}
							}
						}
						save_scope_as = vengeance_target
					}
				}
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				gender_female_chance = root_soldier_female_chance
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2100.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		remove_short_term_gold = medium_gold_value
		
		scope:vengeance_target = {
			title_province = {
				add_province_modifier = {
					modifier = recently_looted_modifier
					years = 5
				}
			}
			change_county_control = -50
			change_development_progress_with_overflow = -50
		}

		ai_chance = {
			base = 0
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2100.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:vengeance_target = {
			change_county_control = -15
			change_development_progress_with_overflow = -15
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2100.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_peasants_modifier
				years = 5
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Ritual Wrath
tgp_east_asia_mandala_task_contract_events.2200 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2200.t
	desc = tgp_east_asia_mandala_task_contract_events.2200.desc
	theme = mandala
	override_background = tgp_farm_asia
	override_effect_2d = { reference = flies }
	
	left_portrait = {
		character = scope:entourage_character
		animation = throne_room_two_handed_passive_1
		camera = camera_event_scheme_center_look_semi_right
	}
	center_portrait = {
		character = root
		animation = marshal
		camera = camera_event_scheme_center_look_semi_right
	}
	right_portrait = {
		character = scope:local_character
		animation = throne_room_bow_1
		camera = camera_event_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2200.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		increase_wounds_effect = { REASON = whipping }
		
		scope:ritual_location.county = {
			change_development_progress_with_overflow = 10
		}
		
		stress_impact = {
			base = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			flagellant = massive_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = craven
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2200.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:local_character = {
			death = {
				death_reason = death_punishment
				killer = root
			}
		}
		
		scope:ritual_location.county = {
			change_county_control = -10
			change_development_progress_with_overflow = 10
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2200.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Collective Punishment
tgp_east_asia_mandala_task_contract_events.2300 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2300.t
	desc = tgp_east_asia_mandala_task_contract_events.2300.desc
	theme = mandala
	override_background = tgp_farm_asia
	
	left_portrait = {
		character = root
		animation = throne_room_two_handed_passive_shield
		camera = camera_event_scheme_center_look_right
	}
	center_portrait = {
		character = scope:local_character_2
		animation = nervous
		camera = camera_event_scheme_center
	}
	right_portrait = {
		character = scope:local_character
		animation = threatening
	}
	lower_left_portrait = {
		character = scope:local_character_3
		animation = manic
	}
	lower_center_portrait = {
		character = scope:local_character_4
		animation = crying
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					is_female = yes
					NOR = {
						has_trait = celibate
						has_trait = devoted
					}
					age <= 35
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					is_female = yes
					NOR = {
						has_trait = celibate
						has_trait = devoted
					}
					age <= 35
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				gender_female_chance = 100
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		create_character = {
			template = generic_peasant_character
			location = scope:ritual_location
			gender_female_chance = 0
			culture = scope:ritual_location.culture
			faith = scope:ritual_location.faith
			save_scope_as = local_character_3
			after_creation = {
				add_character_flag = created
			}
		}
		create_character = {
			template = peasant_young_child_character
			location = scope:ritual_location
			culture = scope:ritual_location.culture
			faith = scope:ritual_location.faith
			save_scope_as = local_character_4
			after_creation = {
				add_character_flag = created
			}
		}
		hidden_effect_new_object = {
			scope:local_character_3 = {
				add_gold = 25
				marry = scope:local_character_2
			}
			scope:local_character_4 = {
				set_father = scope:local_character_3
				set_mother = scope:local_character_2
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2300.a
		
		duel = {
			skill = martial
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = tgp_east_asia_mandala_task_contract_events.2300.a.success
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.2300.a.success
					left_icon = root
					right_icon = scope:local_character_3
					scope:local_character_3 = {
						death = { death_reason = death_punishment killer = root }
					}
					big_mandala_piety_reward_effect = yes
					big_mandala_legitimacy_reward_effect = yes
					scope:ritual_location.county = {
						if = {
							limit = {
								county_control < 100
							}
							change_county_control = 15
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				desc = tgp_east_asia_mandala_task_contract_events.2300.a.failure
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.2300.a.failure
					left_icon = root
					right_icon = scope:local_character_3
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = upset_peasants_modifier
							years = 5
						}
						change_county_control = -15
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2300.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:local_character_2 = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:local_character_4 = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = collective_punishments_modifier
				years = 15
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
				}
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2300.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_peasants_modifier
				years = 3
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_3 = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_4 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Diseased Spirits
tgp_east_asia_mandala_task_contract_events.2400 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2400.t
	desc = tgp_east_asia_mandala_task_contract_events.2400.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	override_effect_2d = { reference = smoke }
	
	left_portrait = {
		character = root
		animation = frontend_left_idle
	}
	center_portrait = {
		character = scope:local_character
		animation = cough
		camera = camera_event_scheme_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = physician
		camera = camera_event_scheme_center_look_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		create_character = {
			template = bp1_yearly_2021_learning_witch_template
			location = scope:ritual_location
			culture = scope:ritual_location.culture
			faith = scope:ritual_location.faith
			save_scope_as = local_character_2
			after_creation = {
				add_character_flag = created
			}
		}
		hidden_effect_new_object = {
			scope:local_character = {
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = no }
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2400.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:local_character_2 = {
			death = { death_reason = death_burned killer = root }
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = no_healers_modifier
				years = 20
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2400.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:local_character_2 = {
			death = { death_reason = death_burned killer = root }
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = no_healers_modifier
				years = 5
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2400.c
		
		small_mandala_piety_reward_effect = yes
		
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:local_character_2
			NEW_COURT_OWNER = root 
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_peasants_modifier
				years = 3
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Dull Spears
tgp_east_asia_mandala_task_contract_events.2500 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2500.t
	desc = tgp_east_asia_mandala_task_contract_events.2500.desc
	theme = mandala
	override_background = bp1_crossroads_inn
	
	left_portrait = {
		character = root
		animation = inspect_weapon
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = beg
		camera = camera_event_scheme_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = drink_goblet
		camera = camera_event_scheme_center_look_semi_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				age = { 45 65 }
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					is_clergy = no
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					is_clergy = no
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		hidden_effect_new_object = {
			scope:local_character_2 = {
				add_character_flag = need_military_outfit
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2500.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:local_character_2 = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = motivated_men_at_arms_modifier
				years = 15
			}
			county = {
				if = {
					limit = {
						county_control < 100
					}
					change_county_control = 15
				}
			}
		}
		
		random = {
			chance = 50
			increase_wounds_effect = { REASON = fight }
		}
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2500.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 30 }
		}
		
		scope:local_character_2 = {
			increase_wounds_effect = { REASON = whipping }
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = safer_roads_modifier
				years = 15
			}
			county = {
				if = {
					limit = {
						county_control < 100
					}
					change_county_control = 15
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2500.c
		
		small_mandala_piety_reward_effect = yes
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}
		
		random = {
			chance = 10
			scope:ritual_location.county = {
				add_county_modifier = county_corruption_bandits_rampant_modifier
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Defiant Village
tgp_east_asia_mandala_task_contract_events.2600 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2600.t
	desc = tgp_east_asia_mandala_task_contract_events.2600.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	
	left_portrait = {
		character = root
		animation = throne_room_one_handed_passive_1
		camera = camera_event_scheme_center_look_semi_right
	}
	center_portrait = {
		character = scope:local_character
		animation = dancing_plague
		camera = camera_event_scheme_center_look_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = dancing
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2600.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:local_character = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:local_character_2 = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = slaughtered_village_modifier
				years = 15
			}
			change_development_progress_with_overflow = -25
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2600.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location.county = {
			change_development_progress_with_overflow = -25
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
				}
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2600.c
		
		small_mandala_piety_reward_effect = yes

		stress_impact = {
			wrathful = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = wrathful
					has_trait = sadistic
				}
				factor = 0
			}
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Blood Tax
tgp_east_asia_mandala_task_contract_events.2700 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2700.t
	desc = tgp_east_asia_mandala_task_contract_events.2700.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	
	left_portrait = {
		character = root
		animation = throne_room_two_handed_passive_shield
		camera = camera_event_scheme_center_look_right
	}
	center_portrait = {
		character = scope:local_character
		animation = holding_scrolls
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2700.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location.county = {
			change_development_progress_with_overflow = -50
			add_county_modifier = {
				modifier = enforced_levy_modifier
				years = 15
			}
			if = {
				limit = {
					county_control < 100
				}
				change_county_control = 15
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2700.b
		
		mandala_piety_reward_effect = yes
		add_gold = {
			value = scope:ritual_location.available_loot
			min = 25
		}
		scope:ritual_location.county = {
			change_county_control = -15
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2700.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Bamboo Rebels
tgp_east_asia_mandala_task_contract_events.2800 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2800.t
	desc = tgp_east_asia_mandala_task_contract_events.2800.desc
	theme = mandala
	override_background = tgp_market_asia
	
	left_portrait = {
		character = root
		animation = marshal_shield
		camera = camera_event_scheme_center
	}
	right_portrait = {
		character = scope:local_character
		animation = relaxed_spear
		camera = camera_event_scheme_left
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				gender_female_chance = root_soldier_female_chance
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2800.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:local_character = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:ritual_location.county = {
			change_development_progress_with_overflow = -50
			if = {
				limit = {
					county_control < 100
				}
				change_county_control = 15
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2800.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_peasants_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2800.c
		
		small_mandala_piety_reward_effect = yes
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = well_armed_peasants_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Road Sacrifice
tgp_east_asia_mandala_task_contract_events.2900 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.2900.t
	desc = tgp_east_asia_mandala_task_contract_events.2900.desc
	theme = mandala
	override_background = tgp_farm_asia
	override_effect_2d = { reference = rain }
	
	left_portrait = {
		character = scope:entourage_character
		animation = survey
		camera = camera_event_scheme_far_right
	}
	center_portrait = {
		character = root
		animation = spymaster
		camera = camera_event_scheme_center_look_semi_right
	}
	right_portrait = {
		character = scope:local_character
		animation = hunting_knife_start
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2900.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = safer_roads_modifier
				years = 15
			}
		}
		
		increase_wounds_effect = { REASON = whipping }
		
		stress_impact = {
			base = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			flagellant = massive_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = craven
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2900.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		remove_short_term_gold = tiny_gold_value
		scope:ritual_location = {
			add_province_modifier = {
				modifier = safer_roads_modifier
				years = 15
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				gold <= minor_gold_value
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.2900.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# War God Festival
tgp_east_asia_mandala_task_contract_events.3000 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3000.t
	desc = tgp_east_asia_mandala_task_contract_events.3000.desc
	theme = mandala
	override_background = temple
	override_effect_2d = { reference = smoke }
	
	left_portrait = {
		character = root
		animation = threatening
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = dancing
		camera = camera_event_scheme_center_look_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = instrument_active
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3000.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:local_character = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:local_character_2 = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:ritual_location.county = {
			change_development_progress_with_overflow = -50
			add_county_modifier = {
				modifier = fearful_population_modifier
				years = 10
			}
			change_county_control = -15
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3000.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:local_character = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:local_character_2 = {
			death = { death_reason = death_punishment killer = root }
		}
		
		scope:ritual_location.county = {
			change_development_progress_with_overflow = -25
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3000.c
		
		small_mandala_piety_reward_effect = yes
		add_prestige = minor_prestige_loss

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Quarreling Monks
tgp_east_asia_mandala_task_contract_events.3100 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3100.t
	desc = tgp_east_asia_mandala_task_contract_events.3100.desc
	theme = mandala
	override_background = temple
	
	left_portrait = {
		character = root
		animation = stunned
	}
	center_portrait = {
		character = scope:local_character
		animation = debating
		camera = camera_event_scheme_center
	}
	right_portrait = {
		character = scope:local_character_2
		animation = rage
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		hidden_effect = {
			scope:local_character = {
				add_trait = devoted
				set_character_faith = scope:ritual_location.faith
			}
			scope:local_character_2 = {
				add_trait = devoted
				set_character_faith = scope:ritual_location.faith
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3100.a
		
		duel = {
			skill = diplomacy
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = tgp_east_asia_mandala_task_contract_events.3100.a.success
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.3100.a.success
					left_icon = root
					big_mandala_piety_reward_effect = yes
					big_mandala_legitimacy_reward_effect = yes
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				desc = tgp_east_asia_mandala_task_contract_events.3100.a.failure
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.3100.a.failure
					left_icon = root
					add_stress = medium_stress_impact_gain
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = upset_monks_modifier
							years = 5
						}
						change_county_control = -25
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3100.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		remove_short_term_gold = minor_gold_value
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = new_shrines_modifier
				years = 20
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3100.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = upset_monks_modifier
				years = 3
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Purify Battlefield
tgp_east_asia_mandala_task_contract_events.3200 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3200.t
	desc = tgp_east_asia_mandala_task_contract_events.3200.desc
	theme = mandala
	override_background = tgp_farm_asia
	
	left_portrait = {
		character = root
		animation = stress
		camera = camera_event_left_away_3_4
	}
	center_portrait = {
		character = scope:local_character
		animation = survey_staff
		camera = camera_event_center_away
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				age = { 45 65 }
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3200.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		custom_tooltip = unable_to_declare_war_tt
		add_character_flag = {
			flag = sworn_peace
			years = 5
		}
		
		add_character_modifier = {
			modifier = ritually_disarmed_modifier
			years = 5
		}
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 15 }
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3200.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		add_character_modifier = {
			modifier = ritually_disarmed_modifier
			years = 5
		}
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 15 }
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3200.c
		
		small_mandala_piety_reward_effect = yes
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = plagued_by_nightmares_modifier
				years = 3
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Bless the Weavers
tgp_east_asia_mandala_task_contract_events.3300 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3300.t
	desc = tgp_east_asia_mandala_task_contract_events.3300.desc
	theme = mandala
	override_background = tgp_market_asia
	
	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = obsequious_bow
		camera = camera_event_scheme_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = steward
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3300.a
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = wealthgod_symbol_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3300.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = healthgod_symbol_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3300.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Breaking of Spears
tgp_east_asia_mandala_task_contract_events.3400 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3400.t
	desc = tgp_east_asia_mandala_task_contract_events.3400.desc
	theme = mandala
	override_background = bp1_bonfire
	
	left_portrait = {
		character = root
		animation = relaxed_spear
		camera = camera_event_left_away_3_4
	}
	center_portrait = {
		character = scope:local_character
		animation = throne_room_two_handed_passive_1
		camera = camera_event_center_away
	}
	right_portrait = {
		character = scope:local_character_2
		animation = celebrate_spear
		camera = camera_event_left_away
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3400.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		custom_tooltip = unable_to_declare_war_tt
		add_character_flag = {
			flag = sworn_peace
			years = 5
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = feudless_village_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3400.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = feudless_village_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3400.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Guru's Peace
tgp_east_asia_mandala_task_contract_events.3500 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3500.t
	desc = tgp_east_asia_mandala_task_contract_events.3500.desc
	theme = mandala
	override_background = holy_site_scope
	
	left_portrait = {
		character = root
		animation = interested
	}
	center_portrait = {
		character = scope:local_character
		animation = wedding_priest
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		create_character = {
			template = court_guru_court_position_template
			location = scope:ritual_location
			culture = scope:ritual_location.culture
			faith = scope:ritual_location.faith
			save_scope_as = local_character
			after_creation = {
				add_character_flag = created
			}
		}
		hidden_effect = {
			scope:local_character = {
				add_diplomacy_skill = 10
				force_character_skill_recalculation = yes
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3500.a
		
		if = {
			limit = {
				NOT = {
					house = { has_house_aspiration_parameter = aspect_of_destruction }
				}
			}
			big_mandala_piety_reward_effect = yes
			mandala_legitimacy_reward_effect = yes
		}
		
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:local_character
			NEW_COURT_OWNER = root 
		}
		
		if = {
			limit = {
				can_employ_court_position_type = court_guru_court_position
			}
			appoint_court_position = {
				recipient = scope:local_character
				court_position = court_guru_court_position
			}
		}
		
		reverse_add_opinion = {
			modifier = pious_opinion
			target = scope:local_character
			opinion = 50
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = generation_of_peace_modifier
				years = 25
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3500.b
		
		if = {
			limit = {
				NOT = {
					house = { has_house_aspiration_parameter = aspect_of_destruction }
				}
			}
			small_mandala_piety_reward_effect = yes
			small_mandala_legitimacy_reward_effect = yes
		}
		
		pay_short_term_gold = {
			target = scope:local_character
			gold = tiny_gold_value
		}
		
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:local_character
			NEW_COURT_OWNER = root 
		}
		
		if = {
			limit = {
				can_employ_court_position_type = court_guru_court_position
			}
			appoint_court_position = {
				recipient = scope:local_character
				court_position = court_guru_court_position
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				gold <= minor_gold_value
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3500.c
		
		if = {
			limit = {
				NOT = {
					house = { has_house_aspiration_parameter = aspect_of_destruction }
				}
			}
			small_mandala_piety_reward_effect = yes
		}
		else = {
			mandala_piety_reward_effect = yes
		}
		
		reverse_add_opinion = {
			modifier = impious_opinion
			target = scope:local_character
			opinion = -75
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				house = { has_house_aspiration_parameter = aspect_of_destruction }
			}
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappear_ai_if_not_hired_with_flag = yes
		}
	}
}

# Reconciliation Edict
tgp_east_asia_mandala_task_contract_events.3600 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3600.t
	desc = tgp_east_asia_mandala_task_contract_events.3600.desc
	theme = mandala
	override_background = tgp_farm_asia
	
	left_portrait = {
		character = root
		animation = writing
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = holding_scrolls
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				age = { 45 65 }
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3600.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = weapon_ban_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3600.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = arbitration_edict_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3600.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Eightfold Path
tgp_east_asia_mandala_task_contract_events.3700 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3700.t
	desc = tgp_east_asia_mandala_task_contract_events.3700.desc
	theme = mandala
	override_background = terrain_travel
	
	left_portrait = {
		character = root
		animation = personality_zealous
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = storyteller
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					age >= 45
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				age = { 45 65 }
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3700.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 8 }
		}
		
		if = {
			limit ={
				can_contract_disease_trigger = { DISEASE = ill }
			}
			random = {
				chance = 30
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = eightfold_path_modifier
				years = 8
			}
		}
		
		hidden_effect = {
			change_current_weight = -25
		}

		stress_impact = {
			base = medium_stress_impact_gain
			lazy = massive_stress_impact_gain
			diligent = medium_stress_impact_loss
		}
		
		add_character_modifier = {
			modifier = walked_the_eightfold_path_modifier
			years = 8
		}
		
		ai_chance = {
			base = 10
			modifier = {
				has_trait = lazy
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3700.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 8 }
		}

		stress_impact = {
			base = minor_stress_impact_gain
			lazy = major_stress_impact_gain
			diligent = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 10
			modifier = {
				has_trait = lazy
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3700.c
		
		small_mandala_piety_reward_effect = yes
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Grove Guardians
tgp_east_asia_mandala_task_contract_events.3800 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3800.t
	desc = tgp_east_asia_mandala_task_contract_events.3800.desc
	theme = mandala
	override_background = tgp_wedding_ceremony_asia
	
	left_portrait = {
		character = root
		animation = frontend_center_idle
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = holding_staff
		camera = camera_event_scheme_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = bow_idle
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
			county = { save_scope_as = county_scope }
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3800.a
		
		trigger = {
			any_maa_regiment = {}
		}
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		every_maa_regiment = {
			limit = {
				NOT = {
					is_unit_type = siege_weapon
				}
			}
			change_maa_troops_count = {
				value = {
					value = this.maa_current_troops_count
					multiply = -0.25
				}
			}
		}
		
		scope:county_scope = {
			add_county_modifier = {
				modifier = well_protected_groves_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3800.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		scope:county_scope = {
			add_county_modifier = {
				modifier = garrisoned_groves_modifier
				years = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3800.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Vow of Stillness
tgp_east_asia_mandala_task_contract_events.3900 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.3900.t
	desc = tgp_east_asia_mandala_task_contract_events.3900.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	
	left_portrait = {
		character = root
		animation = worry
	}
	center_portrait = {
		character = scope:local_character
		animation = debating
		camera = camera_event_scheme_center_look_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = rage
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3900.a
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 90 }
		}
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes

		stress_impact = {
			base = medium_stress_impact_gain
			gregarious = massive_stress_impact_gain
			shy = medium_stress_impact_loss
		}
		ai_chance = {
			base = 10
			modifier = {
				has_trait = gregarious
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3900.b
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 7 }
		}
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes

		stress_impact = {
			base = minor_stress_impact_gain
			gregarious = medium_stress_impact_gain
			shy = medium_stress_impact_loss
		}
		ai_chance = {
			base = 10
			modifier = {
				has_trait = gregarious
				factor = 0
			}
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.3900.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = discordant_town_modifier
				years = 3
			}
		}
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Stone-laying
tgp_east_asia_mandala_task_contract_events.4000 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4000.t
	desc = tgp_east_asia_mandala_task_contract_events.4000.desc
	theme = mandala
	override_background = garden
	
	left_portrait = {
		character = root
		animation = interested
	}
	center_portrait = {
		character = scope:local_character
		animation = throne_room_one_handed_passive_3
		camera = camera_event_scheme_center_forward
	}
	right_portrait = {
		character = scope:local_character_2
		animation = aggressive_hammer
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		random_maa_regiment = {
			limit = {
				NOT = {
					is_unit_type = siege_weapon
				}
			}
			save_scope_as = sacrificial_regiment
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4000.a
		
		scope:ritual_location = {
			generate_building = yes
		}
		
		every_maa_regiment = {
			limit = {
				NOT = {
					is_unit_type = siege_weapon
				}
			}
			change_maa_troops_count = {
				value = {
					value = this.maa_current_troops_count
					multiply = -0.25
				}
			}
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = pious_silpakaras_modifier
				years = 15
			}
		}
		
		add_character_modifier = {
			modifier = ritually_disarmed_modifier
			years = 10
		}
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4000.b
		
		trigger = {
			exists = scope:sacrificial_regiment
		}
		
		scope:sacrificial_regiment = {
			change_maa_troops_count = {
				value = {
					value = this.maa_current_troops_count
					multiply = -0.5
				}
			}
		}
		
		add_character_modifier = {
			modifier = ritually_disarmed_modifier
			years = 5
		}
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = pious_silpakaras_modifier
				years = 5
			}
		}
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4000.c
		
		small_mandala_piety_reward_effect = yes
		
		add_character_modifier = {
			modifier = ritually_disarmed_modifier
			years = 2
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Laughing Ascetic
tgp_east_asia_mandala_task_contract_events.4100 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4100.t
	desc = tgp_east_asia_mandala_task_contract_events.4100.desc
	theme = mandala
	override_background = mpo_rural_village_asian
	
	left_portrait = {
		character = root
		animation = map_disbelief
	}
	center_portrait = {
		character = scope:local_character
		animation = laugh
		camera = camera_event_scheme_center
	}
	right_portrait = {
		character = scope:local_character_2
		animation = ecstasy
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		random_list = {
			50 = {
				religion:buddhism_religion = {
					random_faith = {
#						limit = {
#							NOR = {
#								this = faith:dhyana
#								this = faith:pundarika
#								this = faith:vinaya
#								this = faith:avatamsaka
#								this = faith:sukhavati
#								this = faith:acharya
#								this = faith:mantrayana
#								this = faith:maitreya
#								this = faith:yogacara
#							}
#						}
						save_scope_as = character_faith
					}
				}
			}
			50 = {
				religion:hinduism_religion = {
					random_faith = {
						save_scope_as = character_faith
					}
				}
			}
		}
		# Local character
		create_character = {
			template = court_guru_court_position_template
			location = scope:ritual_location
			culture = scope:ritual_location.culture
			faith = scope:character_faith
			save_scope_as = local_character
			after_creation = {
				add_character_flag = created
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					is_clergy = no
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					is_clergy = no
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		hidden_effect = {
			scope:local_character = {
				change_current_weight = 500
				add_intrigue_skill = 16
				force_character_skill_recalculation = yes
				save_scope_as = second
			}
			scope:local_character_2 = {
				remove_trait = humble
				add_trait = arrogant
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4100.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		duel = {
			skill = intrigue
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4100.t
					left_icon = root
					right_icon = scope:local_character_2
					
					add_to_entourage_court_and_activity_effect = { 
						CHAR_TO_ADD = scope:local_character
						NEW_COURT_OWNER = root 
					}
					
					if = {
						limit = {
							can_employ_court_position_type = court_guru_court_position
						}
						appoint_court_position = {
							recipient = scope:local_character
							court_position = court_guru_court_position
						}
					}
					
					add_hook = {
						target = scope:local_character
						type = loyalty_hook
					}
					
					reverse_add_opinion = {
						modifier = respect_opinion
						target = scope:local_character
						opinion = 50
					}
					
					if = {
						limit = {
							culture != scope:ritual_location.culture
						}
						culture = {
							change_cultural_acceptance = {
								target = scope:ritual_location.culture
								value = minor_cultural_acceptance_gain
								desc = cultural_acceptance_gain_event
							}
						}
					}
				}
			}
			45 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4100.t
					left_icon = root
					right_icon = scope:local_character_2
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = upset_peasants_modifier
							years = 5
						}
					}
				}
			}
			5 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4100.t
					left_icon = root
					right_icon = scope:local_character_2
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = upset_peasants_modifier
							years = 5
						}
					}
					scope:ritual_location = {
						if = {
							limit = {
								county.faith != scope:local_character.faith
							}
							county = { set_county_faith = scope:local_character.faith }
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4100.b
		
		small_mandala_piety_reward_effect = yes
		add_prestige = medium_prestige_loss
		
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:local_character
			NEW_COURT_OWNER = root 
		}
		
		if = {
			limit = {
				can_employ_court_position_type = court_guru_court_position
			}
			appoint_court_position = {
				recipient = scope:local_character
				court_position = court_guru_court_position
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4100.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappear_ai_if_not_hired_with_flag = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Spirit Decoy
tgp_east_asia_mandala_task_contract_events.4200 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4200.t
	desc = tgp_east_asia_mandala_task_contract_events.4200.desc
	theme = mandala
	override_background = tgp_farm_asia
	override_effect_2d = { reference = flies }
	
	left_portrait = {
		character = root
		animation = throne_room_one_handed_passive_3
		camera = camera_event_scheme_center_look_right
	}
	center_portrait = {
		character = scope:local_character
		animation = storyteller
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4200.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		random_list = {
			75 = {
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4200.t
					left_icon = root
					right_icon = scope:ritual_location.county
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = vegetable_idol_modifier
							years = 25
						}
					}
				}
			}
			25 = {
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4200.t
					left_icon = root
					right_icon = scope:ritual_location.county
					add_prestige = medium_prestige_loss
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = mocked_idol_modifier
							years = 15
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4200.b
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		random_list = {
			75 = {
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4200.t
					left_icon = root
					right_icon = scope:ritual_location.county
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = ruler_idol_modifier
							years = 25
						}
					}
				}
			}
			25 = {
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4200.t
					left_icon = root
					right_icon = scope:ritual_location.county
					add_prestige = medium_prestige_loss
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = mocked_idol_modifier
							years = 15
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4200.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Game of Wit
tgp_east_asia_mandala_task_contract_events.4300 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4300.t
	desc = tgp_east_asia_mandala_task_contract_events.4300.desc
	theme = mandala
	override_background = tgp_feast_asia
	
	center_portrait = {
		character = root
		animation = chess_cocky
		camera = camera_event_scheme_center_look_right
	}
	right_portrait = {
		character = scope:local_character
		animation = chess_certain_win
		camera = camera_event_scheme_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = { exists = scope:ritual_location }
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = { save_scope_as = entourage_character }
		}
		# Local character
		if = {
			limit = { 
				OR = {
					scope:ritual_location.barony.holder = root
					scope:ritual_location.barony.holder = { is_available_adult = no }
				}
			}
			if = {
				limit = {
					any_pool_character = {
						province = scope:ritual_location
						is_available_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						has_any_good_relationship_with_root_trigger = no
						intrigue > high_skill_rating
					}
				}
				random_pool_character = {
					province = scope:ritual_location
					limit = {
						is_available_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						has_any_good_relationship_with_root_trigger = no
						intrigue > high_skill_rating
					}
					save_scope_as = local_character
				}
			}
			else = {
				create_character = {
					template = intrigue_court_position_holder_template
					location = scope:ritual_location
					faith = scope:ritual_location.faith
					culture = scope:ritual_location.culture
					gender_female_chance = 50
					save_scope_as = local_character
				}
			}
		}
		else = {
			scope:ritual_location.barony.holder = {
				add_character_flag = local_ruler
				save_scope_as = local_character
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4300.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		duel = {
			target = scope:local_character
			skill = intrigue
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4300.t
					left_icon = root
					right_icon = scope:local_character
					
					scope:local_character = {
						if = {
							limit = { has_character_flag = local_ruler }
							if = {
								limit = { has_trait = disloyal }
								remove_trait = disloyal
							}
							if = {
								limit = {
									NOT = { has_trait = loyal }
								}
								add_trait = loyal
							}
						}
						else = {
							root = { add_courtier = scope:local_character }
						}		
					}
					if = {
						limit = {
							can_add_hook = {
								type = loyalty_hook
								target = scope:local_character
							}
						}
						add_hook = {
							type = loyalty_hook
							target = scope:local_character
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4300.t
					left_icon = root
					right_icon = scope:local_character
					
					scope:local_character = {
						if = {
							limit = { has_character_flag = local_ruler }
							if = {
								limit = { has_trait = loyal }
								remove_trait = loyal
							}
							if = {
								limit = {
									NOT = { has_trait = disloyal }
								}
								add_trait = disloyal
							}
						}
					}
					reverse_add_opinion = {
						modifier = respect_opinion
						target = scope:local_character
						opinion = -30
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4300.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		duel = {
			skill = diplomacy
			value = low_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4300.t
					left_icon = root
					right_icon = scope:local_character
					
					reverse_add_opinion = {
						modifier = respect_opinion
						target = scope:local_character
						opinion = 30
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4300.t
					left_icon = root
					right_icon = scope:local_character
					
					reverse_add_opinion = {
						modifier = respect_opinion
						target = scope:local_character
						opinion = -30
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4300.c
		
		small_mandala_piety_reward_effect = yes
					
		reverse_add_opinion = {
			modifier = respect_opinion
			target = scope:local_character
			opinion = -10
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			remove_character_flag = local_ruler
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Divine Thief
tgp_east_asia_mandala_task_contract_events.4400 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4400.t
	desc = tgp_east_asia_mandala_task_contract_events.4400.desc
	theme = mandala
	override_background = market
	
	left_portrait = {
		character = root
		animation = disapproval
		camera = camera_event_scheme_center_look_right
	}
	center_portrait = {
		character = scope:local_character
		animation = anger
		camera = camera_event_scheme_center
	}
	right_portrait = {
		character = scope:local_character_2
		animation = beg
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		create_character = {
			template = criminal_fingers_character
			location = scope:ritual_location
			culture = scope:ritual_location.culture
			age = root.age
			faith = scope:ritual_location.faith
			gender_female_chance = {
				if = {
					limit = {
						root = { is_male = yes }
					}
					value = 0
				}
				else = {
					value = 100
				}
			}
			save_scope_as = local_character
			after_creation = {
				add_character_flag = created
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		hidden_effect = {
			scope:local_character = {
				add_character_flag = created
				copy_inheritable_appearance_from = root
				add_intrigue_skill = 14
				force_character_skill_recalculation = yes
				remove_trait = scaly
				remove_trait = dwarf
				remove_trait = giant
				remove_trait = albino
				if = {
					limit = {
						root = {
							has_trait = scaly
						}
					}
					add_trait = scaly
				}
				if = {
					limit = {
						root = {
							has_trait = dwarf
						}
					}
					add_trait = dwarf
				}
				if = {
					limit = {
						root = {
							has_trait = giant
						}
					}
					add_trait = giant
				}
				if = {
					limit = {
						root = {
							has_trait = albino
						}
					}
					add_trait = albino
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4400.a
		
		big_mandala_piety_reward_effect = yes
		big_mandala_legitimacy_reward_effect = yes
		
		duel = {
			skill = intrigue
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4400.t
					left_icon = scope:local_character
					right_icon = scope:ritual_location.county
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = omnipresent_authority_modifier
							years = 20
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4400.t
					left_icon = scope:local_character
					right_icon = scope:ritual_location.county
					
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = upset_peasants_modifier
							years = 10
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4400.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:local_character
			NEW_COURT_OWNER = root 
		}
		
		duel = {
			skill = intrigue
			value = low_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4400.t
					left_icon = root
					right_icon = scope:local_character
					if = {
						limit = {
							can_add_hook = {
								type = loyalty_hook
								target = scope:local_character
							}
						}
						add_hook = {
							type = loyalty_hook
							target = scope:local_character
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4400.t
					left_icon = root
					right_icon = scope:local_character
					
					scope:local_character = {
						add_pressed_claim = root.primary_title
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4400.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Trickster's Trial
tgp_east_asia_mandala_task_contract_events.4500 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4500.t
	desc = tgp_east_asia_mandala_task_contract_events.4500.desc
	theme = mandala
	override_background = market
	override_effect_2d = { reference = rain }
	
	left_portrait = {
		character = root
		animation = wedding_priest
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = stress
		camera = camera_event_scheme_vs_center_positioned_left
	}
	right_portrait = {
		character = scope:local_character_2
		animation = paranoia
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
					age >= 45
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
					age >= 45
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					age <= 12
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					age <= 12
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = peasant_young_child_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4500.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		random = {
			chance = {
				value = 50
				subtract = root.intrigue
				min = 1
			}
			send_interface_toast = {
				title = tgp_east_asia_mandala_task_contract_events.4500.t
				left_icon = root
				right_icon = scope:ritual_location.county
				scope:local_character_2 = {
					increase_wounds_effect = { REASON = accident }
				}
				add_prestige = medium_prestige_loss
				scope:ritual_location.county = {
					add_county_modifier = {
						modifier = upset_peasants_modifier
						years = 10
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4500.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		random = {
			chance = {
				value = 30
				subtract = root.intrigue
				min = 1
			}
			send_interface_toast = {
				title = tgp_east_asia_mandala_task_contract_events.4500.t
				left_icon = root
				right_icon = scope:ritual_location.county
				add_prestige = minor_prestige_loss
				scope:ritual_location.county = {
					add_county_modifier = {
						modifier = upset_peasants_modifier
						years = 5
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4500.c
		
		small_mandala_piety_reward_effect = yes
		random = {
			chance = {
				value = 15
				subtract = root.intrigue
				min = 1
			}
			send_interface_toast = {
				title = tgp_east_asia_mandala_task_contract_events.4500.t
				left_icon = root
				right_icon = scope:ritual_location.county
				scope:ritual_location.county = {
					add_county_modifier = {
						modifier = upset_peasants_modifier
						years = 3
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Festival of Reversal
tgp_east_asia_mandala_task_contract_events.4600 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4600.t
	desc = tgp_east_asia_mandala_task_contract_events.4600.desc
	theme = mandala
	override_background = tgp_wedding_ceremony_asia
	
	left_portrait = {
		character = root
		animation = pondering
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character_2
		animation = dancing
		camera = camera_event_center_pointing_left
	}
	right_portrait = {
		character = scope:local_character
		animation = instrument_active
		camera = camera_event_scheme_center
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					age <= 12
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
					age <= 12
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = peasant_young_child_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		scope:local_character = {
			add_character_flag = high_noble_clothing
			remove_character_flag = peasant_outfit
		}
		scope:local_character_2 = {
			add_character_flag = high_noble_clothing
			remove_character_flag = peasant_outfit
			add_character_flag = wear_makuta
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4600.a
		
		add_character_flag = {
			flag = peasant_outfit
			days = 14
		}
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 14 }
		}
		
		random = {
			chance = {
				value = 50
				subtract = root.intrigue
				min = 1
			}
			send_interface_toast = {
				title = tgp_east_asia_mandala_task_contract_events.4600.t
				left_icon = root
				add_prestige = major_prestige_loss
				add_stress = medium_stress_impact_gain
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4600.b
		
		add_character_flag = {
			flag = need_military_outfit
			days = 14
		}
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		current_travel_plan = {
			hidden_effect = {
				resume_travel_plan = yes 
			}
			delay_travel_plan = { days = 14 }
		}
		
		random = {
			chance = {
				value = 30
				subtract = root.intrigue
				min = 1
			}
			send_interface_toast = {
				title = tgp_east_asia_mandala_task_contract_events.4600.t
				left_icon = root
				add_prestige = minor_prestige_loss
				add_stress = minor_stress_impact_gain
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4600.c
		
		small_mandala_piety_reward_effect = yes
		
		hidden_effect = {
			current_travel_plan ?= {
				resume_travel_plan = yes 
			}
		}

		ai_chance = {
			base = 40
		}
	}

	after = {
		hidden_effect = {
			scope:task_contract = { complete_task_contract = common_mandala }
		}
		add_character_flag = recently_completed_mandala_contract
		scope:local_character = {
			remove_character_flag = high_noble_clothing
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			remove_character_flag = high_noble_clothing
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Goat Oracle
tgp_east_asia_mandala_task_contract_events.4700 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4700.t
	desc = tgp_east_asia_mandala_task_contract_events.4700.desc
	theme = mandala
	override_background = market
	
	left_portrait = {
		character = root
		animation = interested
	}
	center_portrait = {
		character = scope:local_character
		animation = shepherd_with_sheep
		camera = camera_event_scheme_left
	}
	right_portrait = {
		character = scope:local_character_2
		animation = betting
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = criminal_brains_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
		hidden_effect = {
			scope:local_character = {
				add_character_flag = created
				add_intrigue_skill = 12
				force_character_skill_recalculation = yes
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4700.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		scope:ritual_location = {
			add_province_modifier = {
				modifier = goat_oracle_modifier
				years = 12
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4700.b
		
		small_mandala_piety_reward_effect = yes
		
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:local_character_2
			NEW_COURT_OWNER = root 
		}
		
		capital_province = {
			add_province_modifier = {
				modifier = goat_oracle_modifier
				years = 12
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4700.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:local_character = {
			add_stress = major_stress_impact_gain
		}
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = punished_charlatan_modifier
				years = 12
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Beasts in the Jungle
tgp_east_asia_mandala_task_contract_events.4800 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4800.t
	desc = tgp_east_asia_mandala_task_contract_events.4800.desc
	theme = mandala
	override_background = wilderness
	override_effect_2d = { reference = fog }
	
	left_portrait = {
		character = root
		animation = eavesdrop
		camera = camera_event_scheme_center
	}
	center_portrait = {
		character = scope:local_character
		animation = paranoia
		camera = camera_event_scheme_center_forward
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
			county = {
				random_neighboring_county = {
					limit = {
						holder = {
							is_ai = yes
						}
					}
					weight = {
						base = 1
						modifier = {
							add = 100
							holder = {
								NOR = {
									top_liege ?= root
									top_suzerain ?= root
								}
							}
						}
					}
					save_scope_as = neighboring_county
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
				county = {
					random_neighboring_county = {
						limit = {
							holder = {
								is_ai = yes
							}
						}
						weight = {
							base = 1
							modifier = {
								add = 100
								holder = {
									NOR = {
										top_liege ?= root
										top_suzerain ?= root
									}
								}
							}
						}
						save_scope_as = neighboring_county
					}
				}
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4800.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		duel = {
			skill = intrigue
			value = high_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				hidden_effect = {
					random_list = {
						50 = {
							create_artifact_animal_hide_effect = {
								OWNER = root
								HUNTER = root
								LEGENDARY = no
								ANIMAL = flag:none
							}
						}
						50 = {
							create_artifact_animal_trinket_effect = {
								OWNER = root
								HUNTER = root
								LEGENDARY = no
								ANIMAL = flag:none
							}
						}
					}
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.5000.t
					left_icon = root
					right_icon = scope:newly_created_artifact
					
					custom_tooltip = gain_hunt_artifact_tt
					show_as_tooltip = {
						scope:newly_created_artifact ?= {
							set_owner = root
						}
					}
					scope:ritual_location.county = {
						add_county_modifier = {
							modifier = beast_free_modifier
							years = 15
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.5000.t
					left_icon = root
					right_icon = scope:local_character_2
					
					increase_wounds_effect = { REASON = accident }
					add_stress = medium_stress_impact_gain
					scope:local_character = {
						death = { death_reason = death_maimed_by_wild_beast }
					}
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = craven
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4800.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		if = {
			limit = {
				scope:neighboring_county.holder != root
			}
			reverse_add_opinion = {
				modifier = annoyed_opinion
				target = scope:neighboring_county.holder
				opinion = -50
			}
		}
		
		scope:neighboring_county = {
			add_county_modifier = {
				modifier = brimming_with_beasts_modifier
				years = 15
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4800.c
		
		small_mandala_piety_reward_effect = yes
		
		scope:ritual_location.county = {
			add_county_modifier = {
				modifier = brimming_with_beasts_modifier
				years = 15
			}
		}

		stress_impact = {
			brave = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = brave
				factor = 0
			}
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# River Naga
tgp_east_asia_mandala_task_contract_events.4900 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.4900.t
	desc = tgp_east_asia_mandala_task_contract_events.4900.desc
	theme = mandala
	override_background = bp3_riverside
	override_effect_2d = { reference = fog }
	
	left_portrait = {
		character = scope:local_character
		animation = horse_exhausted
		camera = camera_event_horse_very_left
	}
	center_portrait = {
		character = scope:entourage_character
		animation = jockey_walk
		camera = camera_event_horse_very_left
	}
	right_portrait = {
		character = root
		animation = horse_surveying
		camera = camera_event_horse_very_left
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
			county = {
				random_neighboring_county = {
					limit = {
						holder = {
							is_ai = yes
						}
					}
					weight = {
						base = 1
						modifier = {
							add = 100
							holder = {
								NOR = {
									top_liege ?= root
									top_suzerain ?= root
								}
							}
						}
					}
					save_scope_as = neighboring_county
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
				county = {
					random_neighboring_county = {
						limit = {
							holder = {
								is_ai = yes
							}
						}
						weight = {
							base = 1
							modifier = {
								add = 100
								holder = {
									NOR = {
										top_liege ?= root
										top_suzerain ?= root
									}
								}
							}
						}
						save_scope_as = neighboring_county
					}
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_physically_able_adult = yes
				}
				save_scope_as = entourage_character
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:entourage_character
				}
			}
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = entourage_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					culture = scope:ritual_location.culture
					faith = scope:ritual_location.faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:ritual_location.faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4900.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		duel = {
			skill = intrigue
			value = high_skill_rating
			5 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4900.t
					left_icon = root
					right_icon = scope:entourage_character
					
					add_character_modifier = {
						modifier = 6140_pet_modifier
						years = 30
					}
				}
			}
			45 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4900.t
					left_icon = root
					right_icon = scope:entourage_character
					
					add_gold = minor_gold_value
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.4900.t
					left_icon = scope:local_character
					right_icon = scope:entourage_character
					
					increase_wounds_effect = { REASON = hunting_accident }
					
					scope:entourage_character = {
						death = { death_reason = death_maimed_by_wild_beast }
					}
					
					scope:local_character = {
						death = { death_reason = death_maimed_by_wild_beast }
					}
					
					scope:ritual_location = {
						add_province_modifier = {
							modifier = river_crocodile_god_modifier
							years = 25
						}
					}
				}
			}
		}
		
		stress_impact = {
			craven = medium_stress_impact_gain
		}

		ai_chance = {
			base = 40
			modifier = {
				has_trait = craven
				factor = 0
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4900.b
		
		trigger = {
			exists = scope:neighboring_county
		}
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.4900.c
		
		small_mandala_piety_reward_effect = yes
		scope:ritual_location = {
			add_province_modifier = {
				modifier = river_crocodile_god_modifier
				years = 25
			}
		}

		stress_impact = {
			brave = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = brave
				factor = 0
			}
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:entourage_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Promised Land
tgp_east_asia_mandala_task_contract_events.5000 = {
	type = character_event
	window = big_event_window
	title = tgp_east_asia_mandala_task_contract_events.5000.t
	desc = tgp_east_asia_mandala_task_contract_events.5000.desc
	theme = mandala
	override_background = wilderness
	override_effect_2d = { reference = fog }
	
	left_portrait = {
		character = root
		animation = interested
	}
	center_portrait = {
		character = scope:local_character
		animation = survey_staff
		camera = camera_event_scheme_right
	}
	right_portrait = {
		character = scope:local_character_2
		animation = stress
		camera = camera_event_scheme_far_right
	}
	immediate = {
		# Plus, stop us whilst we're here.
		hidden_effect = {
			current_travel_plan ?= { pause_travel_plan = yes }
		}
		capital_county = { save_scope_as = ruler_capital_county }
		scope:task_contract.task_contract_location = {
			save_scope_as = ritual_location
			save_scope_as = background_terrain_scope
		}
		if = {
			limit = {
				NOT = {
					exists = scope:ritual_location
				}
			}
			root.location = {
				save_scope_as = ritual_location
				save_scope_as = background_terrain_scope
			}
		}
		current_travel_plan = {
			random_entourage_character = {
				save_scope_as = entourage_character
			}
		}
		
		
		random_list = {
			50 = {
				religion:buddhism_religion = {
					random_faith = {
#						limit = {
#							NOR = {
#								this = root.faith
#								this = faith:dhyana
#								this = faith:pundarika
#								this = faith:vinaya
#								this = faith:avatamsaka
#								this = faith:sukhavati
#								this = faith:acharya
#								this = faith:mantrayana
#								this = faith:maitreya
#								this = faith:yogacara
#							}
#						}
						save_scope_as = character_faith
					}
				}
			}
			50 = {
				religion:hinduism_religion = {
					random_faith = {
						limit = {
							this != root.faith
							this != faith:lamaism
						}
						save_scope_as = character_faith
					}
				}
			}
		}
		# Local character
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					faith = scope:character_faith
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					faith = scope:character_faith
				}
				save_scope_as = local_character
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:character_faith
				save_scope_as = local_character
				after_creation = {
					add_character_flag = created
				}
			}
		}
		# Local character 2
		if = {
			limit = {
				any_pool_character = {
					province = scope:ritual_location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					faith = scope:character_faith
					this != scope:local_character
				}
			}
			random_pool_character = {
				province = scope:ritual_location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					faith = scope:character_faith
					this != scope:local_character
				}
				save_scope_as = local_character_2
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = scope:ritual_location
				culture = scope:ritual_location.culture
				faith = scope:character_faith
				save_scope_as = local_character_2
				after_creation = {
					add_character_flag = created
				}
			}
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.5000.a
		
		big_mandala_piety_reward_effect = yes
		mandala_legitimacy_reward_effect = yes
		
		hidden_effect = {
			scope:local_character = {
				move_to_pool_at = root.capital_province
			}
			
			scope:local_character_2 = {
				move_to_pool_at = root.capital_province
			}
		}
		
		duel = {
			skill = intrigue
			value = high_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.5000.t
					left_icon = scope:local_character
					right_icon = scope:local_character_2
					
					root.capital_county = {
						change_development_level = 2
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.5000.t
					left_icon = scope:local_character
					right_icon = scope:local_character_2
					
					root.capital_county = {
						change_development_level = 2
						set_county_faith = scope:local_character.faith
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	option = {
		name = tgp_east_asia_mandala_task_contract_events.5000.b
		
		mandala_piety_reward_effect = yes
		small_mandala_legitimacy_reward_effect = yes
		
		duel = {
			skill = intrigue
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.5000.t
					left_icon = scope:local_character
					right_icon = scope:local_character_2
					
					scope:ritual_location = {
						if = {
							limit = {
								province_has_no_holding_trigger = yes
							}
							begin_create_holding = {
								type = temple_citadel_holding
							}
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = tgp_east_asia_mandala_task_contract_events.5000.t
					left_icon = scope:local_character
					right_icon = scope:local_character_2
					
					scope:ritual_location = {
						if = {
							limit = {
								province_has_no_holding_trigger = yes
							}
							begin_create_holding = {
								type = temple_citadel_holding
							}
						}
					}
					scope:ritual_location.county = {
						set_county_faith = scope:local_character.faith
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = tgp_east_asia_mandala_task_contract_events.5000.c
		
		small_mandala_piety_reward_effect = yes

		ai_chance = {
			base = 100
		}
	}

	after = {
		mandala_contract_complete_contract_effect = yes
		scope:local_character = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:local_character_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}
