# ============================================================
# DREAD & TYRANNY MANAGEMENT EFFECTS
# ============================================================

# Execution Effects
qyv_ai_execute_traitor = {
    scope:execution_target = {
        execute_imprisoned = yes
    }
    root = {
        add_dread = 15
        add_tyranny = 10
    }
}

qyv_ai_execute_rival_claimant = {
    scope:claimant_target = {
        execute_imprisoned = yes
    }
    root = {
        add_dread = 20
        add_tyranny = 15
    }
}

qyv_ai_execute_incompetent_heir = {
    scope:bad_heir = {
        execute_imprisoned = yes
    }
    root = {
        add_dread = 25
        add_tyranny = 20
    }
}

# Torture Effects
qyv_ai_torture_for_hook = {
    scope:torture_target = {
        torture = { target = root }
    }
    root = {
        add_dread = 10
        add_tyranny = 5
    }
    if = {
        limit = { scope:torture_target = { has_hook_on = root } }
        root = {
            enforce_hook = {
                target = scope:torture_target
                demand_council_position = yes
            }
        }
    }
}

# Title Revocation
qyv_ai_revoke_title = {
    if = {
        limit = {
            any_vassal = {
                is_powerful = yes
                opinion_of_self < -75
                is_faction_leader = yes
            }
        }
        scope:powerful_vassal = {
            revoke_title = { title = scope:powerful_vassal.primary_title }
        }
        root = {
            add_dread = 20
            add_tyranny = 20
        }
    }
}

# Imprisonment
qyv_ai_imprison_vassal = {
    scope:imprison_target = {
        imprison = { target = root }
    }
    root = {
        add_dread = 10
        add_tyranny = 10
    }
}

# Tyranny Acceptance
qyv_ai_accept_tyranny = {
    if = {
        limit = {
            any_vassal = {
                is_powerful = yes
                is_faction_leader = yes
                opinion_of_self < -50
            }
        }
        scope:powerful_vassal = {
            add_opinion = { target = root modifier = tyranny_accepted years = 5 }
        }
        root = {
            add_tyranny = 30
            add_dread = 20
        }
    }
}

# Hook Usage for Obedience
qyv_ai_use_hook_for_obedience = {
    if = {
        limit = {
            any_vassal = {
                has_hook_on = root
                opinion_of_self < 0
            }
        }
        scope:hooked_vassal = {
            enforce_hook = {
                target = root
                demand_gold = 200
            }
        }
    }
}

qyv_ai_use_hook_for_council = {
    if = {
        limit = {
            any_vassal = {
                has_hook_on = root
                is_powerful = yes
                NOT = { is_on_council = yes }
            }
        }
        scope:hooked_vassal = {
            enforce_hook = {
                target = root
                demand_council_position = yes
            }
        }
    }
}

qyv_ai_use_hook_for_gold = {
    if = {
        limit = {
            any_vassal = {
                has_hook_on = root
                gold >= 500
            }
        }
        scope:hooked_vassal = {
            enforce_hook = {
                target = root
                demand_gold = 300
            }
        }
    }
}

qyv_ai_use_hook_for_levies = {
    if = {
        limit = {
            any_vassal = {
                has_hook_on = root
                is_powerful = yes
            }
        }
        scope:hooked_vassal = {
            enforce_hook = {
                target = root
                demand_levies = yes
            }
        }
    }
}

# Dread Generation
qyv_ai_generate_dread = {
    if = {
        limit = { dread < 30 }
        root = { add_dread = 10 }
    }
}

qyv_ai_generate_dread_via_events = {
    if = {
        limit = { dread < 20 }
        root = { add_dread = 15 }
    }
}

# Trait Acquisition for Dread
qyv_ai_acquire_cruel_trait = {
    if = {
        limit = { NOT = { has_trait = cruel } }
        add_trait = cruel
    }
}

qyv_ai_acquire_sadistic_trait = {
    if = {
        limit = { NOT = { has_trait = sadistic } }
        add_trait = sadistic
    }
}

qyv_ai_acquire_impaler_trait = {
    if = {
        limit = { NOT = { has_trait = impaler } }
        add_trait = impaler
    }
}

qyv_ai_acquire_just_trait = {
    if = {
        limit = { NOT = { has_trait = just } }
        add_trait = just
    }
}

# Dread Reduction
qyv_ai_reduce_dread = {
    if = {
        limit = { dread > 60 }
        root = { add_dread = -10 }
    }
}

qyv_ai_acquire_compassionate_trait = {
    if = {
        limit = { NOT = { has_trait = compassionate } }
        add_trait = compassionate
    }
}

qyv_ai_acquire_forgiving_trait = {
    if = {
        limit = { NOT = { has_trait = forgiving } }
        add_trait = forgiving
    }
}

# Hook Usage for Dread
qyv_ai_use_hook_for_dread = {
    if = {
        limit = {
            any_vassal = {
                has_hook_on = root
                is_powerful = yes
                opinion_of_self < -25
            }
        }
        scope:hooked_vassal = {
            enforce_hook = {
                target = root
                demand_council_position = yes
            }
        }
    }
}