﻿#Diplomatic Scheme Events relating to your lifestyle

namespace = diplomatic_scheme_lifestyle

#0001-0999	- Statecraft Lifestyle events
#1001-1999	- Warfare Lifestyle events
#2001-2999	- Governance Lifestyle events
#3001-3999	- Guile Lifestyle events
#4001-4999	- Scholarship Lifestyle events





##############################
# STATECRAFT LIFESTYLE EVENTS
# 0001-0999
##############################





##############################
# WARFARE LIFESTYLE EVENTS
# 1001-1999
##############################

#An exchange of letters
diplomatic_scheme_lifestyle.1001 = {
	type = character_event
	title = diplomatic_scheme_lifestyle.1001.t
	desc = diplomatic_scheme_lifestyle.1001.desc
	theme = befriend_scheme
	left_portrait = {
		character = root
		animation = writing
	}
	right_portrait = {
		character = scope:target
		animation = marshal
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	trigger = {
		NOT = { has_character_flag = had_warfare_letter_exchange_event }
		has_lifestyle = martial_lifestyle
		scope:target = { has_lifestyle = martial_lifestyle }
		scope:scheme = {
			scheme_agent_charges < opportunity_cap_value
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_warfare_letter_exchange_event
			days = 1095
		}
	}

	option = { #Listen carefully to them
		name = diplomatic_scheme_lifestyle.1001.a
		scope:scheme = {
			add_scheme_modifier = {
				type = lifestyle_common_interests_modifier
				days = 365
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = { #Excitedly tell them everything you know
		name = diplomatic_scheme_lifestyle.1001.b
		scope:scheme = {
			change_opportunities = 2
		}
		stress_impact = {
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_zeal = 0.25
				ai_energy = 0.25
			}
		}
	}
}




##############################
# GOVERNANCE LIFESTYLE EVENTS
# 2001-2999
##############################







##############################
# GUILE LIFESTYLE EVENTS
# 3001-3999
##############################

#Spy on target to learn likes/dislikes
diplomatic_scheme_lifestyle.3001 = {
	type = character_event
	title = diplomatic_scheme_lifestyle.3001.t
	desc = diplomatic_scheme_lifestyle.3001.desc
	theme = befriend_scheme
	left_portrait = {
		character = root
		animation = scheme
	}
	right_portrait = {
		character = scope:target
		animation = boredom
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_diplomatic_scheme_lifestyle_3001 }
		has_trait = schemer
		scope:scheme = {
			scheme_agent_charges < opportunity_cap_value
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_diplomatic_scheme_lifestyle_3001
			days = 3650
		}
	}

	option = { #This is how you make friends, right?!
		name = diplomatic_scheme_lifestyle.3001.a
		trait = schemer
		scope:scheme = {
			add_scheme_modifier = {
				type = lifestyle_spying_on_target_modifier
				days = 1825
			}
		}
		custom_tooltip = diplomatic_scheme_lifestyle.3001.a.tt
	}

	option = { #Nah
		name = diplomatic_scheme_lifestyle.3001.b
		custom_tooltip = diplomatic_scheme_lifestyle.3001.b.tt
		scope:scheme = {
			change_opportunities = 2
		}
	}
}


#Lose scheme progress in exchange for prestige
diplomatic_scheme_lifestyle.3101 = {
	type = character_event
	title = diplomatic_scheme_lifestyle.3101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:target = {
						OR = {
							opinion = {
								target = root
								value <= 0
							}
							has_relation_potential_rival = root
							has_relation_rival = root
						}
					}
				}
				desc = diplomatic_scheme_lifestyle.3101.desc_opening_bad
			}
			desc = diplomatic_scheme_lifestyle.3101.desc_opening_good
		}
	}
	theme = befriend_scheme
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:target
		triggered_animation = {
			trigger = {
				scope:target = {
					OR = {
						opinion = {
							target = root
							value <= 0
						}
						has_relation_potential_rival = root
						has_relation_rival = root
					}
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:target = {
					NOR = {
						opinion = {
							target = root
							value <= 0
						}
						has_relation_potential_rival = root
						has_relation_rival = root
					}
				}
			}
			animation = disapproval
		}
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_diplomatic_scheme_lifestyle_3101 }
		has_trait = schemer
		scope:scheme = {
			scheme_agent_charges >= 2
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_diplomatic_scheme_lifestyle_3101
			days = 3650
		}
		scope:target = {
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
	}

	option = { #I'll back off a bit
		name = diplomatic_scheme_lifestyle.3101.a
		custom_tooltip = diplomatic_scheme_lifestyle.3101.a.tt
		trait = schemer
		scope:scheme = {
			change_opportunities = -2
		}
		add_prestige = minor_prestige_gain
		scope:target = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 50
		}
	}

	option = {
		name = diplomatic_scheme_lifestyle.3101.b
		custom_tooltip = diplomatic_scheme_lifestyle.3101.b.tt
		scope:scheme = {
			add_scheme_modifier = {
				type = lifestyle_bugging_target_modifier
				days = 1825
			}
		}
		ai_chance = {
			base = 0
		}
	}
	
	option = { #End the scheme
		name = diplomatic_scheme_lifestyle.3101.c
		scope:scheme = {
			end_scheme = yes
		}
		ai_chance = {
			base = 0
		}
	}
}

#Sacrifice agent for scheme power
diplomatic_scheme_lifestyle.3201 = {
	type = character_event
	title = diplomatic_scheme_lifestyle.3201.t
	desc = diplomatic_scheme_lifestyle.3201.desc
	theme = befriend_scheme
	left_portrait = {
		character = root
		animation = disappointed
	}
	right_portrait = {
		character = scope:target
		animation = anger
	}
	lower_right_portrait = scope:sacrificial_agent
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_diplomatic_scheme_lifestyle_3201 }
		has_intrigue_lifestyle_trait_trigger = yes
		scope:scheme = { any_scheme_agent_character = { } }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = -0.5
			scope:target = { #less likely if the target is a "good" person
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = honest
					has_trait = humble
				}
			}
		}
		modifier = { #more likely if target dislikes an agent
			add = 1
			scope:scheme = {
				any_scheme_agent_character = {
					reverse_opinion = {
						target = scope:target
						value <= 0
					}
				}
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_diplomatic_scheme_lifestyle_3201
			days = 3650
		}
		scope:scheme = {
			random_scheme_agent_character = {
				limit = {
					is_scheming_against = { target = scope:target }
					NOT = { is_agent_exposed_in_scheme = scope:scheme }
					reverse_opinion = {
						target = scope:target
						value <= 0	
					}
				}
				alternative_limit = {
					is_scheming_against = { target = scope:target }
					NOT = { is_agent_exposed_in_scheme = scope:scheme }
				}
				save_scope_as = sacrificial_agent
				if = {
					limit = { root = { is_ai = no }	}
					assign_quirk_effect = yes
				}
			}
		}
	}

	option = { #kick the agent out
		name = diplomatic_scheme_lifestyle.3201.a
		scope:scheme = {
			add_scheme_modifier = {
				type = lifestyle_belittling_agent_modifier
				days = 1825
			}
		}
		scope:sacrificial_agent = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
			forbid_from_scheme = scope:scheme
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.25
				ai_rationality = 0.25
			}
		}
	}

	option = { #stand up for your agent
		name = diplomatic_scheme_lifestyle.3201.b
		scope:target = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = -10
			}
		}
		stress_impact = {
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
				ai_honor = 0.25
			}
		}
	}
}


##############################
# SCHOLARSHIP LIFESTYLE EVENTS
# 4001-4999
##############################
