law_groups = {
	status_of_magic = {
		law_type = realm
	}
}

laws = {
	status_of_magic_0 = {
		group = status_of_magic
		allow = {
			has_law = status_of_magic_1
			owner = {
				NOR = {
					religion_group = mythical_religion_group
					culture_group = elven
					culture_group = draconian
					culture_group = ork
					culture_group = undead
					trait = vampire
					trait = werewolf
				}
			}
		}
		potential = {
			#has_dlc = "Zeus"
			#holy_order = no
			NOR = {
				has_game_rule = {
					name = magical_age
					value = off
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		pass_effect = {
			
		}
		effect = {
			if = {
				limit = {
					NOT = { has_law = status_of_magic_0 }
				}
				custom_tooltip = {
					text = TOOLTIP_MAGIC_UNKNOWN
				}
			}
			hidden_tooltip = {
				revoke_law = status_of_magic_1
				revoke_law = status_of_magic_2
				revoke_law = status_of_magic_3
				revoke_law = status_of_magic_4
			}
		}
	}
	status_of_magic_1 = {
		group = status_of_magic
		allow = {
			OR = {
				has_law = status_of_magic_0
				has_law = status_of_magic_2
				has_law = status_of_magic_3
			}
			owner = {
				NOR = {
					religion_group = mythical_religion_group
					culture_group = elven
					culture_group = draconian
					culture_group = ork
					culture_group = undead
				}
			}
		}
		potential = {
			#has_dlc = "Zeus"
			#holy_order = no
			NOR = {
				has_game_rule = {
					name = magical_age
					value = off
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		pass_effect = {
			
		}
		effect = {
			if = {
				limit = {
					has_law = status_of_magic_0
				}
				custom_tooltip = {
					text = TOOLTIP_MAGIC_HERESY
				}
				custom_tooltip = {
					text = TOOLTIP_WITCHHUNTERS_AVAILABLE
				}
			}
			else_if = {
				limit = {
					NOT = { has_law = status_of_magic_1 }
				}
				custom_tooltip = {
					text = TOOLTIP_MAGIC_HERESY
				}
				custom_tooltip = {
					text = TOOLTIP_WITCHHUNTERS_UNAVAILABLE
				}
			}
			
			hidden_tooltip = {
				revoke_law = status_of_magic_0
				revoke_law = status_of_magic_2
				revoke_law = status_of_magic_3
				revoke_law = status_of_magic_4
			}
		}
	}
	status_of_magic_2 = {
		group = status_of_magic
		allow = {
			OR = {
				has_law = status_of_magic_0
				has_law = status_of_magic_1
				has_law = status_of_magic_3
				has_law = status_of_magic_4
			}
			conditional_tooltip = {
				trigger = {
					has_game_rule = {
						name = magical_age
						value = historical
					}
				}
				OR = {
					custom_tooltip = {
						text = TOOLTIP_MAGIC_AGE_RESTORED
						hidden_tooltip = { has_global_flag = magical_age_restored }
					}
					AND = {
						owner = {
							OR = {
								any_demesne_title = { title = k_britain }
								any_liege = {
									any_demesne_title = { title = k_britain }
								}
							}
						}
						custom_tooltip = {
							text = TOOLTIP_MERLIN_ARRIVED
							hidden_tooltip = {
								owner = {
									has_global_flag = merlin_appeared
									NOT = { has_global_flag = merlin_killed }
								}
							}
						}
					}
					owner = {
						OR = {
							religion_group = pagan_group
							religion_group = mythical_religion_group
							religion = taoist
							trait = vampire
							trait = werewolf
						}
					}
				}
			}
			owner = {
				NOR = {
					culture_group = elven
					culture_group = draconian
					culture_group = ork
					culture_group = undead
				}
			}
		}
		potential = {
			#has_dlc = "Zeus"
			#holy_order = no
			NOR = {
				has_game_rule = {
					name = magical_age
					value = off
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		pass_effect = {
			
		}
		effect = {
			if = {
				limit = {
					has_law = status_of_magic_0
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_TECHS
				}
				custom_tooltip = {
					text = TOOLTIP_WITCHHUNTERS_AVAILABLE
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_1
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_TECHS
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_3
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_MAGES_GUILD_UNAVAILABLE
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_4
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_MAGES_GUILD_UNAVAILABLE
				}
			}
			hidden_tooltip = {
				revoke_law = status_of_magic_0
				revoke_law = status_of_magic_1
				revoke_law = status_of_magic_3
				revoke_law = status_of_magic_4
			}
		}
	}
	status_of_magic_3 = {
		group = status_of_magic
		allow = {
			OR = {
				has_law = status_of_magic_2
				has_law = status_of_magic_4
			}
			conditional_tooltip = {
				trigger = {
					has_game_rule = {
						name = magical_age
						value = historical
					}
				}
				OR = {
					custom_tooltip = {
						text = TOOLTIP_MAGIC_AGE_RESTORED
						hidden_tooltip = { has_global_flag = magical_age_restored }
					}
					AND = {
						owner = {
							OR = {
								any_demesne_title = { title = k_britain }
								any_liege = {
									any_demesne_title = { title = k_britain }
								}
							}
						}
						custom_tooltip = {
							text = TOOLTIP_MERLIN_ARRIVED
							hidden_tooltip = {
								owner = {
									has_global_flag = merlin_appeared
									NOT = { has_global_flag = merlin_killed }
								}
							}
						}
					}
					owner = {
						OR = {
							religion_group = mythical_religion_group
							culture_group = elven
							culture_group = draconian
							culture_group = ork
							culture_group = undead
							trait = vampire
							trait = werewolf
						}
					}
				}
			}
		}
		potential = {
			#has_dlc = "Zeus"
			#holy_order = no
			NOR = {
				has_game_rule = {
					name = magical_age
					value = off
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		pass_effect = {
			
		}
		effect = {
			if = {
				limit = {
					has_law = status_of_magic_0
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_TECHS
				}
				custom_tooltip = {
					text = TOOLTIP_MAGES_GUILD_AVAILABLE
				}
				custom_tooltip = {
					text = TOOLTIP_WITCHHUNTERS_AVAILABLE
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_1
				}
				custom_tooltip = {
					text = TOOLTIP_DISALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_TECHS
				}
				custom_tooltip = {
					text = TOOLTIP_MAGES_GUILD_AVAILABLE
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_2
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_RACES
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_4
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_PRACTICE
				}
			}
			hidden_tooltip = {
				revoke_law = status_of_magic_0
				revoke_law = status_of_magic_1
				revoke_law = status_of_magic_2
				revoke_law = status_of_magic_4
			}
		}
	}
	status_of_magic_4 = {
		group = status_of_magic
		allow = {
			has_law = status_of_magic_3
			conditional_tooltip = {
				trigger = {
					has_game_rule = {
						name = magical_age
						value = historical
					}
				}
				OR = {
					custom_tooltip = {
						text = TOOLTIP_MAGIC_AGE_RESTORED
						hidden_tooltip = { has_global_flag = magical_age_restored }
					}
					AND = {
						owner = {
							OR = {
								any_demesne_title = { title = k_britain }
								any_liege = {
									any_demesne_title = { title = k_britain }
								}
							}
						}
						custom_tooltip = {
							text = TOOLTIP_MERLIN_ARRIVED
							hidden_tooltip = {
								owner = {
									has_global_flag = merlin_appeared
									NOT = { has_global_flag = merlin_killed }
								}
							}
						}
					}
					owner = {
						OR = {
							religion_group = mythical_religion_group
							culture_group = elven
							culture_group = draconian
							culture_group = ork
							culture_group = undead
							trait = vampire
							trait = werewolf
						}
					}
				}
			}
		}
		potential = {
			#has_dlc = "Zeus"
			#holy_order = no
			NOR = {
				has_game_rule = {
					name = magical_age
					value = off
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		pass_effect = {
			
		}
		effect = {
			if = {
				limit = {
					has_law = status_of_magic_0
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_TECHS
				}
				custom_tooltip = {
					text = TOOLTIP_MAGES_GUILD_AVAILABLE
				}
				custom_tooltip = {
					text = TOOLTIP_WITCHHUNTERS_AVAILABLE
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_1
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_RACES
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_TECHS
				}
				custom_tooltip = {
					text = TOOLTIP_MAGES_GUILD_AVAILABLE
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_2
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_PRACTICE
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_RACES
				}
			}
			if = {
				limit = {
					has_law = status_of_magic_3
				}
				custom_tooltip = {
					text = TOOLTIP_ALLOW_MAGIC_PRACTICE
				}
			}
			hidden_tooltip = {
				revoke_law = status_of_magic_0
				revoke_law = status_of_magic_1
				revoke_law = status_of_magic_2
				revoke_law = status_of_magic_3
			}
		}
	}
}