﻿# DDM 2.0 — Prime Education scoring.
# The vanilla guardian quality relationship weights relevant skill at twice Learning (0.4 vs 0.2).
# Prime Education keeps that relationship, then adds intelligence, selected temperament fit and a modest
# well-roundedness term so a brilliant ruler-shaped teacher can beat a one-dimensional specialist.

ddm_prime_well_rounded_bonus_value = {
    value = diplomacy
    add = martial
    add = stewardship
    add = intrigue
    add = learning
    multiply = 0.08
}

ddm_prime_temperament_fit_value = {
    value = 0

    # 1 = Virtuous: cultivate stable, conventionally constructive ruler personalities.
    if = {
        limit = { scope:ddm_prime_actor.var:ddm_prime_temperament_mode = 1 }
        if = { limit = { has_trait = diligent } add = 12 }
        if = { limit = { has_trait = patient } add = 10 }
        if = { limit = { has_trait = just } add = 8 }
        if = { limit = { has_trait = temperate } add = 8 }
        if = { limit = { has_trait = calm } add = 7 }
        if = { limit = { has_trait = honest } add = 6 }
        if = { limit = { has_trait = compassionate } add = 6 }
        if = { limit = { has_trait = generous } add = 4 }
        if = { limit = { has_trait = lazy } add = -12 }
        if = { limit = { has_trait = sadistic } add = -10 }
        if = { limit = { has_trait = callous } add = -8 }
        if = { limit = { has_trait = arbitrary } add = -8 }
        if = { limit = { has_trait = deceitful } add = -5 }
    }

    # 2 = Pragmatic: maximize broadly useful ruler traits without moral alignment.
    else_if = {
        limit = { scope:ddm_prime_actor.var:ddm_prime_temperament_mode = 2 }
        if = { limit = { has_trait = diligent } add = 12 }
        if = { limit = { has_trait = ambitious } add = 11 }
        if = { limit = { has_trait = patient } add = 9 }
        if = { limit = { has_trait = calm } add = 8 }
        if = { limit = { has_trait = temperate } add = 7 }
        if = { limit = { has_trait = brave } add = 7 }
        if = { limit = { has_trait = gregarious } add = 5 }
        if = { limit = { has_trait = just } add = 4 }
        if = { limit = { has_trait = lazy } add = -12 }
        if = { limit = { has_trait = impatient } add = -7 }
        if = { limit = { has_trait = arbitrary } add = -4 }
    }

    # 3 = Ruthless: cultivate forceful, coercive and intrigue-friendly personalities.
    else = {
        if = { limit = { has_trait = ambitious } add = 12 }
        if = { limit = { has_trait = diligent } add = 10 }
        if = { limit = { has_trait = brave } add = 8 }
        if = { limit = { has_trait = vengeful } add = 8 }
        if = { limit = { has_trait = deceitful } add = 8 }
        if = { limit = { has_trait = callous } add = 7 }
        if = { limit = { has_trait = sadistic } add = 6 }
        if = { limit = { has_trait = cynical } add = 5 }
        if = { limit = { has_trait = wrathful } add = 5 }
        if = { limit = { has_trait = content } add = -10 }
        if = { limit = { has_trait = compassionate } add = -8 }
        if = { limit = { has_trait = forgiving } add = -6 }
        if = { limit = { has_trait = trusting } add = -5 }
    }
}

ddm_prime_teacher_score_value = {
    value = ddm_educator_relevant_skill_value
    multiply = 2
    add = learning
    add = ddm_educator_intellect_bonus_value
    add = ddm_prime_temperament_fit_value
    add = ddm_prime_well_rounded_bonus_value

    # Prefer an idle teacher in a close call. Two existing wards remain excluded by the base trigger.
    if = { limit = { num_of_relation_ward = 1 } add = -3 }
}

# Subject aptitude uses the vanilla childhood-trait pattern (+20 matching, -20 struggling) and the
# child's existing stat as a secondary signal. These are added to each focus's best teacher score when
# DDM chooses the recommended Prime track.
ddm_prime_child_dip_aptitude_value = {
    value = diplomacy
    multiply = 2
    if = { limit = { OR = { has_trait = charming has_trait = curious } } add = 20 }
    if = { limit = { has_trait = bossy } add = -20 }
}
ddm_prime_child_mar_aptitude_value = {
    value = martial
    multiply = 2
    if = { limit = { OR = { has_trait = bossy has_trait = rowdy } } add = 20 }
    if = { limit = { has_trait = curious } add = -20 }
}
ddm_prime_child_ste_aptitude_value = {
    value = stewardship
    multiply = 2
    if = { limit = { OR = { has_trait = bossy has_trait = pensive } } add = 20 }
    if = { limit = { has_trait = charming } add = -20 }
}
ddm_prime_child_int_aptitude_value = {
    value = intrigue
    multiply = 2
    if = { limit = { OR = { has_trait = charming has_trait = rowdy } } add = 20 }
    if = { limit = { has_trait = pensive } add = -20 }
}
ddm_prime_child_lea_aptitude_value = {
    value = learning
    multiply = 2
    if = { limit = { OR = { has_trait = curious has_trait = pensive } } add = 20 }
    if = { limit = { has_trait = rowdy } add = -20 }
}
