﻿country_decisions = {
	
	convert_to_christian = {
		potential = {
			current_date > 854.1.1
			is_ai = no
			has_global_variable = christianity_expands
			num_of_cities >= 1
			potential_change_religion_trigger = {
				RELIGION = christianity
			}
		}

		allow = {
			could_change_religion_xian_trigger = {
				RELIGION = christianity
			}
		}
		
		effect = {
			change_religion_effect = {
				RELIGION = christianity
			}
		}
		
		ai_will_do = {
			factor = 0
		}
	}

	ai_convert_to_christian = {
		potential = {
			is_ai = yes
			current_date > 953.12.31
			has_global_variable = christianity_expands
			num_of_cities >= 1
			potential_change_religion_trigger = {
				RELIGION = christianity
			}
		}

		allow = {
			could_change_religion_trigger = {
				RELIGION = christianity
			}
		}
		
		effect = {
			change_religion_effect = {
				RELIGION = christianity
			}
			if = {
				limit = {
					OR = {
						tag = ROM
						AND = {
							capital_scope = {
								is_in_area = roma_area
							}
							heritage = roman_heritage
							primary_culture = roman
						}
					}	
				}
				add_deity_to_pantheon = { deity = deity:omen_st_peter }
			}
			else_if = {
				limit = {
					OR = {
						tag = EGY
						AND = {
							primary_culture = macedonian
							capital_scope = {
								is_in_region = lower_egypt_region
							}
							heritage = ptolemys_heritage
						}
					}	
				}
				add_deity_to_pantheon = { deity = deity:omen_st_mark }
			}
			else_if = {
				limit = {
					OR = {
						tag = TRE
						AND = {
							primary_culture = macedonian
							capital_scope = {
								is_in_region = thrace_region
							}
							heritage = thrace_heritage
						}
					}	
				}
				add_deity_to_pantheon = { deity = deity:omen_st_andrew }
			}
			else_if = {
				limit = {
					OR = {
						tag = MAC
						AND = {
							primary_culture = macedonian
							capital_scope = {
								is_in_region = macedonia_region
							}
							heritage = cassanders_heritage
						}
					}	
				}
				add_deity_to_pantheon = { deity = deity:omen_st_john }
			}
			else_if = {
				limit = {
					OR = {
						tag = PRY
						AND = {
							primary_culture = macedonian
							heritage = antigonid_heritage
						}
					}	
				}
				add_deity_to_pantheon = { deity = deity:omen_st_paul }
			}
			else_if = {
				limit = {
					OR = {
						tag = SEL
						AND = {
							primary_culture = macedonian
							heritage = seleucus_heritage
						}
					}	
				}
				add_deity_to_pantheon = { deity = deity:omen_st_luke_evangelist }
			}
			else_if = {
				limit = {
					OR = {
						tag = ARM
						AND = {
							capital_scope = {
								is_in_region = armenia_region
							}
							heritage = armenian_heritage
							primary_culture = armenian
						}
					}
				}
				add_deity_to_pantheon = { deity = deity:omen_st_nathanael_bartholomew }
			}
		}
		
		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				capital_scope = {
					dominant_province_religion = christianity
				}
			}
			modifier = {
				add = 100
				current_date > 1054.1.1
			}
			modifier = { 
				factor = 1000
				OR = {
					is_pentarchy_imperium_ai_trigger = yes
					tag = ARM
					AND = {
						capital_scope = {
							is_in_region = armenia_region
						}
						heritage = armenian_heritage
						primary_culture = armenian
					}
					tag = ROM
					AND = {
						capital_scope = {
							is_in_area = roma_area
						}
						heritage = roman_heritage
						primary_culture = roman
					}
					is_diadochi_descendant_ai_trigger = yes
					AND = {
						NOT = { country_culture_group = hellenic }
						religion = roman_pantheon
					}
					tag = ERE
					tag = WRE
				}	
				current_date >= 1066.2.3 #Edict of Milan
			}
			modifier = {
				factor = 0
				OR = {
					tag = JUD
					heritage = judea_heritage
					tag = SMA
					heritage = samaria_heritage
				}
			}
		}
	}

	convert_to_manichaean = {
		potential = {
			is_ai = no
			num_of_cities >= 1
			potential_change_religion_trigger = {
				RELIGION = manichaeism
			}
		}

		allow = {
			could_change_religion_mani_trigger = {
				RELIGION = manichaeism
			}
		}
		
		effect = {
			change_religion_effect = {
				RELIGION = manichaeism
			}
		}
		
		ai_will_do = {
			factor = 0
		}
	}

	ai_convert_to_manichaean = {
		potential = {
			is_ai = yes
			num_of_cities >= 1
			potential_change_religion_trigger = {
				RELIGION = manichaeism
			}
		}

		allow = {
			could_change_religion_trigger = {
				RELIGION = manichaeism
			}
		}
		
		effect = {
			change_religion_effect = {
				RELIGION = manichaeism
			}
		}
		
		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				capital_scope = {
					dominant_province_religion = manichaeism
				}
			}
			modifier = {
				factor = 0
				OR = {
					tag = JUD
					heritage = judea_heritage
					tag = SMA
					heritage = samaria_heritage
				}
			}
		}
	}

	ai_constantinople = {
		potential = {
			current_date > 1083.5.11
			is_ai = yes
			OR = {
				tag = ROM
				AND = {
					primary_culture = roman
					heritage = roman_heritage
				}
			}	
			owns = 1
			owns = 1453
			NOR = {
				p:1453 = {
					is_capital = yes
				}
				has_global_variable = roman_empire_divided
			}

			OR = {
				government = imperium
				government = imperial_cult
			}
		}

		allow = {
			current_ruler = {
				has_religion = christianity
			}
			num_of_cities >= 600
			has_civil_war = no
			war = no
		}

		effect = {
			set_capital = 1453
			hidden_effect = {
				p:1453.state = {
					set_state_capital = 1453
				}
			}
			capital_scope = {
				increase_province_rank_effect = yes
			}
			if = {
				limit = {
					p:1453 = {
						total_population < 20
						NOT = {
							has_variable = moved_nova_roma
						}
					}
				}	
				p:1453 = {
					add_province_modifier = {
						name = "ai_constantinople_capital"
						duration = 4359
					}
				}
				set_variable = moved_nova_roma
			}
		}

		ai_will_do = {
			factor = 10
		}

	}

	convert_to_hunnic_huna_animism = {
		
		potential = {
			num_of_cities >= 1
			potential_change_religion_trigger = {
				RELIGION = hunnic_huna_animism
			}
		}
	
		allow = {
			could_change_religion_trigger = {
				RELIGION = hunnic_huna_animism
			}
		}
		
		effect = {
			change_religion_effect = {
				RELIGION = hunnic_huna_animism
			}
		}
		
		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				capital_scope = {
					dominant_province_religion = hunnic_huna_animism
				}
			}
		}
	}
	
}


