﻿# More Personality Depth — childhood XP roller event
#
# This event is the trigger plumbing for the "childhood-locked" design.
# It fires 1 day after each vanilla child_personality_gain dispatch (see
# common/on_action/mpd_on_actions.txt). The 1-day delay lets the vanilla
# childhood event resolve (player/AI picks an option, the trait is added)
# BEFORE we try to compute its level — otherwise we'd see XP=0 traits
# before they exist.
#
# The immediate effect calls mpd_roll_all_personality_xp, which iterates
# the 36 personality traits and rolls a level for any trait that the
# character has but is at XP=0. The roller is idempotent (skips traits
# already at XP >= 1), so re-firing this event causes no harm.
#
# As Phase 2 of the childhood-locked design lands, the per-trait rollers
# in mpd_scripted_effects.txt will be enriched with contextual modifiers
# (culture, parents, guardian, wet nurse task). The plumbing here stays
# unchanged.

namespace = mpd_xp

mpd_xp.0001 = {
	type = character_event
	hidden = yes

	immediate = {
		mpd_roll_all_personality_xp = yes
	}
}

# Post-lobby sweep (see on_game_start_after_lobby in mpd_on_actions.txt).
# Root is any ruler; the sweep itself is global and idempotent.
mpd_xp.0002 = {
	type = character_event
	hidden = yes

	immediate = {
		every_living_character = {
			limit = { mpd_has_unrolled_personality_trait_trigger = yes }
			mpd_convert_rd_marker_traits = yes
			mpd_roll_all_personality_xp = yes
		}
	}
}
