Wiki

trigger · enemies_strength_ratio

Definition

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

Description

Compares the estimated army strength between the scope country and all its enemies

实战 · 配合 · 坑

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

实战用法

enemies_strength_ratio 常用于 AI 决策或事件中,判断己方与当前所有交战国的综合陆军实力对比,从而触发求和、撤退或反攻等逻辑。例如在一个"战局不利时寻求停战"的事件中,可以用它过滤出处于劣势的国家:

# 当己方军事力量不足敌方一半时,触发求和事件
country_event = {
    id = my_mod.42
    trigger = {
        enemies_strength_ratio < 0.5
        has_defensive_war = yes
    }
}

配合关系

  • [fighting_army_strength_ratio](/wiki/trigger/fighting_army_strength_ratio):两者同为实力对比类 trigger,enemies_strength_ratio 衡量所有敌人的综合估算实力,而 fighting_army_strength_ratio 侧重实际交战部队,常对比使用以区分"纸面实力"与"前线压力"。
  • [has_defensive_war](/wiki/trigger/has_defensive_war):通常搭配使用,确保只在被动防御战场景下才评估敌我实力差距,避免在主动进攻时误触发退缩逻辑。
  • [any_enemy_country](/wiki/trigger/any_enemy_country):当需要进一步分析哪个具体敌国拉低了实力比时,用此 trigger 遍历所有敌人进行细粒度判断,与 enemies_strength_ratio 形成宏观+微观的两层检查。
  • [add_war_support](/wiki/effect/add_war_support):在判定己方实力占优(ratio > 1.0)时奖励战争意志,或在处于劣势时扣减,配合实力比做动态的士气管理。

常见坑

  1. 误以为比值基于真实兵力而非估算值:该 trigger 使用的是游戏内部的"估算"(estimated)实力,并非精确的师数量或装备数,AI 情报遮蔽、未探明的部队均会影响结果,不要用它做精确数值计算,只适合做阈值判断。
  2. 忘记 scope 必须是交战中的国家:若目标国当前没有任何战争,trigger 的对比对象为空,返回值可能出现非预期结果(通常为真或使条件失效),应先用 [has_defensive_war](/wiki/trigger/has_defensive_war)[any_enemy_country](/wiki/trigger/any_enemy_country) 做前置保护,确保 scope 国确实处于战争状态。

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

enemies_strength_ratio is commonly used in AI decision-making or events to assess the overall military strength comparison between your nation and all current enemies, thereby triggering peace negotiations, retreat, or counter-offensive logic. For example, in an event like "seeking armistice when war goes poorly," you can use it to filter out nations in a disadvantageous position:

# Trigger a peace event when your military strength is less than half of enemies'
country_event = {
    id = my_mod.42
    trigger = {
        enemies_strength_ratio < 0.5
        has_defensive_war = yes
    }
}

Synergy

  • [fighting_army_strength_ratio](/wiki/trigger/fighting_army_strength_ratio): Both are strength comparison triggers. enemies_strength_ratio measures the aggregate estimated strength of all enemies, while fighting_army_strength_ratio focuses on actual combat forces in theater. They are often compared to distinguish between "paper strength" and "frontline pressure."
  • [has_defensive_war](/wiki/trigger/has_defensive_war): Typically used together to ensure strength comparison is only evaluated in defensive war scenarios, preventing unintended retreat logic from triggering during offensive operations.
  • [any_enemy_country](/wiki/trigger/any_enemy_country): When you need to further identify which specific enemy is dragging down the strength ratio, use this trigger to iterate through all enemies for granular analysis, forming a macro+micro two-layer check with enemies_strength_ratio.
  • [add_war_support](/wiki/effect/add_war_support): When your side has superior strength (ratio > 1.0), reward war support, or reduce it when at a disadvantage. Pair it with the strength ratio for dynamic morale management.

Common Pitfalls

  1. Mistakenly assuming the ratio is based on actual troop counts rather than estimates: This trigger uses the game's internal "estimated" strength values, not precise division counts or equipment levels. Fog of war and unexplored units all affect the result. Don't use it for precise numerical calculations—it's only suitable for threshold judgments.
  2. Forgetting that scope must be a nation currently at war: If the target nation has no active wars, the comparison pool becomes empty, and the trigger may return unexpected results (usually true or fail the condition). Always add protective checks using [has_defensive_war](/wiki/trigger/has_defensive_war) or [any_enemy_country](/wiki/trigger/any_enemy_country) beforehand to ensure the scoped nation is actually in a state of war.