the_three_royal_fires_mechanic = {
	alert_icon_gfx = GFX_alerticons_government_mechanics
	alert_icon_index = 12
	available = {
		has_dlc = "King of Kings"
	}

	powers = {
		asha_vahishta = {
			gui = three_flames_gov_mech 
			show_before_interactions = yes
			max = 100
			min = -100
			base_monthly_growth = 0.25
			scaled_modifier = {
				modifier = {
					global_unrest = -2.5
				}
			}
			scaled_modifier = {
				trigger = {
					has_government_power = { 
						mechanic_type = the_three_royal_fires_mechanic
						power_type = asha_vahishta
						value = 0
					}
				}
				modifier = {
					manpower_in_true_faith_provinces = 0.25
					monthly_adur_burzhen_mihr = 1
					monthly_adur_farnbag = 1
					monthly_adur_gushnasp = 1
				}
				start_value = 0
				end_value = 100			
			}
			reverse_scaled_modifier = {
				trigger = {
					NOT = {
						has_government_power = { 
							mechanic_type = the_three_royal_fires_mechanic
							power_type = asha_vahishta
							value = 0
						}
					}
				}
				modifier = {
					monthly_asha_vahishta = 1
				}
				start_value = -100
				end_value = 0
			}
		}
		adur_burzhen_mihr = {
			max = 100
			base_monthly_growth = 0.25
			monarch_power = ADM
			reset_on_new_ruler = no
		}
		adur_farnbag = {
			max = 100
			base_monthly_growth = 0.25
			monarch_power = DIP
			reset_on_new_ruler = no
		}
		adur_gushnasp = {
			max = 100
			base_monthly_growth = 0.25
			monarch_power = MIL
			reset_on_new_ruler = no
		}
	}
	interactions = {
		adur_farnbag_interaction = {
			gui = three_flames_interaction_button			
			icon = GFX_adur_farnbag_interaction
			cost_type = adur_farnbag
			cost = 100
			trigger = {
				#if = {
				#	limit = { has_country_flag = can_place_center_of_reformation }
				#	custom_trigger_tooltip = {
				#		tooltip = adur_farnbag_interaction_ct
				#		NOT = { has_country_flag = can_place_center_of_reformation }
				#	}
				#}
				has_government_power = {
					mechanic_type = the_three_royal_fires_mechanic
					power_type = asha_vahishta
					value = -50
				}
			}
			effect = {
				#if = {
				#	limit = {
				#		has_country_modifier = embraced_passive_conversion_methods
				#	}
				#	if = {
				#		limit = {
				#			NOT = {
				#				1 = {
				#					check_variable = {
				#						which = zoroastrian_reform_center_counter
				#						value = 3
				#					}
				#				}
				#			}
				#		}
				#		hidden_effect = {
				#			set_country_flag = can_place_center_of_reformation
				#		}
				#		custom_tooltip = adur_farnbag_interaction_at
				#	}
				#	else = {
				#		custom_tooltip = adur_farnbag_interaction_bt
				#	}
				#}
				if = {
					limit = { has_country_flag = upgraded_the_three_fire }
					add_estate_loyalty = {
						estate = all
						loyalty = 5
						short = yes
					}
				}
				if = {
					limit = { has_country_flag = enabled_three_royal_fires_mana_generation }
					add_adm_power = 50
				}
				add_country_modifier = {
					name = adur_farnbag_mod
					duration = 3650
				}
				custom_tooltip = ENERGIES_OF_AHURA_MAZDA_FOR_SELFISH_PURPOSES_TT
				add_government_power = {
					mechanic_type = the_three_royal_fires_mechanic
					power_type = asha_vahishta
					value = -50
				}
				hidden_effect = { 
					change_variable = { which = the_three_royal_fires_counter value = 1 } 
					change_variable = { which = adur_farnbag_interaction_counter value = 1 }
				}
			}
			ai_chance = {
				factor = 0	
			}
		}
		adur_burzhen_mihr_interaction = {
			gui = three_flames_interaction_button			
			icon = GFX_adur_burzhen_mihr_interaction
			cost_type = adur_burzhen_mihr
			cost = 100
			trigger = {
				has_government_power = {
					mechanic_type = the_three_royal_fires_mechanic
					power_type = asha_vahishta
					value = -50
				}
			}
			effect = {
				custom_tooltip = adur_burzhen_mihr_interaction_at
				hidden_effect = {
					change_variable = {
						which = zoroastrian_invitation_charges
						value = 1
					}
					if = {
						limit = { NOT = { has_country_flag = gained_first_invitation_charge } }
						set_country_flag = gained_first_invitation_charge
					}
				}
				if = {
					limit = { has_country_flag = upgraded_the_three_fire }
					capital_scope = {
						random_area_province = {
							limit = {
								owner = {
									tag = ROOT
								}
							}
							add_random_development = 1
						}
					}
				}
				if = {
					limit = { has_country_flag = enabled_three_royal_fires_mana_generation }
					add_dip_power = 50
				}
				add_country_modifier = {
					name = adur_burzhen_mihr_mod
					duration = 3650
				}
				custom_tooltip = ENERGIES_OF_AHURA_MAZDA_FOR_SELFISH_PURPOSES_TT
				add_government_power = {
					mechanic_type = the_three_royal_fires_mechanic
					power_type = asha_vahishta
					value = -50
				}
				hidden_effect = { 
					change_variable = { which = the_three_royal_fires_counter value = 1 } 
					change_variable = { which = adur_burzhen_mihr_interaction_counter value = 1 }
				}
			}
			ai_chance = {
				factor = 0	
			}
		}
		adur_gushnasp_interaction = {
			gui = three_flames_interaction_button
			icon = GFX_adur_gushnasp_interaction
			cost_type = adur_gushnasp
			cost = 100
			trigger = {
				has_government_power = {
					mechanic_type = the_three_royal_fires_mechanic
					power_type = asha_vahishta
					value = -50
				}
			}
			effect = {
				if = {
					limit = { has_country_flag = upgraded_the_three_fire }
					random_owned_province = {
						limit = {
							any_neighbor_province = {
								owner = {
									exists = yes
									not = { defensive_pact_with = ROOT }
									not = { religion = ROOT }
								}
								not = { is_claim = ROOT }
								not = { is_core = ROOT }
								has_discovered = ROOT
							}
						}
						every_neighbor_province = {
							limit = {
								owner = {
									exists = yes
									not = { defensive_pact_with = ROOT }
									not = { religion = ROOT }
								}
								not = { is_claim = ROOT }
								not = { is_core = ROOT }
								has_discovered = ROOT
							}
							add_claim = ROOT
						}
					}
				}
				if = {
					limit = { has_country_flag = enabled_three_royal_fires_mana_generation }
					add_mil_power = 50
				}
				add_country_modifier = {
					name = adur_gushnasp_mod
					duration = 3650
				}
				if = {
					limit = { has_country_flag = upgraded_the_three_fire }
					add_army_tradition = 5
				}
				custom_tooltip = ENERGIES_OF_AHURA_MAZDA_FOR_SELFISH_PURPOSES_TT
				add_government_power = {
					mechanic_type = the_three_royal_fires_mechanic
					power_type = asha_vahishta
					value = -50
				}
				hidden_effect = { 
					change_variable = { which = the_three_royal_fires_counter value = 1 } 
					change_variable = { which = adur_gushnasp_interaction_counter value = 1 }
				}
			}
			ai_chance = {
				factor = 10
				modifier = {
					factor = 100
					is_at_war = yes
				}
				modifier = {
					factor = 0
					is_at_war = no
				}
			}
		}
	}
}