﻿namespace = az_tour

# A Scholar's Recitation
az_tour.0001 = {
    type = activity_event
    title = az_tour.0001.t
    desc = az_tour.0001.desc

    theme = host_dinner
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = pondering
        camera = camera_event_center_pointing_right
    }

    center_portrait = {
        character = scope:scholar
        animation = chancellor
        camera = camera_event_center_pointing_left
    }

    right_portrait = {
        character = scope:stop_host_scope
        animation = throne_room_bow_3
        camera = camera_event_center_pointing_slighty_left
    }

    trigger = {
    	location = {
			is_province_valid_confucian_education_trigger = yes
		}
    	has_government = celestial_government
    	scope:stop_host_scope = {
    		any_courtier = {
    			this != root
    			is_ai = yes
    			is_adult = yes
    			learning > 10
    			location = scope:stop_host_scope.location
    		}
    	}
    	scope:stop_host_scope = {
    		is_ai = yes
    	}
    }

    immediate = {
        # Try to get a courtier who could be the scholar
        scope:stop_host_scope = {
			random_courtier = {
				limit = {
					is_ai = yes
    				is_adult = yes
					learning > 10	
					location = scope:stop_host_scope.location
				}
				weight = {
					base = 1
					modifier = {
						add = learning
					}
					modifier = {
						has_court_position = chronicler_court_position
						add = 50
					}
				}
				save_scope_as = scholar				
			}
		}
    }

    option = {
        name = {
        	text = {
        		first_valid = {
					triggered_desc = {
					    trigger = { has_trait = education_diplomacy }
					    desc = az_tour.0001.a.diplomacy
					}
					triggered_desc = {
					    trigger = { has_trait = education_martial }
					    desc = az_tour.0001.a.martial
					}
					triggered_desc = {
					    trigger = { has_trait = education_stewardship }
					    desc = az_tour.0001.a.stewardship
					}
					triggered_desc = {
					    trigger = { has_trait = education_intrigue }
					    desc = az_tour.0001.a.intrigue
					}
					triggered_desc = {
					    trigger = { has_trait = education_learning }
					    desc = az_tour.0001.a.learning
					}
					desc = az_tour.0001.a.fallback
				}
        	}
        }

        bp2_lifestyle_xp_gain_per_type_effect = { VALUE = minor }

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
				trait = confucian_education
				value = lifestyle_confucian_education_xp_gain_minor_value
			}
        }
        else = {
        	random = {
				chance = 10
				add_trait = confucian_education
			}
        }

        stress_impact = {
            arrogant = minor_stress_impact_loss
            shy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 20 
            	has_trait = arrogant 
            }
            modifier = { 
            	add = -15 
            	has_trait = shy 
            }
            ai_value_modifier = {
                ai_zeal = 2
                ai_sociability = 1
            }
        }
    }

    option = {
        name = az_tour.0001.b # "Compose a verse on sorrow"

        add_diplomacy_lifestyle_xp = minor_lifestyle_xp

        if = {
            limit = { has_trait = lifestyle_poet }
            add_trait_xp = {
                trait = lifestyle_poet
                value = 10
            }
        }
        else = {
        	random = {
				chance = 10
				add_trait = lifestyle_poet
			}
        }

        stress_impact = {
            compassionate = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = -10 
            	has_trait = arrogant 
            }
            modifier = { 
            	add = 10 
            	has_trait = compassionate
            }
            ai_value_modifier = {
                ai_sociability = 1
            }
        }
    }

    option = {
        name = az_tour.0001.c # "Compose a verse on ambition"

        change_merit = minor_merit_gain

        if = {
        	limit = {
        		scope:stop_host_scope = {
        			OR = {
        				has_trait = ambitious
        				has_trait = arrogant
        			}
        		}
        	}
        	scope:stop_host_scope = {
	            add_opinion = {
	                target = root
	                modifier = pleased_opinion
	                opinion = 10
	            }
	        }
        }
        else_if = {
        	limit = {
        		scope:stop_host_scope = {
        			OR = {
        				has_trait = content
        				has_trait = compassionate
        				has_trait = shy
        			}
        		}
        	}
        	scope:stop_host_scope = {
	            add_opinion = {
	                target = root
	                modifier = audacity_opinion
	                opinion = -10
	            }
	        }
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
            content = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = { 
            	add = 15 
            	has_trait = ambitious 
            }
            modifier = { 
            	add = -15 
            	has_trait = content 
            }
            ai_value_modifier = {
                ai_zeal = 2
                ai_vengefulness = 1
            }
        }
    }
}

# The Cost of Refinement
az_tour.0002 = {
    type = activity_event
    title = az_tour.0002.t
    desc = az_tour.0002.desc

    theme = host_dinner
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = personality_rational
        camera = camera_event_center_pointing_right
    }

    right_portrait = {
        character = scope:stop_host_scope
        animation = throne_room_conversation_2
        camera = camera_event_center_pointing_left
    }

    trigger = {
        scope:stop_host_scope = {
        	short_term_gold > major_gold_value
        	ai_honor < 0
        	NOR = {
				is_spouse_of = root
				is_close_family_of = root
				has_relation_rival = root
				has_relation_friend = root
			}
            any_secret = {
				type = secret_embezzler
			}
            is_ai = yes
        }
    }

    immediate = {
    	scope:stop_host_scope = {
    		random_secret = {
            	type = secret_embezzler
            	save_scope_as = secret
			}
        }
    }

    option = {
        name = az_tour.0002.a # "A most elegant gift. I am honored."

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = flattered_opinion
                opinion = 20
            }
            pay_short_term_gold = {
				target = root
				gold = major_gold_value
			}
        }

        stress_impact = {
            greedy = minor_stress_impact_loss
            just = minor_stress_impact_gain
            honest = minor_stress_impact_gain
        }

        ai_chance = {
            base = 45
            modifier = { 
            	add = 20 
            	has_trait = greedy 
            }
            modifier = { 
            	add = -15 
            	has_trait = just 
            }
            modifier = { 
            	add = -15 
            	has_trait = honest
            }
        }
    }

    option = {
        name = az_tour.0002.b # "Your taste is exquisite… almost suspiciously so."

        scope:secret = {
			reveal_to = root
		}

		add_hook = {
			type = manipulation_hook
			target = scope:stop_host_scope
		}

        stress_impact = {
            cynical = minor_stress_impact_loss
            honest = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = { 
            	add = 15 
            	has_trait = cynical 
            }
            modifier = { 
            	add = -10 
            	has_trait = trusting 
            }
        }
    }

    option = {
        name = az_tour.0002.c # "I cannot, in good conscience, accept this."

        if = {
            limit = {
                government_allows = merit
            }
            change_merit = minor_merit_gain
        }
        else = {
        	add_piety = minor_piety_gain
        }

        stress_impact = {
            just = minor_stress_impact_loss
            greedy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = { 
            	add = 20 
            	has_trait = just 
            }
            modifier = { 
            	add = -15 
            	has_trait = greedy 
            }
        }
    }
}

# A Whisper in the Cup
az_tour.0003 = {
    type = activity_event
    title = az_tour.0003.t
    desc = az_tour.0003.desc

    theme = host_dinner
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = scheme
        camera = camera_event_center_pointing_right
    }

    center_portrait = {
        character = scope:servant
        animation = serving_tray
        hide_info = yes
        camera = camera_event_center_pointing_left
    }

    right_portrait = {
        character = scope:stop_host_scope
        animation = happiness
        camera = camera_event_center_pointing_left
    }

    trigger = {
		scope:stop_host_scope = {
			intrigue < high_skill_rating
			any_secret = {
            	NOT = {
            		is_known_by = root
            	}
			}
		}
	}

    immediate = {
	   scope:stop_host_scope = {
            random_secret = {
                limit = {
                    NOT = {
                        is_known_by = root
                    }
                }
                save_scope_as = revealed_secret
            }
            save_scope_as = secret_holder
        }

	    # Generate anonymous servant
	    create_character = {
	    	template = servant_character
			dynasty = none
			location = scope:stop_host_scope.location
			gender_female_chance = root_soldier_female_chance
			save_scope_as = servant
	    }
	}

    option = {
        name = az_tour.0003.a # "I will keep this close... for now."

        scope:revealed_secret = {
			reveal_to = root
		}

        stress_impact = {
            honest = minor_stress_impact_gain
            just = minor_stress_impact_gain
            cynical = minor_stress_impact_loss
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 15 
            	has_trait = cynical 
            }
            modifier = { 
            	add = -15 
            	has_trait = honest 
            }
            modifier = { 
            	add = -15 
            	has_trait = just
            }
            ai_value_modifier = { ai_vengefulness = 2 }
        }
    }

    option = {
        name = az_tour.0003.b # "This should not go unspoken."

        scope:stop_host_scope = {
        	trigger_event = az_tour.1003
        }

        custom_tooltip = az_tour.0003.b.tt

        scope:revealed_secret = {
			reveal_to = root
			if = {
				limit = {
					root.liege != root
					scope:revealed_secret = {
						NOT = {
							is_known_by = root.liege
						}
					}
				}
				reveal_to = root.liege
			}
		}

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = betrayal_opinion
                opinion = -15
            }
        }

        stress_impact = {
            brave = minor_stress_impact_loss
            honest = minor_stress_impact_loss
            deceitful = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = {
            	 add = 20 
            	 has_trait = brave
            }
            modifier = {
            	 add = 20 
            	 has_trait = honest 
            }
            modifier = { 
            	add = -15 
            	has_trait = deceitful 
            }
            ai_value_modifier = { ai_honor = 1 }
        }
    }

    option = {
        name = az_tour.0003.d # "I will take this straight to the top!"
        trigger = {
        	scope:visiting_liege.liege != scope:visiting_liege
        }
        
        scope:revealed_secret = {
			reveal_to = root
			if = {
				limit = {
					root.liege != root
					scope:revealed_secret = {
						NOT = {
							is_known_by = root.liege
						}
					}
				}
				reveal_to = root.liege
			}
		}

		root.liege = {
			add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 10
            }
		}

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = betrayal_opinion
                opinion = -30
            }
        }

        stress_impact = {
            brave = minor_stress_impact_loss
            honest = minor_stress_impact_loss
            deceitful = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = {
            	 add = 20 
            	 has_trait = brave
            }
            modifier = {
            	 add = 20 
            	 has_trait = honest 
            }
            modifier = { 
            	add = -15 
            	has_trait = deceitful 
            }
            ai_value_modifier = { ai_honor = 2 }
        }
    }

    option = {
        name = az_tour.0003.c # "I saw nothing."

        add_piety = minor_prestige_gain

        stress_impact = {
            cynical = minor_stress_impact_gain
            trusting = minor_stress_impact_loss
            paranoid = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = { 
            	add = 15 
            	has_trait = trusting 
            }
            modifier = { 
            	add = -10 
            	has_trait = paranoid
            }
            modifier = { 
            	add = -10 
            	has_trait = cynical
            }
            ai_value_modifier = { ai_greed = 1 }
        }
    }

    after = {
    	scope:servant = {
		  silent_disappearance_effect = yes
		}
    }
}

# Liege finds a secret about you
az_tour.1003 = {
    type = activity_event
    title = az_tour.1003.t
    desc = az_tour.1003.desc

    theme = host_dinner

    left_portrait = {
        character = root
        animation = shock
        camera = camera_event_center_pointing_right
    }

    right_portrait = {
        character = scope:visiting_liege
        animation = disbelief
        camera = camera_event_center_pointing_left
    }

    immediate = {
        scope:stop_host_scope = {
            add_opinion = {
                target = scope:visiting_liege
                modifier = betrayal_opinion
                opinion = -15
            }
        }

        random_claim ?= {
        	limit = {
        		tier > root.highest_held_title_tier
        		holder = scope:visiting_liege
        	}
        	alternative_limit = {
        		tier >= root.highest_held_title_tier
        		holder = scope:visiting_liege
        	}
        	alternative_limit = {
        		holder = scope:visiting_liege
        	}
        	save_scope_as = vassal_claim
        }
    }

    option = {
        name = az_tour.1003.e # uno reverse card

        trigger = {
        	OR = {
        		scope:visiting_liege = {
					any_secret = {
		            	is_known_by = root
					}
				}
				has_hook = scope:visiting_liege
        	}	
        }

        scope:visiting_liege = {
            consume_imprisonment_reasons = root
        }

        stress_impact = {
            honest = minor_stress_impact_loss
            just = minor_stress_impact_loss
            cynical = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = -15 
            	has_trait = cynical 
            }
            modifier = { 
            	add = 15 
            	has_trait = honest 
            }
            modifier = { 
            	add = 15 
            	has_trait = just
            }
            ai_value_modifier = { ai_vengefulness = -2 }
        }
    }

    option = {
        name = az_tour.1003.a # "Lies and slander! I will not hear another word!"

        scope:visiting_liege = {
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -25
            }
        }

        scope:revealed_secret = {
            reveal_to = scope:visiting_liege
            if = {
                limit = {
                    scope:visiting_liege.liege != scope:visiting_liege
                }
                reveal_to = scope:visiting_liege.liege
            }
        }

        stress_impact = {
            arrogant = minor_stress_impact_loss
            honest = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
	            add = 15 
	            has_trait = arrogant 
            }
            modifier = { 
            	add = -10 
            	has_trait = honest 
            }
            ai_value_modifier = { ai_vengefulness = 2 }
        }
    }

    option = {
        name = az_tour.1003.b # "Let us not speak of this again."

        scope:visiting_liege = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 10
            }
            add_hook = {
                type = favor_hook
                target = root
            }
            consume_imprisonment_reasons = root
        }

        stress_impact = {
            base = minor_stress_impact_gain
            deceitful = minor_stress_impact_loss
            honest = minor_stress_impact_gain
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = 20 
            	has_trait = deceitful 
            }
            modifier = { 
            	add = -15 
            	has_trait = honest 
            }
            ai_value_modifier = { ai_honor = -1 }
        }
    }

    option = {
        name = az_tour.1003.c # "A purse for your silence, then."
        trigger = { gold >= medium_gold_value }

        pay_short_term_gold = {
			target = scope:visiting_liege
			gold = medium_gold_value
		}
        
        scope:visiting_liege = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 10
            }
            consume_imprisonment_reasons = root
        }

        stress_impact = {
            greedy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = -25 
            	has_trait = greedy 
            }
            ai_value_modifier = { ai_greed = -2 }
        }
    }

    option = {
        name = az_tour.1003.d # "I will relinquish my claim."
        trigger = {
            scope:vassal_claim = {
            	exists = yes
            }
        }

        remove_claim = scope:vassal_claim

        scope:visiting_liege = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 10
            }
            consume_imprisonment_reasons = root
        }

        stress_impact = {
            ambitious = medium_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = { 
            	add = -15 
            	has_trait = ambitious 
            }
            ai_value_modifier = { ai_greed = -2 }
        }
    }
}

# A Matter of Governance
az_tour.0004 = {
    type = activity_event
    title = az_tour.0004.t
    desc = {
    	desc = az_tour.0004.desc.intro
    	random_valid = {
    		triggered_desc = {
    			trigger = {
	    			var:governance_issue_type = flag:stewardship
	     		}
    			desc = az_tour.0004.desc.stewardship
    		}
    		triggered_desc = {
    			trigger = {
	    			var:governance_issue_type = flag:martial
	     		}
    			desc = az_tour.0004.desc.martial
    		}
    		triggered_desc = {
    			trigger = {
	    			var:governance_issue_type = flag:learning
	     		}
    			desc = az_tour.0004.desc.learning
    		}
    		desc = az_examination.0019.desc.fallback
    	}
    }

    theme = host_dinner
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = pondering
        camera = camera_event_very_left_pointing_right
    }

    center_portrait = {
        character = scope:stop_host_scope
        animation = nervous
        camera = camera_event_center_pointing_right
    }

    right_portrait = {
        character = scope:opposing_counsel
        animation = debating
        camera = camera_event_right_pointing_right
    }

    trigger = {
        scope:stop_host_scope = {
            is_ai = yes
            any_courtier = {
            	is_ai = yes
    			is_adult = yes
                dislikes_character_trigger = { CHARACTER = scope:stop_host_scope }
            }
        }
    }

    immediate = {
        # Random courtier or vassal to represent the opposing party
        scope:stop_host_scope = {
            random_courtier = {
                limit = {
                	is_ai = yes
    				is_adult = yes
                    dislikes_character_trigger = { CHARACTER = scope:stop_host_scope }
                }
                save_scope_as = opposing_counsel
            }
        }

        # Pick issue type (martial, stewardship, or learning)
        random_list = {
            33 = { 
            	set_variable = { 
            		name = governance_issue_type 
            		days = 1
            		value = flag:stewardship
            	} 
            }
            33 = { 
            	set_variable = { 
            		name = governance_issue_type 
            		days = 1
            		value = flag:martial 
            	} 
            }
            33 = { 
            	set_variable = { 
            		name = governance_issue_type 
            		days = 1
            		value = flag:learning 
            	} 
            }
        }
    }

    option = {
        name = az_tour.0004.b.stewardship
        flavor = az_tour.0004.b.stewardship.tt

        trigger = {
        	var:governance_issue_type = flag:stewardship
        }

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }

        if = {
            limit = { government_allows = merit }
            change_merit = minor_merit_gain
        }

        if = {
			limit = { government_allows = administrative }
			change_influence = minor_influence_value
		}

        if = {
        	limit = {
        		stewardship >= high_skill_rating
        	}
        	add_prestige = minor_prestige_gain
        	add_stewardship_lifestyle_xp = minor_lifestyle_xp
        }
        else = {
        	add_stewardship_lifestyle_xp = minor_lifestyle_xp
        }

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 15
            }
        }

        scope:opposing_counsel = {
            add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 10
            }
        }

        stress_impact = {
        	calm = minor_stress_impact_loss
        	wrathful = minor_stress_impact_gain
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = 10 
            	has_trait = calm 
            }
            modifier = { 
            	add = -10 
            	has_trait = wrathful 
            }
            ai_value_modifier = { 
            	ai_zeal = 1 
            	ai_honor = 1 
            }
        }
    }

    option = {
        name = az_tour.0004.b.martial
        flavor = az_tour.0004.b.martial.tt

        trigger = {
        	var:governance_issue_type = flag:martial
        }

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }

        if = {
            limit = { government_allows = merit }
            change_merit = minor_merit_gain
        }

        if = {
			limit = { government_allows = administrative }
			change_influence = minor_influence_value
		}

        if = {
        	limit = {
        		martial >= high_skill_rating
        	}
        	add_prestige = minor_prestige_gain
        	add_martial_lifestyle_xp = minor_lifestyle_xp
        }
        else = {
        	add_martial_lifestyle_xp = minor_lifestyle_xp
        }

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 15
            }
        }

        scope:opposing_counsel = {
            add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 10
            }
        }

        stress_impact = {
        	calm = minor_stress_impact_loss
        	wrathful = minor_stress_impact_gain
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = 10 
            	has_trait = calm 
            }
            modifier = { 
            	add = -10 
            	has_trait = wrathful 
            }
            ai_value_modifier = { 
            	ai_zeal = 1 
            	ai_honor = 1 
            }
        }
    }

    option = {
        name = az_tour.0004.b.learning
        flavor = az_tour.0004.b.learning.tt

        trigger = {
        	var:governance_issue_type = flag:learning
        }

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }

        if = {
            limit = { government_allows = merit }
            change_merit = minor_merit_gain
        }

     	if = {
			limit = { government_allows = administrative }
			change_influence = minor_influence_value
		}

        if = {
        	limit = {
        		learning >= high_skill_rating
        	}
        	add_prestige = minor_prestige_gain
        	add_learning_lifestyle_xp = minor_lifestyle_xp
        }
        else = {
        	add_learning_lifestyle_xp = minor_lifestyle_xp
        }

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 15
            }
        }

        scope:opposing_counsel = {
            add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 10
            }
        }

        stress_impact = {
        	calm = minor_stress_impact_loss
        	wrathful = minor_stress_impact_gain
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = 10 
            	has_trait = calm 
            }
            modifier = { 
            	add = -10 
            	has_trait = wrathful 
            }
            ai_value_modifier = { 
            	ai_zeal = 1 
            	ai_honor = 1 
            }
        }
    }

    option = {
        name = az_tour.0004.a # "I must agree with our host’s assessment."

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = flattered_opinion
                opinion = 20
            }
        }

        stress_impact = {
            trusting = minor_stress_impact_loss
            cynical = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 15 
            	has_trait = trusting 
            }
            modifier = { 
            	add = -10 
            	has_trait = cynical 
            }
        }
    }

    option = {
        name = az_tour.0004.c # "This is a dinner, not a courtroom."

        add_prestige = minor_prestige_gain

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -10
            }
        }

        stress_impact = {
            just = minor_stress_impact_loss
            gregarious = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = { 
            	add = 15 has_trait = just 
            }
            modifier = { 
            	add = -10 
            	has_trait = gregarious 
            }
            ai_value_modifier = { 
            	ai_sociability = -1 
            }
        }
    }
}

# A Broken Note
az_tour.0005 = {
    type = activity_event
    title = az_tour.0005.t
    desc = az_tour.0005.desc

    theme = host_dinner
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = personality_compassionate
        camera = camera_event_center_pointing_right
    }

    center_portrait = {
    	character = scope:musician
    	animation = instrument_idle
    	hide_info = yes
        camera = camera_event_center
    }

    right_portrait = {
        character = scope:stop_host_scope
        animation = stress
        camera = camera_event_center_pointing_left
    }

    immediate = {
    	# Generate anonymous musician
	    create_character = {
			template = poet_template
			location = root.location
			culture = root.location.county.culture
			save_scope_as = musician
		}
    }

    option = {
        name = az_tour.0005.a # "A fine performance, despite the accident!"

        scope:stop_host_scope = {
            progress_towards_friend_effect = {
	            CHARACTER = root
	            REASON = friend_paid_compliment
	            OPINION = 20
	        }
        }

        stress_impact = {
            compassionate = minor_stress_impact_loss
            callous = minor_stress_impact_gain
        }

        ai_chance = {
            base = 45
            modifier = { 
            	add = 20 
            	has_trait = compassionate 
            }
            modifier = { 
            	add = -10 
            	has_trait = callous 
            }
            ai_value_modifier = { ai_sociability = 1 }
        }
    }

    option = {
        name = az_tour.0005.b # "Permit me to offer music of my own."

        add_prestige = minor_prestige_gain

        if = {
			limit = {
				has_trait = lifestyle_poet
			}
			add_trait_xp = {
				trait = lifestyle_poet
				value = { 5 10 }
			}
		}
		else = {
			random = {
				chance = 50
				add_trait = lifestyle_poet
			}
		}

		scope:stop_host_scope = {
			trigger_event = az_tour.1005
		}

        ai_chance = {
            base = 35
            modifier = { 
            	add = 15 
            	has_trait = arrogant 
            }
            modifier = { 
            	add = 10 
            	has_trait = gregarious 
            }
            ai_value_modifier = { ai_zeal = 1 }
        }
    }

    option = {
        name = az_tour.0005.c # "I pretend not to notice."

        add_piety = minor_piety_gain

        stress_impact = {
        	shy = minor_stress_impact_loss
            callous = minor_stress_impact_gain
        }

        ai_chance = {
            base = 20
            modifier = { 
            	add = 15 
            	has_trait = shy 
            }
            modifier = { 
            	add = -10 
            	has_trait = callous 
            }
            ai_value_modifier = { ai_sociability = -1 }
        }
    }

    after = {
    	scope:musician = {
    		silent_disappearance_effect = yes
    	}
    }
}

# your visiting liege performs at dinner
az_tour.1005 = {
    type = activity_event
    title = az_tour.1005.t
    desc = az_tour.1005.desc

    theme = host_dinner

    right_portrait = {
        character = scope:visiting_liege
        animation = instrument_active
        camera = camera_event_center_pointing_left
    }

    left_portrait = {
        character = ROOT
        animation = happiness
        camera = camera_event_center_pointing_right
    }

    option = {
        name = az_tour.1005.a # "A performance worthy of the court."
	
		scope:visiting_liege = {
			add_opinion = {
	            target = root
	            modifier = pleased_opinion
	            opinion = 20
	        }
		}
    }

    option = {
        name = az_tour.1005.b # "Could you teach me?"

        if = {
			limit = {
				has_trait = lifestyle_poet
			}
			add_trait_xp = {
				trait = lifestyle_poet
				value = { 5 10 }
			}
		}
		else = {
			random = {
				chance = 50
				add_trait = lifestyle_poet
			}
		}
    }

    option = {
        name = az_tour.1005.c # "A ruler should lead, not perform like a courtier."

        scope:visiting_liege = {
        	send_interface_toast = {
                title = az_tour.1005.c.toast
                add_stress = minor_stress_gain
                add_opinion = {
		            target = root
		            modifier = disrespect_opinion
		            opinion = -10
		        }
            }
        }
    }
}

# angry farmer is angry
az_tour.0006 = {
    type = activity_event
    title = az_tour.0006.t
    desc = az_tour.0006.desc

    theme = cultural_festival
    cooldown = { years = 5 }

    left_portrait = {
    	character = root
        animation = personality_bold
        camera = camera_event_center_pointing_right
    }

    center_portrait = {
        character = scope:angry_farmer
        animation = aggressive_unarmed
        hide_info = yes
        camera = camera_event_center_pointing_left
    }

    right_portrait = {
        character = scope:visiting_liege
        animation = disappointed
        camera = camera_event_right_pointing_right
    }

    trigger = {
    	location.county = {
        	county_opinion < 0
        	county_control <= 90
        	NOT = {
        		has_county_modifier = tgp_heard_complaints_modifier
        	}
        }
    }

    immediate = {
        # Generate anonymous angry farmer
	    create_character = {
	    	template = servant_character
			dynasty = none
			location = scope:stop_host_scope.location
			gender_female_chance = root_soldier_female_chance
			save_scope_as = angry_farmer
	    }
	    location.county = {
        	save_scope_as = local_county
        }
    }

    option = {
        name = az_tour.0006.a # "This will be looked into. You have my word."

        scope:local_county = {
        	add_county_modifier = {
				modifier = tgp_heard_complaints_modifier
				years = 15
			}
        }

		add_character_flag = az_tour_0006_a

		if = {
            limit = { government_allows = merit }
            change_merit = minor_merit_gain
        }

        scope:visiting_liege = {
            trigger_event = az_tour.1006
        }

        stress_impact = {
        	just = minor_stress_impact_loss
        	arbitrary = minor_stress_impact_gain
        	diligent = minor_stress_impact_loss
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 20 
            	has_trait = just 
            }
            modifier = { 
            	add = 20 
            	has_trait = diligent
            }
            modifier = { 
            	add = -10 
            	has_trait = arbitrary 
            }
            ai_value_modifier = { ai_compassion = 1 }
        }
    }

    option = {
        name = az_tour.0006.b # "Festivals are not for complaints."

        add_character_flag = az_tour_0006_b

        scope:visiting_liege = {
            trigger_event = az_tour.1006
        }

        add_dread = minor_dread_gain

        scope:local_county = {
        	add_county_modifier = {
				modifier = tgp_dismissed_complaints_modifier
				years = 15
			}
        }

        stress_impact = {
            just = minor_stress_impact_gain
            compassionate = minor_stress_impact_gain
            callous = minor_stress_impact_loss
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = 15 
            	has_trait = callous 
            }
            modifier = { 
            	add = -15 
            	has_trait = compassionate 
            }
            modifier = { 
            	add = -15 
            	has_trait = just 
            }
            ai_value_modifier = { ai_vengefulness = 1 }
        }
    }

    option = {
        name = az_tour.0006.c # "Come, friend. Share a drink and forget your troubles."

       add_character_flag = az_tour_0006_c

       if = {
            limit = { has_trait = lifestyle_reveler }
            add_trait_xp = {
				trait = lifestyle_reveler
				value = { 10 25 }
			}
        }
        else = {
        	random = {
				chance = 10
				add_trait = lifestyle_reveler
			}
        }

        scope:visiting_liege = {
            trigger_event = az_tour.1006
        }

        stress_impact = {
        	base = minor_stress_impact_loss
            gregarious = minor_stress_impact_loss
            compassionate = minor_stress_impact_loss
            shy = minor_stress_impact_gain
            arrogant = medium_stress_impact_gain
            callous = medium_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = { 
            	add = 20 
            	has_trait = gregarious 
            }
            modifier = { 
            	add = 20 
            	has_trait = compassionate
            }
            modifier = { 
            	add = -15 
            	has_trait = shy 
            }
            modifier = { 
            	add = -20
            	has_trait = arrogant
            }
            modifier = { 
            	add = -20
            	has_trait = callous
            }
            ai_value_modifier = { ai_sociability = 1 }
        }
    }
}

# angry farmer is angry visiting liege edition
az_tour.1006 = {
    type = activity_event
    title = az_tour.1006.t
    desc = {
        desc = az_tour.1006.desc.intro
        triggered_desc = {
            trigger = { scope:stop_host_scope = { has_character_flag = az_tour_0006_a } }
            desc = az_tour.1006.desc.a
        }
        triggered_desc = {
            trigger = { scope:stop_host_scope = { has_character_flag = az_tour_0006_b } }
            desc = az_tour.1006.desc.b
        }
        triggered_desc = {
            trigger = { scope:stop_host_scope = { has_character_flag = az_tour_0006_c } }
            desc = az_tour.1006.desc.c
        }
    }

    theme = cultural_festival

    left_portrait = {
        character = root
        animation = disappointed
        camera = camera_event_left_pointing_right
    }

    center_portrait = {
        character = scope:angry_farmer
        animation = aggressive_unarmed
        hide_info = yes
        camera = camera_event_center_pointing_right
    }

    right_portrait = {
    	character = scope:stop_host_scope
        animation = personality_bold
        camera = camera_event_center_pointing_left
    }

    option = {
        name = az_tour.1006.a # "You handled it well."

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = thankful_opinion
                opinion = 20
            }
            hidden_effect = {
            	send_interface_toast = {
	                title = az_tour.1006.a.toast
	             	root = {
	             		add_opinion = {
				            target = scope:stop_host_scope
				            modifier = proud_opinion
				            opinion = 10
				        }
	             	}   
	            }	
            }
        }

        if = {
        	limit = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		OR = {
        			ai_compassion > 0
        			ai_honor > 0
        			ai_zeal > 0
        		}
        	}
        	if = {
	            limit = { government_allows = merit }
	            change_merit = minor_merit_gain
	        }
        	stress_impact = {
	        	compassionate = minor_stress_impact_loss
	        	trusting = minor_stress_impact_loss
	        }
        }
        else_if = {
        	limit = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		OR = {
        			ai_compassion < 0
        			ai_honor < 0
        			ai_zeal < 0
        			ai_vengefulness > 0
        		}
        	}
        	add_dread = minor_dread_gain
        	stress_impact = {
	        	wrathful = minor_stress_impact_loss
	        	callous = minor_stress_impact_loss
	        }
        }
        else_if = {
        	limit = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_c }
        		ai_sociability > 0
        	}
        	if = {
	            limit = { has_trait = lifestyle_reveler }
	            add_trait_xp = {
					trait = lifestyle_reveler
					value = { 10 25 }
				}
	        }
	        else = {
	        	random = {
					chance = 10
					add_trait = lifestyle_reveler
				}
	        }
        	stress_impact = {
	        	gregarious = minor_stress_impact_loss
	        }
        }
        ai_chance = {
        	base = 1
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_compassion > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_honor > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_zeal > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_compassion < 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_honor < 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_zeal < 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_vengefulness > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_c }
        		ai_sociability > 0
        		add = 30
        	}

        }
    }

    option = {
        name = az_tour.1006.b # "You should have behaved differently."

       add_prestige = minor_prestige_gain

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = disappointed_opinion
                opinion = -10
            }
            hidden_effect = {
            	send_interface_toast = {
	                title = az_tour.1006.b.toast
	                add_stress = minor_stress_gain
	             	root = {
	             		add_opinion = {
				            target = scope:stop_host_scope
				            modifier = disappointed_opinion
				            opinion = -10
				        }
	             	}   
	            }
            }
        }

        if = {
        	limit = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		OR = {
        			ai_compassion < 0
        			ai_honor < 0
        			ai_zeal < 0
        			ai_vengefulness > 0
        		}
        	}
        	add_dread = minor_dread_gain
        	stress_impact = {
	        	wrathful = minor_stress_impact_loss
	        	callous = minor_stress_impact_loss
	        }
        }
        else_if = {
        	limit = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		OR = {
        			ai_compassion > 0
        			ai_honor > 0
        			ai_zeal > 0
        		}
        	}
        	if = {
	            limit = { government_allows = merit }
	            change_merit = minor_merit_gain
	        }
        	stress_impact = {
	        	compassionate = minor_stress_impact_loss
	        	trusting = minor_stress_impact_loss
	        }
        }
        else_if = {
        	limit = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_c }
        		ai_sociability < 0
        	}

        	stress_impact = {
	        	shy = minor_stress_impact_loss
	        	gregarious = minor_stress_impact_gain
	        }
        }


        ai_chance = {
        	base = 1
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_compassion < 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_honor < 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_zeal < 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_a }
        		ai_vengefulness > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_compassion > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_honor > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_b }
        		ai_zeal > 0
        		add = 10
        	}
        	modifier = {
        		scope:stop_host_scope = { has_character_flag = az_tour_0006_c }
        		ai_sociability > 0
        		add = -30
        	}

        }
    }

    option = {
        name = az_tour.1006.c # "I don't care."

        stress_impact = {
        	base = medium_stress_impact_loss
        	lazy = minor_stress_impact_loss
        }

        scope:stop_host_scope = {
            send_interface_toast = {
                title = az_tour.1006.c.toast
                show_as_tooltip = {
                	root = {
                		stress_impact = {
				        	base = medium_stress_impact_loss
				        	lazy = minor_stress_impact_loss
				        }
                	}
                } 
            }
        }

        ai_chance = {
        	base = 1
        	ai_value_modifier = {
		        ai_zeal = -2
		        ai_boldness = 2
		    }
        }
    }

    after = {
    	scope:angry_farmer = {
    		silent_disappearance_effect = yes
    	}
    	scope:stop_host_scope = {
    		# Cleanup
            if = {
                limit = {
                    has_character_flag = az_tour_0006_a
                }
                remove_character_flag = az_tour_0006_a
            }
            if = {
                limit = {
                    has_character_flag = az_tour_0006_b
                }
                remove_character_flag = az_tour_0006_b
            }
            if = {
                limit = {
                    has_character_flag = az_tour_0006_c
                }
                remove_character_flag = az_tour_0006_c
            }
    	}
    }
}

# The Plum Festival
az_tour.0007 = {
    type = activity_event
    title = az_tour.0007.t
    desc = az_tour.0007.desc

    theme = cultural_festival
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = pondering
        camera = camera_event_left_pointing_right
    }

    center_portrait = {
        character = scope:elegant_noble
        animation = chancellor
        camera = camera_event_center
    }

    right_portrait = {
        character = scope:stop_host_scope
        animation = scheme
        camera = camera_event_right_pointing_right_scheme
    }

    trigger = {
    	current_season_trigger = {
			SEASON = spring
		}
        scope:stop_host_scope = { 
        	culture = { has_graphical_east_asia_culture_group_trigger = yes }
        	any_courtier_or_guest = {
        		is_ai = yes
        		is_adult = yes
        		OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
        	}
        }
    }

    immediate = {
        scope:stop_host_scope = {
            random_courtier_or_guest = {
                limit = { 
	                is_ai = yes
	        		is_adult = yes
	        		OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
                }
                save_scope_as = elegant_noble
            }
        }
    } 

    option = {
        name = az_tour.0007.a # "Such balance! The brushwork alone deserves a post."

        scope:elegant_noble = {
        	if = {
        		limit = {
        			root = {
	        			can_add_hook = {
							target = scope:elegant_noble
							type = favor_hook
						}
        			}
        		}
        		root = {
        			add_hook = {
		                type = favor_hook
		                target = scope:elegant_noble
		            }
        		}
	        }
	        add_opinion = {
                target = root
                modifier = pleased_opinion
                opinion = 20
            }
        }

        if = {
            limit = { government_allows = merit }
            change_merit = minor_merit_gain

        }
        else = {
        	add_prestige = minor_prestige_gain
        }

        if = {
        	limit = {
        		court_positions_currently_filled < court_positions_currently_available
        		scope:elegant_noble = {
        			AND = {
						has_any_court_position = no
						can_be_employed_as_any_court_position_trigger = yes
						is_councillor = no
						is_acclaimed = no
					}
        		}
        	}
        	employ_character_as_any_free_position_effect = {
        		CHARACTER = scope:elegant_noble
        	}
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
            humble = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 15 
            	has_trait = ambitious
            }
            modifier = { 
            	add = -15 
            	has_trait = humble
            }
            ai_value_modifier = { ai_greed = 1 }
        }
    }

    option = {
        name = az_tour.0007.b # "In spring’s brief bloom, all boasts fade."

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }
        else = {
        	add_learning_lifestyle_xp = minor_lifestyle_xp
        	random = {
				chance = 10
				add_trait = confucian_education
			}
        }

        stress_impact = {
            shy = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }

        ai_chance = {
            base = 35
            modifier = { 
            	add = 10 
            	has_trait = shy 
            }
            modifier = { 
            	add = -10 
            	has_trait = arrogant
            }
            ai_value_modifier = { ai_zeal = 1 }
        }
    }

    option = {
        name = az_tour.0007.c # "The true art here is in flattery, not flowers."

        add_prestige = minor_prestige_gain

        add_character_modifier = {
            modifier = tgp_mocked_elites_modifier
            years = 5
        }

        scope:stop_host_scope = {
            add_opinion = {
                target = root
                modifier = disrespect_opinion
                opinion = -10
            }
            trigger_event = az_tour.1007
        }

        stress_impact = {
            arrogant = minor_stress_impact_loss
            gregarious = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = { 
            	add = 15 
            	has_trait = arrogant
            }
            modifier = { 
            	add = -10 
            	has_trait = gregarious 
            }
            ai_value_modifier = { ai_greed = -1 }
        }
    }
}

# The Bloom Withers
az_tour.1007 = {
    type = character_event
    title = az_tour.1007.t
    desc = az_tour.1007.desc

    theme = cultural_festival

    left_portrait = {
        character = root
        animation = scheme
        camera = camera_event_left_pointing_right
    }

    center_portrait = {
        character = scope:elegant_noble
        animation = chancellor
        camera = camera_event_center
    }

    right_portrait = {
        character = scope:visiting_liege
        animation = pondering
        camera = camera_event_right_pointing_right_scheme
    }

    option = {
        name = az_tour.1007.a # "Let them laugh, if they must."

        add_piety = minor_piety_gain

        stress_impact = {
            wrathful = minor_stress_impact_gain
            humble = minor_stress_impact_loss
        }

        ai_chance = {
            base = 60
            modifier = {
                add = 20
                has_trait = humble
            }
            modifier = {
                add = -15
                has_trait = wrathful
            }
        }
    }

    option = {
        name = az_tour.1007.b # "They humiliate me in front of my peers…"

        progress_towards_rival_effect = {
			CHARACTER = root
			REASON = rival_mocked_praise
			OPINION = default_rival_opinion
		}

        stress_impact = {
        	ambitious = minor_stress_impact_loss
        	content = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = {
                add = 20
                has_trait = ambitious
            }
            modifier = {
                add = -15
                has_trait = content
            }
        }
    }
}

# Ask liege to judge a court scholar
az_tour.0008 = {
    type = activity_event
    title = az_tour.0008.t
    desc = az_tour.0008.desc

    theme = cultural_festival

    left_portrait = {
        character = root
        animation = personality_greedy
        camera = camera_event_left
    }

    center_portrait = {
        character = scope:visiting_liege
        animation = pondering
        camera = camera_event_right
    }

    right_portrait = {
    	character = scope:revered_scholar
        animation = chancellor
        camera = camera_event_right
    }

    trigger = {
    	culture = { has_graphical_east_asia_culture_group_trigger = yes }
    	any_courtier = {
    		learning > high_skill_rating
    		OR = {
                has_trait = education_learning
                has_trait = confucian_education
            }
    	}
    }

    immediate = {
        # Save a local calligrapher or scholar for the next event
        random_courtier = {
            limit = {
            	learning > high_skill_rating
                OR = {
                    has_trait = education_learning
                    has_trait = confucian_education
                }
            }
            save_scope_as = revered_scholar
        }
    }

    option = {
    name = az_tour.0008.a # "Invite [visiting_liege.GetTitledFirstName] to judge the demonstration."

    custom_tooltip = az_tour.0008.a.tt
    
    scope:visiting_liege = {
        trigger_event = az_tour.1008
    }

    stress_impact = {
        arrogant = minor_stress_impact_loss
        humble = minor_stress_impact_gain
        shy = minor_stress_impact_gain
    }

    ai_chance = {
        base = 60
        modifier = {
            add = 20
            has_trait = arrogant
        }
        modifier = {
            add = -10
            has_trait = shy
        }
        modifier = {
            add = -10
            has_trait = humble
        }
    }
}


    option = {
        name = az_tour.0008.b # "Let [visiting_liege.GetTitledHouseNameOrFirstName] enjoy it in peace."

        scope:visiting_liege = {
	        add_opinion = {
	            target = root
	            opinion = 10
	            modifier = relieved_opinion
	        }
	    }

        stress_impact = {
        	base = minor_stress_impact_loss
            shy = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
            gregarious = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = {
                add = 15
                has_trait = shy
            }
            modifier = {
                add = -15
                has_trait = arrogant
            }
            modifier = {
                add = -15
                has_trait = gregarious
            }
        }
    }
}

# Vassal asks you to judge a court scholar
az_tour.1008 = {
    type = activity_event
    theme = cultural_festival
    title = az_tour.1008.t
    desc = {
        desc = az_tour.1008.desc.intro
        random_valid = {
            triggered_desc = {
                trigger = {
                    learning >= high_skill_rating
                }
                desc = az_tour.1008.desc.praise_subtle
            }
            triggered_desc = {
                trigger = {
                    has_trait = arrogant
                }
                desc = az_tour.1008.desc.arrogant_judgment
            }
            triggered_desc = {
                trigger = {
                    has_trait = shy
                }
                desc = az_tour.1008.desc.shy_discomfort
            }
            desc = az_tour.1008.desc.generic_comment
        }
    }

    left_portrait = {
        character = root
        animation = pondering
        camera = camera_event_left
    }

    right_portrait = {
    	character = scope:revered_scholar
        animation = chancellor
        camera = camera_event_right
    }

    center_portrait = {
        character = scope:stop_host_scope
        animation = personality_greedy
        camera = camera_event_right
    }

    option = {
	    name = az_tour.1008.a # "A masterful display — subtle, balanced, alive."
	    trigger = {
	        OR = {
	            learning >= high_skill_rating
	            has_trait = lifestyle_poet
	            has_trait = scholar
	        }
	    }

	    add_prestige = minor_prestige_gain
	    add_learning_lifestyle_xp = minor_lifestyle_xp

	    hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1008.a.toast
                    add_prestige = minor_prestige_gain
                    root = {
	    	            add_opinion = {
	    		            target = scope:stop_host_scope
	    		            modifier = admiration_opinion
	    		            opinion = 10
	    		        }
	    	        }
                }
    	    }
	   	}

	    stress_impact = {
	        humble = minor_stress_impact_loss
	        arrogant = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 50
	        modifier = { 
	        	add = 20 
	        	has_trait = lifestyle_poet 
	        }
	        modifier = { 
	        	add = 15 
	        	has_trait = scholar 
	        }
	        modifier = { 
	        	add = 10 
	        	learning >= high_skill_rating 
	        }
	        modifier = { 
	        	add = 10 
	        	has_trait = confucian_education 
	        }
	        modifier = { 
	        	add = -15 
	        	has_trait = arrogant 
	        }
	        modifier = { 
	        	add = -10 
	        	has_trait = shy 
	        }
	    }
	}

	option = {
	    name = az_tour.1008.b # "Tidy work, if a little... provincial."
	    
	    add_prestige = minor_prestige_gain

	    hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1008.b.toast
                	add_stress = minor_stress_gain
                	root = {
	    	            add_opinion = {
	    		            target = scope:stop_host_scope
	    		            modifier = disappointed_opinion
	    		            opinion = -10
	    		        }
	    	        }
                }
    	    }
	   	}

	    stress_impact = {
	        arrogant = minor_stress_impact_loss
	        humble = minor_stress_impact_gain
	        shy = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 30
	        modifier = { 
	        	add = 30 
	        	has_trait = arrogant 
	        }
	        modifier = { 
	        	add = -10 
	        	has_trait = humble 
	        }
	        modifier = { 
	        	add = -10 
	        	has_trait = shy 
	        }
	    }
	}

	option = {
	    name = az_tour.1008.c # "The form is admirable, but I must consider the spirit as well."
	    add_learning_lifestyle_xp = minor_lifestyle_xp

	    hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1008.c.toast
                    root = {
	    	            add_opinion = {
	    		            target = scope:stop_host_scope
	    		            modifier = admiration_opinion
	    		            opinion = 10
	    		        }
	    	        }
                }
    	    }
	   	}

	    stress_impact = {
	        gregarious = minor_stress_impact_gain
	        shy = minor_stress_impact_loss
	        diligent = minor_stress_impact_loss
	        arrogant = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 40
	        modifier = { 
	        	add = 15 
	        	has_trait = shy 
	        }
	        modifier = { 
	        	add = -10 
	        	has_trait = gregarious 
	        }
	        modifier = { 
	        	add = 10 
	        	has_trait = diligent 
	        }
	        modifier = { 
	        	add = -10 
	        	has_trait = arrogant 
	        }
	    }
	}

	option = {
	    name = az_tour.1008.d # "Forgive me. I have other matters to attend to."
	    
	    scope:stop_host_scope = {
	        add_opinion = {
	            target = root
	            modifier = disappointed_opinion
	            opinion = -10
	        }
	    }

	    hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1008.d.toast
                    add_prestige = minor_prestige_loss
                }
    	    }
	   	}

	    stress_impact = {
	        base = minor_stress_impact_loss
	        shy = minor_stress_impact_loss
	        arrogant = minor_stress_impact_loss
	        diligent = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 20
	        modifier = { 
	        	add = 20 
	        	has_trait = shy 
	        }
	        modifier = { 
	        	add = 10 
	        	has_trait = arrogant
	        }
	        modifier = { 
	        	add = -10 
	        	has_trait = diligent
	        }
		}
	}
}

# Is it time for dancing?
az_tour.0009 = {
    type = activity_event
    title = az_tour.0009.t
    desc = az_tour.0009.desc

    theme = cultural_festival

    left_portrait = {
        character = root
        animation = throne_room_conversation_3
        camera = camera_event_left
    }

    center_portrait = {
    	character = scope:chancellor
        animation = scheme
        camera = camera_event_center_pointing_left
    }

    right_portrait = {
        character = scope:visiting_liege
        animation = page_flipping
        camera = camera_event_right_pointing_right
    }
    
    trigger = {
        culture = { has_graphical_east_asia_culture_group_trigger = yes }
    }

    immediate = {
    	cp:councillor_chancellor = {
			save_scope_as = chancellor
		}
    }

    option = {
        name = az_tour.0009.a # "Let them prepare the dance."

        custom_tooltip = az_tour.0009.a.tt

        scope:visiting_liege = {
            trigger_event = az_tour.1009
        }

        stress_impact = {
            gregarious = minor_stress_impact_loss
            diligent = minor_stress_impact_gain
        }

        ai_chance = {
            base = 60
            modifier = { 
            	add = 20 
            	has_trait = gregarious 
            }
            modifier = { 
            	add = -10 
            	has_trait = diligent 
            }
            modifier = { 
            	add = -15 
            	has_trait = shy 
            }
        }
    }

    option = {
        name = az_tour.0009.b # "Our time is best spent discussing our duties."

        add_stewardship_lifestyle_xp = minor_lifestyle_xp

        stress_impact = {
            shy = minor_stress_impact_loss
            arrogant = minor_stress_impact_loss
            gregarious = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 20 
            	has_trait = shy 
            }
            modifier = { 
            	add = 10 
            	has_trait = arrogant 
            }
            modifier = { 
            	add = -10 
            	has_trait = gregarious 
            }
        }
    }
}

# Costumed villagers perform a dance
az_tour.1009 = {
    type = activity_event
    title = az_tour.1009.t
    desc = az_tour.1009.desc

    theme = cultural_festival

    left_portrait = {
        character = scope:stop_host_scope
        animation = personality_greedy
        camera = camera_event_left
    }

    center_portrait = {
        character = root
        animation = happiness
        camera = camera_event_center
    }

    right_portrait = {
        character = scope:peasant
        animation = dancing
        hide_info = yes
        camera = camera_event_center_pointing_left
    }

    immediate = {
    	location.county = {
        	save_scope_as = local_county
        }

        random_pool_character = {
			province = scope:activity.activity_location
			limit = {
				is_ai = yes
				is_adult = yes
				has_no_particular_noble_roots_trigger = yes
				is_clergy = no
			}
			save_scope_as = peasant
		}
        # Generate anonymous peasant
        if = {
        	limit = {
        		NOT = {
        			exists = scope:peasant
        		}
        	}
        	create_character = {
		    	template = servant_character
				dynasty = none
				location = scope:stop_host_scope.location
				gender_female_chance = root_soldier_female_chance
				save_scope_as = peasant
		    }
        }	    
    }

    option = {
        name = az_tour.1009.a # "I'll join the dancers — just for a moment!"

        hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1009.a.toast
                    root = {
                    	add_opinion = {
				            target = scope:stop_host_scope
				            modifier = entertained_opinion
				            opinion = 10
				        }
                    }
                    show_as_tooltip = {
                    	scope:local_county = {
				            add_county_modifier = {
				                modifier = tgp_popular_festival_performance_modifier
				                years = 5
				            }
				        }
                    }
                }
    	    }
	   	}
        

        scope:local_county = {
            add_county_modifier = {
                modifier = tgp_popular_festival_performance_modifier
                years = 5
            }
        }

        stress_impact = {
            gregarious = minor_stress_impact_loss
            shy = minor_stress_impact_gain
            arrogant = minor_stress_impact_gain
        }

        ai_chance = {
            base = 45
            modifier = { 
            	add = 20 
            	has_trait = gregarious 
            }
            modifier = { 
            	add = -15 
            	has_trait = shy 
            }
            modifier = { 
            	add = -10 
            	has_trait = arrogant 
            }
        }
    }

    option = {
        name = az_tour.1009.b # "A small gift, to honor their devotion."


        add_piety = minor_piety_gain

        pay_short_term_gold = {
			target = scope:stop_host_scope
			gold = medium_gold_value
		}

        hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1009.a.toast
                    root = {
                    	add_opinion = {
				            target = scope:stop_host_scope
				            modifier = pleased_opinion
				            opinion = 10
				        }
                    }
                    show_as_tooltip = {
                    	pay_short_term_gold = {
							target = scope:stop_host_scope
							gold = medium_gold_value
						}
                    }
                }
    	    }
	   	}

        scope:stop_host_scope = {
            add_opinion = {
                target = scope:visiting_liege
                modifier = respect_opinion
                opinion = 15
            }
        }

        stress_impact = {
            zealous = minor_stress_impact_loss
            cynical = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = { 
            	add = 20 
            	has_trait = zealous 
            }
            modifier = { 
            	add = -10 
            	has_trait = cynical 
            }
        }
    }

    option = {
        name = az_tour.1009.c # "It's best I observe from afar."

        add_piety = minor_piety_gain

        hidden_effect = {
    	    scope:stop_host_scope = {
    	    	send_interface_toast = {
                    title = az_tour.1009.a.toast
                    root = {
                    	add_opinion = {
				            target = scope:stop_host_scope
				            modifier = pleased_opinion
				            opinion = 10
				        }
                    }
                }
    	    }
	   	}

        stress_impact = {
            shy = minor_stress_impact_loss
            humble = minor_stress_impact_loss
            gregarious = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = { 
            	add = 15 
            	has_trait = shy 
            }
            modifier = { 
            	add = 10 
            	has_trait = humble 
            }
            modifier = { 
            	add = -10 
            	has_trait = gregarious 
            }
        }
    }

    after = {
    	scope:peasant = {
			silent_disappear_ai_if_not_hired = yes
		}
    }
}