namespace = fp3_h_yearly

###################################
# You have pissed off your ulema and you're a drunkard
# By Hugo Cortell
# Rewritten by Henrik Lohmander
###################################
fp3_h_yearly.0001 = {
	type = character_event
	title = fp3_h_yearly.0001.t
	desc = {
		triggered_desc = {
			trigger = { always = yes }
			desc = fp3_h_yearly.0001.desc.main
		}
	}
	theme = feast_activity
	override_background = { reference = throne_room }
	left_portrait = {
		character = root
		animation = drink_goblet
	}
	right_portrait = {
		character = scope:ulema_member
		animation = disapproval
	}

	cooldown = { years = 10 }

	weight_multiplier = {
		base = 1

		modifier = {
			exists = cp:councillor_court_chaplain
			cp:councillor_court_chaplain = { has_trait = drunkard }
			factor = 0.4
		}
		modifier = {
			any_character_struggle = {
				is_struggle_type = persian_struggle
			}
			add = 0.5
		}
		modifier = {
			has_trait = fp3_struggle_supporter
			add = -0.5
		}
		modifier = {
			has_trait = fp3_struggle_detractor
			add = 0.5
		}
	}

	trigger = {
		has_fp3_dlc_trigger = yes 
		has_trait = drunkard
		NOT = { has_character_modifier = ulema_displeased_drinking }
		exists = cp:councillor_court_chaplain
		NOT = {
			has_hook = cp:councillor_court_chaplain
		}
		cp:councillor_court_chaplain = {
			is_ai = yes
			faith = { trait_is_sin = drunkard }
			trigger_if = {
				limit = { exists = house }
				house != root.house
			}
			NOT = {
				has_trait = lifestyle_mystic
			}
			OR = {
				opinion = { # They will not do this unless they have reason to dislike you
					target = root
					value < -25
				}
				has_relation_rival = root
			}
		}
	}

	immediate = {
		cp:councillor_court_chaplain = { save_scope_as = ulema_member }
		save_scope_as = actor
		scope:ulema_member = { save_scope_as = recipient }
	}

	option = { #Deflection (They are a drunkard too) Look who is talking!
		name = fp3_h_yearly.0001.a
		trigger = { scope:ulema_member = { has_trait = drunkard } }

		#No duel, this deflection always succeeds.

		stress_impact = {
			craven = minor_stress_gain
			deceitful = minor_stress_loss
			callous = minor_stress_loss
		}
		add_prestige = medium_prestige_gain
		reverse_add_opinion = {
			target = scope:ulema_member
			modifier = ignored_concerns
		}
	}

	option = { #Deflection - Argue that drinking is healthy to the human spirit
		name = fp3_h_yearly.0001.b
		trigger = {
			OR = {
				has_trait = scholar
				has_trait = theologian
				has_trait = whole_of_body
				has_trait = lifestyle_physician
				has_trait = lifestyle_poet
				faith = { trait_is_virtue = drunkard }
			}
		}


		reverse_add_opinion = {
			target = scope:ulema_member
			modifier = ignored_concerns
		}

		duel = {
			desc = fp3_h_yearly.0001.b.desc
			skill = learning
			target = scope:annoying_clergy

			35 = { #Success
				desc = fp3_h_yearly.0001.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = fp3_h_yearly.0001.b.success
					left_icon = root
					add_prestige = minor_prestige_gain
				}
			}
			65 = {
				desc = fp3_h_yearly.0001.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = fp3_h_yearly.0001.b.failure
					left_icon = root
					add_piety = medium_piety_loss
					add_character_modifier = {
						modifier = ulema_displeased_drinking
						years = 10
					}
				}
			}
		}

		stress_impact = {
			honest = minor_stress_gain
			humble = minor_stress_gain
			callous = minor_stress_loss
			deceitful = minor_stress_loss
		}
	}

	option = { # You do not get to speak to me in this way!
		name = fp3_h_yearly.0001.e

		add_dread = medium_dread_gain
		imprison_court_chaplain_consequences_effect = yes
		imprison_character_effect = {
			TARGET = scope:recipient
			IMPRISONER = scope:actor
		}

		stress_impact = {
			just = medium_stress_gain
			zealous = medium_stress_gain
			deceitful = minor_stress_loss
			callous = minor_stress_loss
		}
	}

	option = { #Bribery - Offer a generous donation
		name = fp3_h_yearly.0001.c
		trigger = { NOT = { scope:ulema_member = { has_trait = drunkard } } } #If you can deflect we don't show this option
		custom_tooltip = fp3_h_yearly.0001.c.tt
		pay_short_term_gold = {
			target = scope:ulema_member
			gold = medium_gold_value
		}
		random_list = {
			75 = {
				modifier = {
					scope:ulema_member = {
						has_trait = greedy
					}
					factor = 2
				}
				modifier = {
					scope:ulema_member = {
						has_trait = deceitful
					}
					factor = 2
				}
				modifier = {
					scope:ulema_member = {
						has_trait = ambitious
					}
					factor = 2
				}
				desc = fp3_h_yearly.0001.c.success
				send_interface_toast = {
					title = fp3_h_yearly.0001.c.success
					left_icon = root
					add_prestige = minor_prestige_gain
				}
			}
			25 = {
				modifier = {
					scope:ulema_member = {
						has_trait = zealous
					}
					factor = 2
				}
				modifier = {
					scope:ulema_member = {
						has_trait = honest
					}
					factor = 2
				}
				modifier = {
					scope:ulema_member = {
						has_trait = just
					}
					factor = 2
				}
				desc = fp3_h_yearly.0001.c.failure
				send_interface_toast = {
					title = fp3_h_yearly.0001.c.failure
					left_icon = root
					add_piety = medium_piety_loss
					add_character_modifier = {
						modifier = ulema_displeased_drinking
						years = 10
					}
					reverse_add_opinion = {
						target = scope:ulema_member
						modifier = ignored_concerns
					}
				}
			}
		}


		stress_impact = {
			just = medium_stress_gain
			greedy = minor_stress_gain
			honest = minor_stress_gain
			callous = minor_stress_loss
			deceitful = minor_stress_loss
		}
	}

	option = { # There is nothing I can do!
		name = fp3_h_yearly.0001.d

		add_piety = minor_piety_loss
		add_character_modifier = {
			modifier = ulema_displeased_drinking
			years = 5
		}
		stress_impact = {
			arrogant = minor_stress_gain
			deceitful = minor_stress_gain
			drunkard = minor_stress_gain
			honest = minor_stress_loss
		}
	}

}
