﻿# DDM 1.8 — Dynastic Command School
# These checks intentionally model the player's own commander knowledge rather than generating random
# military traits from nowhere. Standard CK3 commander traits are enumerated so the taught trait is always
# one the player actually possesses.

ddm_commander_school_has_transferable_trait_trigger = {
    OR = {
        AND = { scope:ddm_commander_teacher = { has_trait = logistician } NOT = { has_trait = logistician } }
        AND = { scope:ddm_commander_teacher = { has_trait = military_engineer } NOT = { has_trait = military_engineer } }
        AND = { scope:ddm_commander_teacher = { has_trait = aggressive_attacker } NOT = { has_trait = aggressive_attacker } }
        AND = { scope:ddm_commander_teacher = { has_trait = unyielding_defender } NOT = { has_trait = unyielding_defender } }
        AND = { scope:ddm_commander_teacher = { has_trait = forder } NOT = { has_trait = forder } }
        AND = { scope:ddm_commander_teacher = { has_trait = flexible_leader } NOT = { has_trait = flexible_leader } }
        AND = { scope:ddm_commander_teacher = { has_trait = desert_warrior } NOT = { has_trait = desert_warrior } }
        AND = { scope:ddm_commander_teacher = { has_trait = jungle_stalker } NOT = { has_trait = jungle_stalker } }
        AND = { scope:ddm_commander_teacher = { has_trait = reaver } NOT = { has_trait = reaver } }
        AND = { scope:ddm_commander_teacher = { has_trait = reckless } NOT = { has_trait = reckless } NOT = { has_trait = cautious_leader } }
        AND = { scope:ddm_commander_teacher = { has_trait = holy_warrior } NOT = { has_trait = holy_warrior } }
        AND = { scope:ddm_commander_teacher = { has_trait = open_terrain_expert } NOT = { has_trait = open_terrain_expert } }
        AND = { scope:ddm_commander_teacher = { has_trait = rough_terrain_expert } NOT = { has_trait = rough_terrain_expert } }
        AND = { scope:ddm_commander_teacher = { has_trait = forest_fighter } NOT = { has_trait = forest_fighter } }
        AND = { scope:ddm_commander_teacher = { has_trait = cautious_leader } NOT = { has_trait = cautious_leader } NOT = { has_trait = reckless } }
        AND = { scope:ddm_commander_teacher = { has_trait = organizer } NOT = { has_trait = organizer } }
        AND = { scope:ddm_commander_teacher = { has_trait = winter_soldier } NOT = { has_trait = winter_soldier } }
    }
}

# Run on the prospective student while scope:ddm_commander_teacher exists.
# DDM no longer imposes a custom numeric age floor. Direct children can remain students after
# adulthood; other adults are excluded by the list builder rather than by an arbitrary minimum age.
ddm_commander_school_student_trigger = {
    is_alive = yes
    is_incapable = no
    is_imprisoned = no
    is_hostage = no
    NOT = { has_character_flag = ddm_never_educate }
    NOT = { has_character_flag = ddm_commander_school_recent_attempt }
    OR = {
        NOT = { has_variable = ddm_commander_school_lessons_received }
        var:ddm_commander_school_lessons_received < 2
    }
    ddm_commander_school_has_transferable_trait_trigger = yes
}
