decisions = {

# Barlaamite decisions
form_barlaamite_patriachy = { 
  is_high_prio = yes
  ai_check_interval = 36 # Determines how seldom the AI checks whether they can and should do the decision, in months. By default 1 (every month).
  potential = {
    religion = barlaamite
	is_adult = yes
	d_barlaamite = {
		has_holder = no
	}
  }
  
  allow = {
	primary_title = { higher_tier_than = COUNT }
	prisoner = no
	independent = yes
	prestige = 500
	piety = 100
	wealth = 120
	completely_controls = c_byzantion
  }
  effect = {
    narrative_event = { id = CIML.359 }
	wealth = -120
	hidden_tooltip = {
		create_random_priest = {
			random_traits = yes
			religion = ROOT
			female = no
			dynasty = none
		}
		new_character = {
			d_barlaamite = {
			grant_title = PREV
			}
			b_hagiasophia = {
				grant_title = PREV
			}
			wealth = 500
			opinion = {
				who = ROOT
				modifier = opinion_creator_of_rel_heal
			}
			set_defacto_liege = ROOT
		}
	}
	religion_authority = {
		modifier = patriarchy_instituted
		years = 15
	}
  }
}

hold_anti-palamite_synod = {
	only_independent = yes
	is_high_prio = yes
	ai_check_interval = 36
		
		potential = {
			is_playable = yes
			independent = yes
			d_barlaamite = {
				has_holder = yes
			}
			religion = barlaamite
			NOT = { trait = incapable }
			primary_title = { higher_tier_than = KING }
			NOT = { has_global_flag = barlaamite_synod }
		}
		allow = {
			piety = 200
			prestige = 500
			wealth = 150
			religion_authority = 0.5
			learning = 8
			diplomacy = 8
			completely_controls = c_byzantion
		}
		effect = {
			narrative_event = { id = CIML.367 }
			wealth = -150
			set_global_flag = barlaamite_synod
		}
		ai_will_do = {
			factor = 1
		}
}

# Orthodox decisions
destroy_barlaamite_patriachy = { 
  is_high_prio = yes
  ai_check_interval = 36 # Determines how seldom the AI checks whether they can and should do the decision, in months. By default 1 (every month).
  potential = {
    religion = orthodox
	is_adult = yes
	k_orthodox = {
		has_holder = yes
	}
	d_barlaamite = {
		has_holder = yes
	}
  }
  
  allow = {
	prisoner = no
	prestige = 100
	piety = 100
	wealth = 100
	independent = yes
	primary_title = { higher_tier_than = COUNT }
	completely_controls = c_byzantion
  }
	
  effect = {
    narrative_event = { id = CIML.363 }
	wealth = -100
	d_barlaamite = { destroy_landed_title = THIS }
	if = {
		limit = {
			completely_controls = c_byzantion
		}
		religion_head = {
			b_hagiasophia = {
				grant_title = PREV
			}
			opinion = {
				who = ROOT
				modifier = opinion_creator_of_rel_heal
			}
			set_defacto_liege = ROOT
		}
	}
	
	religion_authority = {
		modifier = patriarchy_instituted
		years = 2
	}
  }
}

hold_anti-barlaamite_synod = {
	only_independent = yes
	is_high_prio = yes
	ai_check_interval = 36
		
		potential = {
			is_playable = yes
			independent = yes
			religion = orthodox
			NOT = { trait = incapable }
			primary_title = { higher_tier_than = KING }
			has_global_flag = barlaamite_synod
		}
		allow = {
			piety = 160
			prestige = 340
			wealth = 150
			religion_authority = 0.5
			learning = 5
			diplomacy = 5
			completely_controls = c_byzantion
			d_barlaamite = {
				has_holder = no
			}
		}
		effect = {
			narrative_event = { id = CIML.370 }
			wealth = -150
			clr_global_flag = barlaamite_synod
		}
		ai_will_do = {
			factor = 1
		}
}

massacre_latins = {
	only_independent = yes
	is_high_prio = yes
	ai_check_interval = 48
		
		potential = {
			OR = {
				religion = orthodox
				religion = barlaamite
				religion = iconoclast
				religion = monothelite
				religion = paulician
				religion = bogomilist
			}
			NOR = { 
				culture_group = latin 
				culture_group = iberian
			}
			NOT = { trait = incapable }
			NOT = { has_global_flag = latins_killed_constantinople }
			NOT = { has_global_flag = fourth_crusade_launched }
			has_landed_title = e_byzantium
			has_global_flag = first_crusade_complete
			OR = { 
				trait = cruel
				trait = lunatic
				trait = possessed
				trait = impaler
			}
			completely_controls = c_byzantion
			c_byzantion = { has_trade_post = yes }
			OR = { 
				496 = { religion = orthodox }
				496 = { religion = barlaamite }
				496 = { religion = iconoclast }
				496 = { religion = monothelite }
				496 = { religion = paulician }
				496 = { religion = bogomilist }
			}
			NOR = { 
				496 = { culture_group = latin }	
				496 = { culture_group = iberian }	
			}
		}
		allow = {
			prisoner = no
			NOR = {
				trait = kind
			}
		}
		effect = {
			narrative_event = { id = CIML.373 }
			wealth = 1800
			set_global_flag = latins_killed_constantinople
			c_byzantion = { destroy_tradepost = THIS }
			add_character_modifier = { 
				name = massacred_latins
				months = -1 
			}
			any_courtier = {
				limit = { religion = catholic }
				death = { death_reason = death_execution killer = ROOT }
			}
			if = {
				limit = { 
					NOT = {
						has_character_modifier = known_murderer
					}
				}
				add_character_modifier = { 
					name = known_murderer
					months = 120 
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
}

}