# Character scope
on_yearly_pulse = {
	events = {
		SoA.1209 # Birth of the Bektashi Order
		CM.4309  # Birth of the Haruriyyah Order
	}

	random_events = {
		demon_child_magic = {
			delay = 17

			1000 = 0
			1000 = SoA.3050 # Demon Child recovers from maiming
			1000 = SoA.3051 # Demon Child recovers from blinding
			1000 = SoA.3052 # Demon Child recovers from castration
			1000 = SoA.3053 # Demon Child recovers from brain damage
			1000 = SoA.3060 # Demon Child escapes from prison
		}

		# courtier_conversion = {
		# 	100 = SoA.4030 # Courtier with minority religion attempts to convert another character at court
		# }

		holy_order_castle = {
			500 = 0
			500 = SoA.1052 # # A Holy Grand Master humbly requests the right to build a castle in some ruler's demesne
		}

		holy_order_loan = {
			delay = 170

			700 = 0
			100 = SoA.1003 # Grand Master demands one of your sons due to debt
			200 = SoA.1020 # Grand Master demands the right to build a castle in your demesne
		}

		influential_monasteries = {
			667 = 0
			333 = SoA.5340 # Cluny priests are very influential
			333 = SoA.5344 # Priests at Mount Athos are very influential
		}
	}
}

# Character scope
on_bi_yearly_pulse = {
	events = {
		# Found Holy Orders
		SoA.1709 # Order of Saint Anthony fromed
		SoA.2609 # Order of Santiago formed
		SoA.2709 # Order of Calatrava formed
		SoA.2809 # Order of St Addai formed

		# Wicked Priests
		SoA.5300 # Christian becoming a wicked priest
		SoA.5301 # Muslim becoming a wicked caliph
		SoA.5302 # Norse becoming an unworthy priest
		SoA.5303 # Tengri becoming an unworthy priest
		SoA.5304 # Zoroastrian becoming an immoral priest
		SoA.5305 # Aztec becoming an unworthy priest
	}

	random_events = {
		holy_order_volunteer = {
			990 = 0
			 10 = SoA.1030 # The son of a ruler volunteers to join a holy order
		}

		fingerbone = {
			delay = 61

			9016 = 0

			 48 = SoA.5201 # Buys relic at market
			 48 = SoA.5202 # Given relic by priest who feels he cannot protect it at his little church
			 96 = SoA.5203 # Misplaced relic
			 24 = SoA.5205 # Relic mixed up with other bones
			480 = SoA.5206 # Use relic to heal sickness?
			240 = SoA.5221 # Bring relic out to bless the fields
			 96 = SoA.5208 # Commerce with relics
			 80 = SoA.5209 # Donate owned relic to church?
		}

		monk_flavour = {
			delay = 25

			8750 = 0

			 96 = SoA.5210 # Monks make fantastic beer
			 96 = SoA.5211 # Monks make great wine
			240 = SoA.5212 # Monks have healing herbs
			 48 = SoA.5213 # Monk is fantastic painter
			 60 = SoA.5214 # Monks produce beautiful books
			 60 = SoA.5215 # Local monks come to visit often
			240 = SoA.5218 # Child wants to be monk/nun
			120 = SoA.5219 # Donate to local monastery
			180 = SoA.5341 # Donate to Cluny Abbey
			180 = SoA.5342 # Visit Cluny?
			180 = SoA.5345 # Donate to Mount Athos monasteries
			180 = SoA.5346 # Visit Mount Athos?
		}

		miracles = {
			delay = 33

			9064 = 0

			 48 = SoA.5240 # Stigmata
			 48 = SoA.5241 # I saw the Virgin
			240 = SoA.5242 # Virgin birth
			600 = SoA.5244 # Exorcism
		}

		tolerance = {
			delay = 105

			910 = 0

			80 = SoA.5410 # Tolerant character making Christian friend
			80 = SoA.5411 # Tolerant character making Muslim friend
			80 = SoA.5412 # Tolerant character making Pagan friend
			80 = SoA.5413 # Tolerant character making Zoroastrian friend
			80 = SoA.5414 # Tolerant character making Jewish friend
			80 = SoA.5420 # Zealous character insults other religions
		}
	}
}

# Character scope
on_five_year_pulse = {
	random_events = {
		jewish_events = {
			delay = 77

			1120 = 0

			 45 = SoA.200 # Jewish Diplomat Appears at Court
			 45 = SoA.201 # Jewish Administrator Appears at Court
			 45 = SoA.202 # Jewish Spy Appears at Court
			 96 = SoA.300 # Jewish Expulsion - Loss of economic tech
			 96 = SoA.301 # Jewish Expulsion - Loss of cultural tech
			 96 = SoA.302 # Jewish Expulsion - Loss of military tech
			200 = SoA.560 # Jewish Councillor increases tech
		}

		muslim_schools = {
			delay = 81

			475 = 0

			 95 = SoA.603 # Ash'ari liege has Mu'tazila vassal
			 95 = SoA.611 # Mu'tazila liege has Ash'ari vassal
			430 = SoA.620 # Cynical Ash'ari considers Mu'tazila
			430 = SoA.621 # Zealous Mu'tazila considers Ash'ari
		}

		muslim_tolerance = {
			delay = 96

			950 = 0
			 50 = SoA.5425 # Muslim tolerance towards Judaism and Christianity
		}
	}
}

# Character scope
on_decade_pulse = {
	random_events = {
		40 = SoA.4020 # Character converts to local religion - former MTTH event

		jeanne_darc = {
			delay = 16

			960 = 0
			 40 = SoA.5353 # Jeanne d'Arc Start
		}
	}
}

# ROOT is the owner of the winning unit
# FROM is the taken holding title
on_siege_over_winner = {
	random_events = {
		100 = SoA.5400 # Massacre at Beziers-type event

		fingerbone_stolen = {
			delay = 2

			850 = 0
			150 = SoA.5220 # Relic is stolen by raiders
		}
	}
}

# Fires for all characters presumed to be in the Holding at the time
# ROOT is local character
# FROM is lost holding title
# new_character is owner of siege winner unit
on_siege_over_loc_chars = {
	events = {
		# SoA.5406 # Shepherds' Crusade kills Jews and priests
	}
}

# Character scope
on_adulthood = {
	events = {
		SoA.3020 # Demon child's true nature asserts itself
	}
}

# Baby scope
on_post_birth = {
	events = {
	}

	random_events = {
		demon_child_chance = {
			996 = 0
			  4 = SoA.3001 # Newborn is a demon child
		}
	}
}

# Character scope, isn't dead yet
on_death = {
	events = {
		SoA.5306 # Check for Cadaver Synod
		SoA.3091 # The Death of the Demon Child?
		SoA.5399 # Jeanne d'Arc dies
	}
}

ASK_FOR_MONEY_INTERACTION_ACCEPT_EVENT = {
	events = {
		SoA.3100
	}
}

ASK_FOR_MONEY_INTERACTION_DECLINE_EVENT = {
	events = {
		SoA.3101
	}
}

ASK_FOR_CLAIM_INTERACTION_ACCEPT_EVENT = {
	events = {
		SoA.3104
	}
}

ASK_FOR_CLAIM_INTERACTION_DECLINE_EVENT = {
	events = {
		SoA.3105
	}
}

NOMINATE_BISHOP_TO_POPE_INTERACTION_ACCEPT_EVENT = {
	events = {
		SoA.3102
	}
}

NOMINATE_BISHOP_TO_POPE_INTERACTION_DECLINE_EVENT = {
	events = {
		SoA.3103
	}
}

# When the religion changes in a county
# ROOT is province
# FROM has the old religion
on_county_religion_change = {
	events = {
		SoA.4121 # The heresy is eradicated in the county
	}
}

# A heresy has become the new norm, replacing the old orthodoxy
# FROM is new parent religion scope
# FROMFROM is new heresy religion scope
on_heresy_takeover = {
	events = {
		SoA.4200 # Announcement/chronicle event
	}
}

# Fires when a cardinal is elected. SoA only!
# ROOT is new Pope
# FROM is the religious head
on_rel_elector_chosen = {
	events = {
	}
}

# Fires when a Pope is elected. SoA only!
# ROOT is new Pope
# FROM is the previous Religious Head
on_rel_head_chosen = {
	events = {
	}
}

# Character converts religion, for whatever reason
# ROOT is the character after conversion
# FROM scope has the old religion
on_character_convert_religion = {
	events = {
		SoA.566 # Jews Welcomed Back due to ruler now being Jewish!
		SoA.5998 # End pilgrimage if no longer Christian
	}
}

# Sent to employers of both spouses
# ROOT is employer
# FROM is employers "employee"
# new_character is the other spouse.
on_marriage = {
	events = {
		SoA.5382 # Jeanne d'Arc marries
	}
}

# Character scope
on_birth = {
	events = {
		SoA.5384 # Jeanne d'Arc has a child
	}
}

# Triggers when someone gets imprisoned for any reason
# ROOT is prisoner
# FROM is imprisoner
on_become_imprisoned_any_reason = {
	events = {
		SoA.5999 # Stop pilgrimage when arrested.
	}
}

# Triggers for all characters in a unit (leading a flank or subunit) when it enters a province
# ROOT is the affected character
on_unit_entering_province = {
	random_events = {
		plunder_fingerbone = {
			7500 = 0
			1 = SoA.5200 # Plunders relic in war
		}
	}
}

# Triggers when a change of employer has been detected. Note that the FROM scope is empty for newly created characters.
# ROOT is character that got a new employer
# FROM is previous employer
# FROMFROM is new employer
on_employer_change = {
	events = {
		SoA.3073 # Witch nanny moves with her charge - Nanny
		SoA.3079 # Witch nanny moves with her charge - Demon child
	}
}