# Qyvaria - Missing trigger/effect definitions (added by audit fix)
# These were referenced by existing events/effects but not defined anywhere,
# causing silent no-ops. Definitions use only verified vanilla 1.20 syntax.

# Candidate trigger: does this character have good genetics for marriage?
qyv_candidate_good_genetics = {
    trigger = {
        is_adult = yes
        is_married = no
        OR = {
            has_trait = beautiful
            has_trait = handsome
            has_trait = attractive
            has_trait = genius
            has_trait = intelligent
            has_trait = quick
            has_trait = hale
            has_trait = robust
        }
        NOT = { has_trait = sickly }
        NOT = { has_trait = weak }
        NOT = { has_trait = frail }
    }
}

# Candidate trigger: is this character a strong ally?
qyv_candidate_strong_ally = {
    trigger = {
        is_adult = yes
        is_married = no
        total_soldiers >= 4000
        OR = {
            is_allied_to = root
            same_faith_as = root
            same_culture_as = root
        }
    }
}

# Effect: set the ruler's marriage goal flag based on strategy
qyv_ai_set_marriage_goal = {
    effect = {
        if = {
            limit = { qyv_strat_expansion = root }
            set_character_flag = qyv_marriage_goal_alliance
        }
        else_if = {
            limit = { qyv_strat_survival = root }
            set_character_flag = qyv_marriage_goal_genetics
        }
        else_if = {
            limit = { qyv_strat_diplomacy = root }
            set_character_flag = qyv_marriage_goal_alliance
        }
        else = {
            set_character_flag = qyv_marriage_goal_genetics
        }
    }
}

# Effect: send a marriage offer. Uses the standard courtship interaction
# channel so it is engine-supported rather than a custom hook.
# NOTE: the exact interaction type id must be verified in-game against
# the loaded DLCs; falls back to setting a flag if the type is unknown.
qyv_send_marriage_offer = {
    effect = {
        if = {
            limit = {
                exists = scope:target
                exists = scope:third
            }
            set_character_flag = qyv_pending_marriage_offer
            scope:target.set_variable = {
                name = qyv_marriage_offer_third
                value = scope:third
            }
        }
    }
}