namespace = fp3_decision

##################################################
# #Zoroastrian Decision Events

##################################################

fp3_decision.0001 = {
	type = character_event
	title = fp3_decision.0001.t 
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_faith = faith:mazdakism
				}
				desc = fp3_decision.0001.desc_mazdakist
			}
			triggered_desc = {
				trigger = {
					has_faith = faith:khurramism
				}
				desc = fp3_decision.0001.desc_khurramite 
			}
			desc = fp3_decision.0001.desc_general_zoroastrian 
		}
		desc = fp3_decision.0001_desc_ending 
	}
		


	theme = crown
	override_background = { reference = throne_room_east }

	left_portrait = {
		character = root
		animation = personality_bold 
	}

	option = { #If you're of the Mazdakite or Behafarid inclination, you might rather want to destroy the fires 
		name = fp3_decision.0001.a	
		flavor = fp3_decision.0001.a.tt

		trigger = { 
			OR = {
				has_faith = faith:mazdakism 
				has_faith = faith:zurvanism #Behafaridism
				faith = {
					OR = { 
						has_doctrine_parameter = vows_of_poverty_active
						has_doctrine = tenet_gnosticism
					}
				}
			}
		}

		add_piety = major_piety_gain 

		custom_tooltip = fp3_decision.0001_pledged_to_quench_fire
		hidden_effect = {
			add_character_flag = {
				flag = pledged_to_quench_fire 
				days = 7300
			}
		}

		stress_impact = { 
			zealous = major_stress_loss 
			ambitious = minor_stress_loss 
		}

		ai_chance = { #ambitious, vengeful Mazdaki AIs pick this option
        	base = 10
        	ai_value_modifier = {
            	ai_rationality = 0.5
            	ai_energy = 1
            	ai_vengefulness = 1
            	ai_zeal = 1
        	}
   		}  	
	}

	option = { #Kindle the fire (elaborate ceremony)
		name = fp3_decision.0001.b	

		add_piety = massive_piety_loss

		dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value }

		add_character_modifier = {
			modifier = fp3_royal_fire_modifier 
		}

		custom_tooltip = fp3_decision.0001_vassal_and_courtier_opinion_impressed 
		hidden_effect = {
			every_vassal = {
				IF = { 
					limit = {
						NOT = {
							has_religion = religion:zoroastrianism_religion 
						}
						OR = {
							faith = { has_doctrine = doctrine_pluralism_fundamentalist }
							faith = {	has_doctrine = doctrine_pluralism_righteous }	
						}	
					}
					add_opinion = {
						target = root
						opinion = -20
						modifier = fp3_strange_rituals_opinion 
					}				
				}
				ELSE = {
					add_opinion = {
						target = root
						opinion = 15
						modifier = fp3_magnificent_fire_ritual_opinion
					}
				}	
			}
			every_courtier = {
				IF = { 
					limit = {
						NOT = {
							has_religion = religion:zoroastrianism_religion 
						}
						OR = {
							faith = { has_doctrine = doctrine_pluralism_fundamentalist }
							faith = {	has_doctrine = doctrine_pluralism_righteous }	
						}	
					}
					add_opinion = {
						target = root
						opinion = -20
						modifier = fp3_strange_rituals_opinion 
					}				
				}
				ELSE = {
					add_opinion = {
						target = root
						opinion = 15
						modifier = fp3_magnificent_fire_ritual_opinion
					}
				}		
			}
		}

        ai_chance = { #ambitious and zealous AIs pick this option
        	base = 10
        	ai_value_modifier = {
            	ai_energy = 0.5
            	ai_zeal = 1
        	}
   		}  	

   		stress_impact = { #Ambitious rulers of course like this, but paranoid ones are worried about offending people. 
			ambitious = medium_stress_impact_loss
			arrogant = medium_stress_impact_loss
			zealous = medium_stress_impact_loss 
			gregarious = medium_stress_impact_loss
			august = medium_stress_impact_loss 
			gallant = medium_stress_impact_loss
			content = miniscule_stress_impact_gain
			cynical = minor_stress_impact_gain	
			temperate = miniscule_stress_impact_gain
			paranoid = minor_stress_impact_gain	
		}
	}

	option = { #Kindle the fire (less elaborate ceremony) 
		name = fp3_decision.0001.c


		add_piety = major_piety_loss

		add_character_modifier = {
			modifier = fp3_royal_fire_modifier 
		}

		custom_tooltip = fp3_decision.0001_vassal_and_courtier_opinion 
		hidden_effect = {
			every_vassal = {
				IF = { 
					limit = {
						NOT = {
							has_religion = religion:zoroastrianism_religion 
						}
						OR = {
							faith = { has_doctrine = doctrine_pluralism_fundamentalist }
							faith = {	has_doctrine = doctrine_pluralism_righteous }	
						}	
					}
					add_opinion = {
						target = root
						opinion = -20
						modifier = fp3_strange_rituals_opinion 
					}				
				}
				ELSE = {
					add_opinion = {
						target = root
						opinion = 10
						modifier = fp3_blessed_by_fire_opinion
					}
				}	
			}
			every_courtier = {
				IF = { 
					limit = {
						NOT = {
							has_religion = religion:zoroastrianism_religion 
						}
						OR = {
							faith = { has_doctrine = doctrine_pluralism_fundamentalist }
							faith = {	has_doctrine = doctrine_pluralism_righteous }	
						}	
					}
					add_opinion = {
						target = root
						opinion = -20
						modifier = fp3_strange_rituals_opinion 
					}				
				}
				ELSE = {
					add_opinion = {
						target = root
						opinion = 10
						modifier = fp3_blessed_by_fire_opinion
					}
				}		
			}
		}

		ai_chance = { #more cautious AIs pick this option
        	base = 10
        	ai_value_modifier = {
            	ai_rationality = 0.5
            	ai_greed = 1
        	}
   		}  	

   		stress_impact = { #Wasteful or ambitious rulers loathe this more moderate option, but temperate and content rulers love it. 
			ambitious = minor_stress_impact_gain
			zealous = miniscule_stress_impact_gain
			august = minor_stress_impact_gain
			gallant = miniscule_stress_impact_gain 
			paranoid = minor_stress_impact_gain
			content = medium_stress_impact_loss
			temperate = medium_stress_impact_loss	
		}
	}

	option = { #Skip it for now
		name = fp3_decision.0001.d

		ai_chance = { #the AI generally shouldn't pick this, as it's the opting-out-option
        	base = 1 	
   		}  	
	}	
}

fp3_decision.0002 = {
	type = character_event
	title = fp3_decision.0002.t 
	desc = fp3_decision.0002.desc
	
	theme = death
	left_portrait = {
		character = scope:occupant
		animation = celebrate_sword
	}
	right_portrait = {
		character = ROOT
		animation = shock
	}
	override_background = { reference = battlefield }

	trigger = {

		is_ai = no 
		has_character_modifier = fp3_royal_fire_modifier 
	}

	cooldown = { years = 30 }

	immediate = {

		remove_character_modifier = fp3_royal_fire_modifier 

		hidden_effect = {
			add_character_flag = {
				flag = fire_recently_quenched
				days = 1825
			}
		}

		if = {
			limit = {
				OR = {
					has_trait = ambitious
					has_trait = august
					has_trait = craven
					has_trait = gallant 
					has_trait = zealous
					has_trait = arrogant
					has_trait = paranoid 
					has_trait = lunatic 
				}
			}
			add_stress = major_stress_impact_gain
		}
		else = { add_stress = medium_stress_impact_gain	}


		custom_tooltip = fp3_decision.0002_fire_destroyed_tt
		hidden_effect = { #Now they like you less because your royal fire got quenched 
			every_vassal = {
				if = { 
					limit = {
						NOR = { #but these personalities stand by you no matter what, or are less superstitious 
							has_trait = cynical
							has_trait = trusting 
							has_trait = forgiving
							has_trait = brave
						}
					}
					add_opinion = {
						target = root
						opinion = -20
						modifier = fp3_bad_portent_opinion 
					}				
				}
			}
			every_courtier = { #but these personalities stand by you no matter what, or are less superstitious 
				if = { 
					limit = {
						NOR = {
							has_trait = brave 
							has_trait = cynical
							has_trait = trusting 
							has_trait = forgiving
						}
					}
					add_opinion = {
						target = root
						opinion = -20
						modifier = fp3_bad_portent_opinion 
					}				
				}
			}		
		}
	}

	option = { #It matters not, it was merely a symbol 
		name = fp3_decision.0002.a

		trigger = {
			OR = {
				has_trait = calm
				has_trait = content 
				has_trait = cynical
				has_trait = diplomat
				has_trait = temperate 
				has_trait = saoshyant 
			}
		}

		add_piety = minor_piety_loss

		add_stress = medium_stress_impact_loss 
	}

	option = { #This atrocity must be avenged! 
		name = fp3_decision.0002.b
		trigger = {
			scope:occupant = {
				NOR = {	
					has_relation_rival = root 
					has_relation_nemesis = root
				}
			}
		}

		set_relation_nemesis = scope:occupant 
	}

	option = { #What am I to do now? 
		name = fp3_decision.0002.c	
	}
}


fp3_decision.0003 = { #This is triggered from the restore_badd_fortress_decision, and is used to apply its effects. The options gives you a nickname. 
	type = character_event
	title = fp3_decision.0003.t 
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { current_date <= 900.1.1 } #The fortress was destroyed only recently 
				desc = fp3_decision.0003.desc_recently
			}
			triggered_desc = {
				trigger = { current_date <= 1000.1.1 } #The fortress was destroyed a while ago
				desc = fp3_decision.0001.desc_less_recently
			}
			triggered_desc = {
				trigger = { current_date > 1000.1.1 } #The fortress was destroyed long ago 
				desc = fp3_decision.0001.desc_long_ago 
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { 
					OR = {
						has_faith = faith:khurramism
						has_faith = faith:urartuism 
					}
				}
				desc = fp3_decision.0003.desc_khurramite
			}
			triggered_desc = {
				trigger = { 
					faith = { has_doctrine = doctrine_heretic_branch_zandik }
				}
				desc = fp3_decision.0003.desc_zandik 
			}
			desc = fp3_decision.0003.desc_fallback 
		}
		desc = fp3_decision.0003.desc_ending 
	}
		

	theme = realm
	override_background = { reference = wilderness_mountains  }

	left_portrait = {
		character = root
		animation = personality_bold 
	}

	immediate = {
		play_music_cue = "mx_cue_war_declared"
		# Apply effects
		restore_badd_fortress_scripted_effect = yes
	}

	option = { #I could recuperate some costs 
		name = fp3_decision.0003.a	

		trigger = { 
			has_trait = architect 
		}

		add_gold = 100 

		# Add a unique nickname.
		give_nickname = nick_the_fortress_builder 

		stress_impact = { 
			ambitious = minor_stress_loss 
			diligent = minor_stress_loss 
			greedy = minor_stress_loss 
		}

		ai_chance = {
			# AI should always choose this option, if it can.
			base = 100
		}
	}

	option = { #What a redoubt it shall be! 
		name = fp3_decision.0003.b

		# Add a unique nickname.
		give_nickname = nick_the_eagle_of_arasbaran 

		# No stress impact necessary.
		ai_chance = {
			# AI should always choose this option, if it can.
			base = 100
		}
	}

	option = { #I need no glory, just my fortress secure 
		name = fp3_decision.0003.c

		# Minor stress loss for turning down the nickname.
		add_stress = minor_stress_loss

		# No stress impact necessary.
		ai_chance = {
			# AI should, if it somehow makes it here, never opt out of the nickname.
			base = 0
		}
	}
}

fp3_decision.0004 = { #This is triggered from the destroy_the_magi_decision, and is used to apply its effects. The options gives you a nickname. 

	type = character_event

	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_faith = faith:mazdakism
						has_faith = faith:zurvanism 
					}
				}
				desc = fp3_decision.0004_alternate.t 
			}
			desc = fp3_decision.0004.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_faith = faith:mazdakism
						has_faith = faith:zurvanism 
					}
				}
				desc = fp3_decision.0004_alternate_desc
			}
			desc = fp3_decision.0004_desc
		}
	}

	theme = faith
	override_background = { reference = temple  } 

	left_portrait = {
		character = root
		animation = schadenfreude 
	}

	immediate = {
		play_music_cue = "mx_cue_faith_conversion"
		# Apply effects
		destroy_the_magi_scripted_effect = yes
	}

	#since the AI can't take this decision, AI chance is not needed here. 

	option = { #Muwahaha
		name = fp3_decision.0004.a	

		trigger = { 
			OR = {
				has_trait = vengeful
				has_trait = arrogant
			}
		} 

		give_nickname = nick_the_reformer

		stress_impact = { 
			ambitious = minor_stress_loss 
			arrogant = minor_stress_loss 
			vengeful = minor_stress_loss 
			sadistic = minor_stress_loss 
		}
	}

	option = { #And may the embers turn to cold ash!  
		name = fp3_decision.0004.b

		trigger = {
			OR = {
				has_faith = faith:mazdakism
				has_faith = faith:zurvanism 
			}
		}

		give_nickname = nick_the_fire_quencher
	}

	option = { #The people can handle this now
		name = fp3_decision.0004.c

		trigger = {
			NOR = {
				has_faith = faith:mazdakism
				has_faith = faith:zurvanism 
			}
		}

		give_nickname = nick_the_firekeeper
	}

	option = { #It is done! 
		name = fp3_decision.0004.d

		give_nickname = nick_the_heretic 
	}		
}

##################################################
# #Islamic Decision Events
# 0011-0012 - Avenge the Battle of Nahrawan 
##################################################

fp3_decision.0011 = { 
	type = character_event
	title = fp3_decision.0011.t
	desc = {
		desc = fp3_decision.0011_opening.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					faith = {
						OR = {
							has_doctrine = tenet_fp3_fedayeen
							has_doctrine = tenet_warmonger 
							has_doctrine_parameter = pluralism_fundamentalist_proselytization_bonus
						}
					}
				}
				desc = fp3_decision.0011_fanatic_murderer.desc
			}
			desc = fp3_decision.0011_unfanatic_unmurderer.desc
		}
	}


	theme = war
	left_portrait = {
		character = scope:avenger
		animation = war_over_win
	}

	override_background = { reference = battlefield }

	immediate = {
		play_music_cue = "mx_cue_combat_2"

		character:33911 = { save_scope_as = ali }
		character:163029 = { save_scope_as = muawiya }
	}

	option = {
		name = fp3_decision.0011.a	

		avenge_the_battle_of_nahrawan_scripted_effect = yes	

		stress_impact = {  
			zealous = major_stress_impact_loss
			vengeful = major_stress_impact_loss
			ambitious = medium_stress_impact_loss
		}
	}
}

fp3_decision.0012 = { 
	type = character_event
	title = fp3_decision.0012.t
	desc = fp3_decision.0012.desc
	theme = war
	left_portrait = {
		character = scope:avenger
		animation = personality_vengeful
	}

	override_background = { reference = battlefield }

	immediate = {
		play_music_cue = "mx_cue_combat_3"
		show_as_tooltip = {
			scope:avenger = {
				faith = {
					change_fervor = {
						value = major_fervor_gain
						desc = fervor_gain_avenged_battle_of_nahrawan
					}
				}
			}
			if = {
				limit = { exists = scope:sunni_faith }
				scope:sunni_faith = {
					change_fervor = {
						value = major_fervor_loss
						desc = fervor_loss_avenged_battle_of_nahrawan
					}
				}
			}
			if = {
				limit = { exists = scope:shia_faith }
				scope:shia_faith = {
					change_fervor = {
						value = major_fervor_loss
						desc = fervor_loss_avenged_battle_of_nahrawan
					}
				}
			}
		}
	}

	option = {
		name = fp3_decision.0012.a	
	}

	option = {
		name = fp3_decision.0012.b	

	}
}

fp3_decision.0013 = {
	type = character_event
	title = fp3_decision.0013.t
	desc = fp3_decision.0013.desc
	theme = faith
	override_background = { reference = throne_room }
	
	left_portrait = {
		character = root
		animation = dismissal
	}

	right_portrait = {
		character = scope:hof_emissary
		animation = chancellor
	}
	
	lower_left_portrait = { character = scope:righteous_caliph }


	immediate = {

		root.faith.religious_head = { save_scope_as = righteous_caliph }
		
		create_character = { #this is the head of faith's emissary 
			age = { 25 75 } 
			location = root.capital_province
			faith = root.faith.religious_head.faith
			gender_female_chance = root_faith_dominant_gender_female_chance #could be female, if given the right context.  
			trait = diplomat  
			template = priest_character_template
			save_scope_as = hof_emissary 	#this saves him as a scope so we can get nice effects to bounce off him! 
		}
	}

	option = {
		name = fp3_decision.0013.a	

		promote_persian_scripture_scripted_effect = yes

		if = {
			limit = {
				scope:righteous_caliph = {
					NOR = {
						has_relation_rival = root
						has_relation_nemesis = root
					}
				} 
			}
			scope:righteous_caliph = {
				progress_towards_rival_effect = {
					REASON = rival_promoting_blasphemous_translations
					CHARACTER = root
					OPINION = -30
				}
			}
		}

		stress_impact = {  
			zealous = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			craven = medium_stress_impact_gain
			trusting = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = { #most AI prefer this option, once the decision is taken
        	base = 100
        	ai_value_modifier = {
           		ai_boldness = 1 
           		ai_zeal = 1
           		ai_energy = 0.5
           		ai_vengefulness = 1
           		ai_rationality = 0.5
        	}
   		} 	
	}

	option = {
		name = fp3_decision.0013.b	

		add_gold = 400 
		add_piety = var:promote_persian_scripture_piety_refund

		custom_tooltip = promote_persian_scripture_cannot_take_decision.tt

		set_variable = { 
			name = pledged_to_not_promote_persian 
			years = 30
		}

		remove_list_global_variable = {
  			name = unavailable_unique_decisions
  			target = flag:promote_persian_scripture_decision
  		}

		stress_impact = {  
			trusting = medium_stress_impact_loss
			craven = medium_stress_impact_loss
			arrogant = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}

		ai_chance = { #but cautious AI might cave in
        	base = 100
        	ai_value_modifier = {
           		ai_boldness = -1
           		ai_honor = 0.5
        	}
   		} 
	}

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

fp3_decision.0014 = {
	type = character_event
	title = fp3_decision.0014.t
	desc = {
		desc = fp3_decision.0014_opening.desc
		first_valid = {
			triggered_desc = {
				trigger = { 
					exists = root.faith.religious_head 
					this != root.faith.religious_head
				}
				desc = fp3_decision.0014_there_is_caliph.desc
			}
			desc = fp3_decision.0014_no_caliph.desc
		}
	}
	theme = faith
	override_background = { reference = throne_room }
	
	left_portrait = {
		character = root
		animation = personality_rational
	}

	right_portrait = {
		character = scope:persian_genius_ulama
		animation = chancellor
	}

	immediate = {

		if = {
			limit = { exists = root.faith.religious_head }
			root.faith.religious_head = { save_scope_as = uncaring_caliph }
		}

		create_character = { 
			age = { 40 75 } 
			location = root.capital_province
			faith = root.faith
			gender_female_chance = root_faith_dominant_gender_female_chance #could be female, if given the right context.  
			trait = shrewd
			trait = theologian 
			trait = diligent
			template = priest_character_template
			save_scope_as = persian_genius_ulama 	#this saves him as a scope so we can get nice effects to bounce off him! 
		}
	}

	option = {
		name = fp3_decision.0014.a	

		promote_persian_scripture_scripted_effect = yes

		scope:persian_genius_ulama = { move_to_pool = yes }

		ai_chance = { #most AI prefer this option, once the decision is taken
        	base = 100
        	ai_value_modifier = {
           		ai_boldness = 1 
           		ai_zeal = 1
           		ai_energy = 0.5
           		ai_vengefulness = 1
           		ai_rationality = 0.5
        	}
   		} 	
	}

	option = {
		name = fp3_decision.0014.b	

		promote_persian_scripture_scripted_effect = yes

		pay_short_term_gold = {
			gold = minor_gold_value 
			target = scope:persian_genius_ulama
		}

		add_courtier = scope:persian_genius_ulama

		ai_chance = { #but cautious AI might cave in
        	base = 100
        	ai_value_modifier = {
           		ai_boldness = -1
           		ai_honor = 0.5
        	}
   		} 
	}
}

##################################################
# #Islamic Decision Events
# 0015-0016 - Friday Prayer Politics
# by Ewan Cowhig Croft
##################################################

scripted_effect fp3_decision_0015_apply_rebellious_stress_effect = {
	stress_impact = {
		arrogant = miniscule_stress_impact_loss
		ambitious = minor_stress_impact_loss
		disloyal = minor_stress_impact_loss
		humble = minor_stress_impact_gain
		content = medium_stress_impact_gain
		loyal = major_stress_impact_gain
	}
}

scripted_effect fp3_decision_0015_apply_seditious_intent_effect = {
	add_prestige = major_prestige_gain
	save_scope_as = prestige_gained
	reverse_add_opinion = {
		target = liege
		modifier = fp3_plotting_rebellion_opinion
		opinion = -30
	}
	# Notify the liege.
	hidden_effect = {
		liege = {
			send_interface_toast = {
				title = fp3_decision.0015.vassal_semi_rebel
				left_icon = root
				reverse_add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -30
				}
			}
		}
	}
}

# Your name is read in the Friday Prayer
fp3_decision.0015 = {
	type = character_event
	title = fp3_decision.0015.t
	desc = {
		# Who are we switching to?
		first_valid = {
			# Supporter: switching to detractor.
			triggered_desc = {
				trigger = { has_trait = fp3_struggle_detractor }
				desc = fp3_decision.0015.desc.switch.supporter_becoming_detractor
			}
			# Detractor: switching to supporter.
			triggered_desc = {
				trigger = { has_trait = fp3_struggle_supporter }
				desc = fp3_decision.0015.desc.switch.detractor_becoming_supporter
			}
			# Neutral: switching to either.
			desc = fp3_decision.0015.desc.switch.presently_neutral
		}
		# Do we have a liege to consider?
		first_valid = {
			# Yes, and we're making our alignment choice in the event.
			triggered_desc = {
				trigger = {
					NOR = {
						has_trait = fp3_struggle_supporter
						has_trait = fp3_struggle_detractor
					}
					liege ?= {
						this != root
						OR = {
							has_trait = fp3_struggle_supporter
							has_trait = fp3_struggle_detractor
						}
					}
				}
				desc = fp3_decision.0015.desc.liege.presently_neutral
			}
			# Yes, and we'll be aligning with them.
			triggered_desc = {
				trigger = {
					NOT = { liege ?= { this = root } }
					OR = {
						AND = {
							has_trait = fp3_struggle_supporter
							liege ?= { has_trait = fp3_struggle_supporter }
						}
						AND = {
							has_trait = fp3_struggle_detractor
							liege ?= { has_trait = fp3_struggle_detractor }
						}
					}
				}
				desc = fp3_decision.0015.desc.liege.aligning
			}
			# Yes, and we'll be contradicting them.
			triggered_desc = {
				trigger = {
					NOT = { liege ?= { this = root } }
					OR = {
						AND = {
							has_trait = fp3_struggle_supporter
							liege ?= { has_trait = fp3_struggle_detractor }
						}
						AND = {
							has_trait = fp3_struggle_detractor
							liege ?= { has_trait = fp3_struggle_supporter }
						}
					}
				}
				desc = fp3_decision.0015.desc.liege.contradicting
			}
			# Yes, and they don't much care.
			triggered_desc = {
				trigger = {
					liege ?= {
						NOR = {
							this = root
							has_trait = fp3_struggle_supporter
							has_trait = fp3_struggle_detractor
						}
					}
				}
			}
			# Else no, and we need no loc.
		}
	}
	theme = faith
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:right_portrait
		triggered_animation = {
			trigger = {
				OR = {
					AND = {
						has_trait = fp3_struggle_supporter
						scope:right_portrait = { has_trait = fp3_struggle_supporter }
					}
					AND = {
						has_trait = fp3_struggle_detractor
						scope:right_portrait = { has_trait = fp3_struggle_detractor }
					}
				}
			}
			animation = admiration
		}
		triggered_animation = {
			trigger = {
				OR = {
					AND = {
						has_trait = fp3_struggle_supporter
						scope:right_portrait = { has_trait = fp3_struggle_detractor}
					}
					AND = {
						has_trait = fp3_struggle_detractor
						scope:right_portrait = { has_trait = fp3_struggle_supporter }
					}
				}
			}
			animation = anger
		}
	}
	lower_center_portrait = { character = scope:lower_centre_portrait }


	immediate = {
		# Work out who goes in the righthand portrait slot.
		## Do we have a suitable liege?
		if = {
			limit = {
				top_liege != this
				liege = {
					OR = {
						has_trait = fp3_struggle_supporter
						has_trait = fp3_struggle_detractor
					}
					NOT = { has_title = title:d_sunni }
				}
			}
			liege = { save_scope_as = right_portrait }
			# In which case, we try to put the caliph in the bottom slot.
			title:d_sunni.holder = {
				if = {
					limit = {
						this != root.liege
					}
					save_scope_as = lower_centre_portrait
				}
			}
		}
		## If we don't, it's the caliph.
		else = {
			title:d_sunni.holder = { save_scope_as = right_portrait }
			# If we still have a liege, we put them in the bottom slot as they're mentioned in the copy — even though it's for not much caring.
			if = {
				limit = { top_liege != this }
				liege = { save_scope_as = lower_centre_portrait }
			}
		}
		## If we're flipflopping, apply base logic.
		if = {
			limit = {
				OR = {
					has_trait = fp3_struggle_supporter
					has_trait = fp3_struggle_detractor
				}
			}
			read_name_in_friday_prayer_scripted_effect = yes
			# For ease of reference, we save a scope to avoid rechecking this constantly.
			save_scope_value_as = {
				name = change_type
				value = flag:flipflop
			}
		}
		## If we're neutral, we only flag that — we'll make our actual choice in the options.
		else = {
			save_scope_value_as = {
				name = change_type
				value = flag:neutral
			}
		}
	}

	# Neutral: become a supporter, irritate liege.
	option = {
		name = fp3_decision.0015.a
		flavor = fp3_decision.0015.a.tt
		trigger = {
			scope:change_type = flag:neutral
			liege ?= {
				NOR = {
					this = prev
					this = title:d_sunni.holder
				}
			}
		}

		# Switch traits.
		read_name_in_friday_prayer_guts_become_supporter_effect = yes
		# Annoy your liege.
		fp3_decision_0015_apply_seditious_intent_effect = yes
		# Apply the remainder effects.
		read_name_in_friday_prayer_guts_apply_sundry_changes_effect = yes
		read_name_in_friday_prayer_guts_apply_house_unity_changes_effect = yes

		fp3_decision_0015_apply_rebellious_stress_effect = yes
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -0.25
			}
			opinion_modifier = {
				opinion_target = liege
				multiplier = -1
			}
		}
	}

	# Neutral: become a supporter, ignore liege.
	option = {
		name = fp3_decision.0015.b
		trigger = { scope:change_type = flag:neutral }

		# Switch traits.
		read_name_in_friday_prayer_guts_become_supporter_effect = yes
		# Apply the remainder effects.
		read_name_in_friday_prayer_guts_apply_sundry_changes_effect = yes
		read_name_in_friday_prayer_guts_apply_house_unity_changes_effect = yes

		# No extra stress on ignore.
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_honor = 0.5
				ai_boldness = -0.25
			}
			opinion_modifier = {
				opinion_target = liege
				multiplier = 1
			}
		}
	}

	# Neutral: become a detractor, irritate liege.
	option = {
		name = fp3_decision.0015.c
		flavor = fp3_decision.0015.c.tt
		trigger = {
			scope:change_type = flag:neutral
			liege ?= {
				NOR = {
					this = prev
					this = title:d_sunni.holder
				}
			}
		}

		# Switch traits.
		read_name_in_friday_prayer_guts_become_detractor_effect = yes
		# Annoy your liege.
		fp3_decision_0015_apply_seditious_intent_effect = yes
		# Apply the remainder effects.
		read_name_in_friday_prayer_guts_apply_sundry_changes_effect = yes
		read_name_in_friday_prayer_guts_apply_house_unity_changes_effect = yes

		fp3_decision_0015_apply_rebellious_stress_effect = yes
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -0.25
			}
			opinion_modifier = {
				opinion_target = liege
				multiplier = -1
			}
		}
	}

	# Neutral: become a detractor, ignore liege.
	option = {
		name = fp3_decision.0015.d
		trigger = { scope:change_type = flag:neutral }

		# Switch traits.
		read_name_in_friday_prayer_guts_become_detractor_effect = yes
		# Apply the remainder effects.
		read_name_in_friday_prayer_guts_apply_sundry_changes_effect = yes
		read_name_in_friday_prayer_guts_apply_house_unity_changes_effect = yes

		# No extra stress on ignore.
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_honor = 0.5
				ai_boldness = -0.25
			}
			opinion_modifier = {
				opinion_target = liege
				multiplier = 1
			}
		}
	}

	# Flipflopped + irritate liege.
	option = {
		name = fp3_decision.0015.e
		flavor = fp3_decision.0015.e.tt
		trigger = {
			scope:change_type = flag:flipflop
			liege ?= {
				NOR = {
					this = prev
					this = title:d_sunni.holder
				}
			}
		}

		# Annoy your liege.
		fp3_decision_0015_apply_seditious_intent_effect = yes

		fp3_decision_0015_apply_rebellious_stress_effect = yes
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -0.25
			}
			opinion_modifier = {
				opinion_target = liege
				multiplier = -1
			}
		}
	}

	# Flipflopped + ignore liege.
	option = {
		name = fp3_decision.0015.f
		trigger = { scope:change_type = flag:flipflop }

		# No further effects.

		# No extra stress on ignore.
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_honor = 0.5
				ai_boldness = -0.25
			}
			opinion_modifier = {
				opinion_target = liege
				multiplier = 1
			}
		}
	}

	after = {
		# Plus this can be a catalyst.
		hidden_effect = {
			if = {
				limit = {
					is_important_or_vip_struggle_character = yes
					OR = {
						AND = {
							any_character_struggle = { phase_has_catalyst = catalyst_became_supporter_fp3 }
							has_trait = fp3_struggle_supporter
						}
						AND = {
							any_character_struggle = { phase_has_catalyst = catalyst_became_detractor_fp3 }
							has_trait = fp3_struggle_detractor
						}
					}
				}
				## Is the character now a supporter? Move towards stabilisation.
				if = {
					limit = { has_trait = fp3_struggle_supporter }
					every_character_struggle = {
						activate_struggle_catalyst = {
							catalyst = catalyst_became_supporter_fp3
							character = root
						}
						log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_became_supporter_fp3 }
					}
				}
				## Is the character now a detractor? Move towards unrest.
				if = {
					limit = { has_trait = fp3_struggle_detractor }
					every_character_struggle = {
						activate_struggle_catalyst = {
							catalyst = catalyst_became_detractor_fp3
							character = root
						}
						log_debug_variable_for_persian_struggle_effect = { VAR = unrest_catalyst_became_detractor_fp3 }
					}
				}
			}
		}
	}
}
