﻿### Called when succession has happened - to fill the select-your-destiny character lists.
# Scopes:
# root: previous (dead) character
# scope:predecessor - previous (dead) character
# scope:heir - current player heir (which is the current player character at this point)
#
# Expected return set scopes:
# scope:main_destiny_types - list of flags of available main destiny character types (they may be empty)
# scope:random_destiny_types - list of flags of available random destiny character types (they may be empty)
# scope:<flag_of_destiny_type> - character available for destiny
on_player_select_destiny_setup = {
	on_actions = {
		regula_pass_on_magister_trait_primary_heir
	}
}

### Called when player has confirmed their selection of a destiny character
# Scopes:
# root: destiny character (is already current player)
# scope:destiny_type_flag - flag of selected destiny type
# scope:previous_player_character - previous player character
# scope:previous_player_heir - previous player heir
on_player_select_destiny_confirmed = {
	on_actions = {
		regula_pass_on_magister_trait_destiny_heir
	}
}

regula_pass_on_magister_trait_primary_heir = {
	effect = {
		scope:heir = {
			trigger_event = {
				id = regula_initialize_event.0010 # Pass on the Regula Magistri to primary heir (Note, only works if they are adult and are male!)
				days = 1
			}
		}
	}
}

regula_pass_on_magister_trait_destiny_heir = {
	effect = {
		trigger_event = {
			id = regula_initialize_event.0010 # Pass on the Regula Magistri to primary heir (Note, only works if they are adult and are male!)
			days = 1
		}
	}
}