namespace = Plus

#reserved: Plus.900 to Plus.949

#######################################
# AMBITION EVENTS
#######################################

### Councillor tries to befriend liege
character_event = {
	id = Plus.900
	desc = EVTDESC_Plus_900
	picture = GFX_evt_courtiers_talking

	prisoner = no
	min_age = 16
	capable_only = yes

	trigger = {
		OR = {
			has_ambition = obj_make_a_friend
			has_ambition = obj_befriend_liege
		}
		in_command_trigger = no
		is_councillor = yes
		NOT = { is_inaccessible_trigger = yes }
		liege = {
			age = 16
			prisoner = no
			in_command_trigger = no
			NOR = {
				trait = incapable
				is_friend = ROOT
				is_rival = ROOT
				num_of_friends = 2
				is_inaccessible_trigger = yes
			}
			OR = {
				AND = {
					is_female = no
					ROOT = { is_female = no }
				}
				AND = {
					is_female = yes
					ROOT = { is_female = yes }
				}
			}
			OR = {
				NOT = { has_character_flag = approached_for_friendship }
				had_character_flag = { flag = approached_for_friendship days = 365 }
			}
		}
		opinion = { who = liege value = 10 }
	}

	mean_time_to_happen = {
		months = 140
		modifier = {
			factor = 0.75
			trait = gregarious
		}
		modifier = {
			factor = 0.5
			liege = { is_close_relative = ROOT }
		}
		modifier = {
			factor = 0.5
			liege = { has_ambition = obj_make_a_friend }
		}
		modifier = {
			factor = 0.65
			opinion = { who = LIEGE value = 75 }
		}
	}

	option = {
		name = "EVTOPTA_Plus_900"  # Let's try
		ai_chance = { factor = 95 }
		liege = {
			set_character_flag = approached_for_friendship
			character_event = {
				id = Plus.901
				days = 1
				random = 3
				tooltip = "make_friend_attempt_tooltip"
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_900"  # Maybe later
		ai_chance = { factor = 5 }
		random = {
			chance = 10
			add_trait = shy
		}
	}

}

# Liege responds
character_event = {
	id = Plus.901
	desc = EVTDESC_Plus_901
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EVTOPTA_Plus_901" # Make Friends
		add_friend = FROM
		FROM = {
			character_event = {
				id = Plus.902
				days = 1
				random = 3
				tooltip = "make_friend_success_tooltip"
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_901" # Rebuff him
		FROM = {
			character_event = {
				id = Plus.903
				days = 1
				random = 3
				tooltip = "make_friend_sad_tooltip"
			}
		}
	}
}

# Friends - councillor and liege
character_event = {
	id = Plus.902
	desc = EVTDESC_Plus_902
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EXCELLENT"
		add_friend = FROM
	}
}

# Sad - councillor and liege
character_event = {
	id = Plus.903
	desc = EVTDESC_Plus_903
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "SO_BE_IT"
		opinion = {
			modifier = opinion_sad
			who = FROM
			years = 2
		}
	}
}

### Ruler tries to befriend a courtier
character_event = {
	id = Plus.905
	desc = EVTDESC_Plus_905
	picture = GFX_evt_courtiers_talking
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	war = no

	trigger = {
		has_ambition = obj_make_a_friend
		in_command_trigger = no
		is_ill = no
		NOT = { is_inaccessible_trigger = yes }
		any_courtier = {
			in_command_trigger = no
			prisoner = no
			is_adult = yes
			is_ill = no
			NOT = { is_inaccessible_trigger = yes }
			OR = {
				AND = {
					is_female = no
					ROOT = { is_female = no }
				}
				AND = {
					is_female = yes
					ROOT = { is_female = yes }
				}
			}
			opinion = { who = ROOT value = 0 }
			NOR = {
				any_child = { character = ROOT }
				trait = incapable
				num_of_friends = 2
				is_friend = ROOT
				is_rival = ROOT
			}
		}
	}

	mean_time_to_happen = {
		months = 60
		modifier = {
			factor = 0.85
			trait = gregarious
		}
		modifier = {
			factor = 0.85
			age = 25
		}
		modifier = {
			factor = 0.85
			age = 35
		}
		modifier = {
			factor = 0.75
			lower_tier_than = duke
		}
	}

	option = {
		name = "EVTOPTA_Plus_905"  # Let's see what they have to say
		ai_chance = { factor = 95 }
		random_courtier = {
			limit = {
				in_command_trigger = no
				prisoner = no
				is_adult = yes
				is_ill = no
				NOT = { is_inaccessible_trigger = yes }
				OR = {
					AND = {
						is_female = no
						ROOT = { is_female = no }
					}
					AND = {
						is_female = yes
						ROOT = { is_female = yes }
					}
				}
				opinion = { who = ROOT value = 0 }
				NOR = {
					any_child = { character = ROOT }
					trait = incapable
					num_of_friends = 2
					is_friend = ROOT
					is_rival = ROOT
				}
			}
			character_event = {
				id = Plus.906
				days = 1
				random = 3
				tooltip = "make_friend_attempt_tooltip"
			}
		}
	}

	option = {
		name = "EVTOPTB_Plus_905"  # I'm not interested in these people
		ai_chance = { factor = 5 }
		random = {
			chance = 10
			add_trait = proud
		}
	}
}

# Courtier decides if he wants to make friends with liege
character_event = {
	id = Plus.906
	desc = EVTDESC_Plus_906
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EVTOPTA_Plus_906" # Make Friends
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0.5
				NOT = { opinion = { who = LIEGE value = 25 } }
			}
		}
		add_friend = FROM
		FROM = {
			character_event = {
				id = Plus.907
				days = 1
				random = 3
				tooltip = "make_friend_success_tooltip"
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_906" # Rebuff him
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0.5
				opinion = { who = LIEGE value = 25 }
			}
		}
		FROM = {
			character_event = {
				id = Plus.908
				days = 1
				random = 3
				tooltip = "make_friend_sad_tooltip"
			}
		}
	}
}

# Friends - courtier and liege
character_event = {
	id = Plus.907
	desc = EVTDESC_Plus_907
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EXCELLENT"
		add_friend = FROM
	}
}

# Sad - courtier and liege
character_event = {
	id = Plus.908
	desc = EVTDESC_Plus_908
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "SO_BE_IT"
		opinion = {
			modifier = opinion_sad
			who = FROM
			years = 2
		}
	}
}

### Duelist tries to befriend liege
character_event = {
	id = Plus.910
	desc = EVTDESC_Plus_910
	picture = GFX_evt_courtiers_talking

	min_age = 16
	capable_only = yes
	prisoner = no

	trigger = {
		OR = {
			has_ambition = obj_make_a_friend
			has_ambition = obj_befriend_liege
			liege = { has_ambition = obj_make_a_friend }
		}
		in_command_trigger = no
		OR = {
			trait = duelist
			trait = tough_soldier
			trait = skilled_tactician
			trait = brilliant_strategist
		}
		OR = {
			is_female = no
			trait = martial_lady
			trait = martial_lady_tengri
			trait = martial_lady_pagan
		}
		NOT = { is_inaccessible_trigger = yes }
		independent = no
		liege = {
			age = 16
			prisoner = no
			in_command_trigger = no
			NOT = { is_inaccessible_trigger = yes }
			OR = {
				is_female = no
				trait = martial_lady
				trait = martial_lady_tengri
				trait = martial_lady_pagan
			}
			NOR = {
				trait = content
				trait = kind
				trait = craven
				is_weak_trigger = yes
				trait = incapable
				is_friend = ROOT
				is_rival = ROOT
				num_of_friends = 2
			}
			OR = {
				NOT = { has_character_flag = approached_for_friendship }
				had_character_flag = { flag = approached_for_friendship days = 365 }
			}
		}
		opinion = { who = liege value = 10 }
	}

	mean_time_to_happen = {
		months = 260
		modifier = {
			factor = 0.85
			trait = gregarious
		}
		modifier = {
			factor = 0.65
			liege = { is_close_relative = ROOT }
		}
		modifier = {
			factor = 0.5
			trait = duelist
		}
		modifier = {
			factor = 0.5
			liege = { trait = duelist }
		}
		modifier = {
			factor = 0.5
			liege = { has_ambition = obj_make_a_friend }
		}
		modifier = {
			factor = 0.85
			opinion = { who = LIEGE value = 75 }
		}
	}

	option = {
		name = "EVTOPTA_Plus_900"  # Let's try
		ai_chance = { factor = 95 }
		liege = {
			set_character_flag = approached_for_friendship
			character_event = {
				id = Plus.911
				days = 1
				random = 3
				tooltip = "make_friend_attempt_tooltip"
			}
		}
	}

	option = {
		name = "EVTOPTB_Plus_900"  # Maybe later
		ai_chance = { factor = 5 }
		random = {
			chance = 10
			add_trait = shy
		}
	}
}

# Liege responds
character_event = {
	id = Plus.911
	desc = EVTDESC_Plus_911
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EVTOPTA_Plus_901" # Make Friends
		add_friend = FROM
		random = {
			chance = 25
			change_martial = 1
		}
		hidden_tooltip = { change_variable = { which = lifestyle_martial value = 1 } }
		FROM = {
			character_event = {
				id = Plus.912
				days = 1
				random = 3
				tooltip = "make_friend_success_tooltip"
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_906" # Rebuff him
		FROM = {
			character_event = {
				id = Plus.913
				days = 1
				random = 3
				tooltip = "make_friend_sad_tooltip"
			}
		}
	}
}

# Friends - duelist and liege
character_event = {
	id = Plus.912
	desc = EVTDESC_Plus_912
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EXCELLENT"
		hidden_tooltip = { change_variable = { which = lifestyle_martial value = 1 } }
		add_friend = FROM
	}
}

# Sad - duelist and liege
character_event = {
	id = Plus.913
	desc = EVTDESC_Plus_913
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "SO_BE_IT"
		opinion = {
			modifier = opinion_sad
			who = FROM
			years = 2
		}
	}
}

### Friendship between two courtiers
character_event = {
	id = Plus.915
	desc = EVTDESC_Plus_915
	picture = GFX_evt_courtiers_talking

	min_age = 16
	capable_only = yes
	prisoner = no

	trigger = {
		has_ambition = obj_make_a_friend
		in_command_trigger = no
		independent = no
		NOT = { is_inaccessible_trigger = yes }
		liege = {
			any_courtier = {
				in_command_trigger = no
				prisoner = no
				is_adult = yes
				is_ill = no
				at_location = ROOT
				NOT = { is_inaccessible_trigger = yes }
				OR = {
					AND = {
						is_female = no
						ROOT = { is_female = no }
					}
					AND = {
						is_female = yes
						ROOT = { is_female = yes }
					}
				}
				opinion = { who = ROOT value = 0 }
				NOR = {
					any_child = { character = ROOT }
					trait = incapable
					num_of_friends = 2
					is_friend = ROOT
					is_rival = ROOT
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 120
		modifier = {
			factor = 0.5
			trait = gregarious
		}
	}

	option = {
		name = "EVTOPTA_Plus_905"  # Let's see what they have to say
		ai_chance = { factor = 95 }
		liege = {
			random_courtier = {
				limit = {
					in_command_trigger = no
					prisoner = no
					is_adult = yes
					is_ill = no
					at_location = ROOT
					NOT = { is_inaccessible_trigger = yes }
					OR = {
						AND = {
							is_female = no
							ROOT = { is_female = no }
						}
						AND = {
							is_female = yes
							ROOT = { is_female = yes }
						}
					}
					opinion = { who = ROOT value = 0 }
					NOR = {
						any_child = { character = ROOT }
						trait = incapable
						num_of_friends = 2
						is_friend = ROOT
						is_rival = ROOT
					}
				}
				character_event = {
					id = Plus.916
					days = 1
					random = 3
					tooltip = "make_friend_attempt_tooltip"
				}
			}
		}
	}

	option = {
		name = "EVTOPTB_Plus_906"  # Maybe later
		ai_chance = { factor = 5 }
		random = {
			chance = 10
			add_trait = shy
		}
	}

}

# Other courtier responds
character_event = {
	id = Plus.916
	desc = EVTDESC_Plus_916
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EVTOPTA_Plus_906" # Make Friends
		ai_chance = { factor = 75 }
		add_friend = FROM
		FROM = {
			character_event = {
				id = Plus.917
				days = 1
				random = 3
				tooltip = "make_friend_success_tooltip"
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_906" # Rebuff him
		ai_chance = { factor = 25 }
		FROM = {
			character_event = {
				id = Plus.918
				days = 1
				random = 3
				tooltip = "make_friend_sad_tooltip"
			}
		}
	}
}

# Friends - 2 courtiers
character_event = {
	id = Plus.917
	desc = EVTDESC_Plus_917
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "EXCELLENT"
		add_friend = FROM
	}
}

# Sad - 2 courtiers
character_event = {
	id = Plus.918
	desc = EVTDESC_Plus_918
	picture = GFX_evt_courtiers_talking

	is_triggered_only = yes

	option = {
		name = "SO_BE_IT"
		opinion = {
			modifier = opinion_sad
			who = FROM
			years = 2
		}
	}
}

### CHANGE NICKNAME

# Character receives event to try to remove nickname
character_event = {
	id = Plus.925
	desc = EVTDESC_Plus_925
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	ai = no
	only_rulers = yes
	capable_only = yes
	prisoner = no
	
	trigger = {
		has_ambition = obj_change_nick
		has_nickname = yes
		NOT = { has_character_modifier = change_nick_timer }
		NOT = { is_inaccessible_trigger = yes }
	}
	
	immediate = {
		add_character_modifier = {
			name = change_nick_timer
			duration = 365
			hidden = yes
		}
	}
	
	option = {
		name = EVTOPTA_Plus_925 #Just make them stop
		random_list = {
			50 = {
				character_event = { id = Plus.926 days = 30 tooltip = successful_change_nick }
			}
			50 = {
				character_event = { id = Plus.928 days = 30 tooltip = failed_change_nick }
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_925 #Punish anyone who utters itthat will do the trick
		trigger = {
			NOR = {
				trait = kind
				trait = just
			}
		}
		if = {
			limit = { NOT = { trait = cruel } }
			random = {
				chance = 30
				add_trait = cruel
			}
		}
		tyrant_plus_1_effect = yes
		character_event = { id = Plus.927 days = 30 tooltip = successful_change_nick }
	}
	option = {
		name = EVTOPTC_Plus_925 #Do whatever you have to, I don't care
		trigger = {
			prestige = 500
		}
		prestige = -200
		random_list = {
			75 = {
				character_event = { id = Plus.926 days = 30 tooltip = successful_change_nick }
			}
			25 = {
				character_event = { id = Plus.928 days = 30 tooltip = failed_change_nick }
			}
		}
	}
	option = {
		name = EVTOPTD_Plus_925 #Perhaps I should let it go...
		set_character_flag = gave_up_change_nick
		if = {
			limit = { trait = proud }
			random = {
				chance = 30
				remove_trait = proud
			}
		}
		if = {
			limit = {
				NOT = { trait = humble }
				NOT = { trait = proud }
			}
			random = {
				chance = 30
				add_trait = humble
			}
		}
	}
}

# Successfully removes nickname
character_event = {
	id = Plus.926
	desc = EVTDESC_Plus_926
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	only_rulers = yes
	
	trigger = {
		has_ambition = obj_change_nick
		has_nickname = yes
	}
	
	option = {
		name = EXCELLENT
		hidden_tooltip = { remove_nickname = ROOT }
	}
}

# Removes nickname through the use of force
character_event = {
	id = Plus.927
	desc = EVTDESC_Plus_927
	picture = GFX_evt_burning_house
	
	is_triggered_only = yes
	
	only_rulers = yes
	
	trigger = {
		has_ambition = obj_change_nick
		has_nickname = yes
	}
	
	option = {
		name = EXCELLENT
		hidden_tooltip = { remove_nickname = ROOT }
	}
}

# Character fails to lose the nickname
character_event = {
	id = Plus.928
	desc = EVTDESC_Plus_928
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	only_rulers = yes

	trigger = {
		has_ambition = obj_change_nick
		has_nickname = yes
	}
	
	option = {
		name = EVTOPTA_Plus_928 #Try again
	}
	option = {
		name = EVTOPTD_Plus_925 #Perhaps I should let it go...
		set_character_flag = gave_up_change_nick
		if = {
			limit = { trait = proud }
			random = {
				chance = 30
				remove_trait = proud
			}
		}
		if = {
			limit = {
				NOT = { trait = humble }
				NOT = { trait = proud }
			}
			random = {
				chance = 30
				add_trait = humble
			}
		}
	}
}

