Wiki

trigger · has_legitimacy

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Check scope country legitimacy 0-100: Example has_legitimacy < 60

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

has_legitimacy 常用于君主制或非民主政体的 mod 中,根据政权合法性高低触发不同的政治事件或限制某些决议的可用性,例如低合法性时禁止扩张决议、触发宫廷政变事件等。

# 决议:只有合法性足够高才能发起扩张运动
available = {
    has_government = monarchism
    has_legitimacy > 70
    has_stability > 0.4
}

# 事件触发条件:合法性过低引发内部动乱
trigger = {
    has_legitimacy < 40
    has_war = no
}

配合关系

  • add_legitimacy:最直接的配套 effect,在条件块检测到合法性不足时,通过事件或决议为国家增减合法性数值。
  • set_legitimacy:需要将合法性精确重置到某值时(如内战结束后的政权重建)与本 trigger 配合校验当前状态再决定是否执行。
  • has_stability:合法性与稳定度往往同步衡量政权健康度,二者常并列写在同一 trigger 块中作复合条件。
  • has_government:合法性机制通常只对特定政体有意义,配合 has_government 限定适用范围可避免逻辑误判。

常见坑

  1. 忘记合法性仅对部分政体生效:若未用 has_government 限定政体就直接检测 has_legitimacy,在民主国家等不使用该机制的政体上条件可能始终返回固定值,导致逻辑失控或决议对所有国家意外可用。
  2. 比较运算符方向写反has_legitimacy < 60 表示"合法性低于 60 时为真",新手有时误写成 has_legitimacy > 60 却期望触发低合法性惩罚事件,导致效果完全相反且难以排查。

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

has_legitimacy is commonly used in monarchy or non-democratic government mods to fire different political events or restrict the availability of certain decisions based on a regime's legitimacy level — for example, blocking expansion decisions at low legitimacy or triggering court coup events.

# Decision: expansion campaign only available when legitimacy is high enough
available = {
    has_government = monarchism
    has_legitimacy > 70
    has_stability > 0.4
}

# Event trigger: low legitimacy causes internal unrest
trigger = {
    has_legitimacy < 40
    has_war = no
}

Synergy

  • add_legitimacy: The most direct companion effect. When the condition block detects insufficient legitimacy, this effect is used inside events or decisions to add or subtract a country's legitimacy value.
  • set_legitimacy: Use alongside this trigger when you need to hard-reset legitimacy to a specific value (e.g., rebuilding a regime after a civil war ends) — check the current state first before deciding whether to execute.
  • has_stability: Legitimacy and stability are often evaluated together as joint indicators of regime health, and the two are frequently written side by side in the same trigger block as a compound condition.
  • has_government: Since the legitimacy mechanic is typically only meaningful for certain government types, pairing it with has_government to narrow the applicable scope prevents logic errors and false positives.

Common Pitfalls

  1. Forgetting that legitimacy only applies to certain government types: If you check has_legitimacy without first gating on has_government, the condition may always return a fixed value for governments that don't use this mechanic (such as democracies), causing logic to spiral out of control or decisions to become unexpectedly available to all countries.
  2. Writing the comparison operator in the wrong direction: has_legitimacy < 60 means "true when legitimacy is below 60." Beginners sometimes write has_legitimacy > 60 while expecting a low-legitimacy penalty event to fire, producing the exact opposite result — and a bug that is surprisingly hard to track down.