Wiki

trigger · is_winning

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check if defender side in combat

实战 · 配合 · 坑

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

实战用法

is_winning 常用于战斗事件或战斗相关决议中,根据某一方是否处于优势来触发不同的叙事效果或奖励,例如为正在获胜的一方额外增加士气加成事件。也可在 limit 块中筛选特定战斗方,配合特质解锁或战斗 modifier 实现动态战场机制。

# 战斗事件:获胜方触发鼓舞效果
combat_event = {
    id = my_mod.combat.1
    trigger = {
        is_winning = yes
        is_attacker = no   # 确保是防守方正在获胜
    }
    option = {
        name = my_mod.combat.1.a
        # 此处添加效果
    }
}

配合关系

  • is_attacker / is_defender:与 is_winning 搭配可精确区分「进攻方获胜」还是「防守方获胜」,避免逻辑歧义。
  • skill_advantage:常同时检测技能优势与战斗胜负,用于判断将领能力是否是获胜关键因素。
  • has_combat_modifier:在已获胜的前提下进一步检查是否存在特定战斗加成,用于叠加条件触发特殊事件。
  • phase:结合战斗阶段判断,可区分"刚开始就领先"与"后期逆转获胜"等不同情形。

常见坑

  1. scope 混用is_winning 只能在 COMBATANT scope 下使用,若在国家或省份 scope 中调用会静默失败或报错,新手容易忘记先通过 combat 相关块进入正确 scope。
  2. 语义误解:部分开发者误以为 is_winning = yes 等同于"已经赢得战斗",实际上它只反映当前战斗中该方是否处于优势状态,战斗尚未结束,条件随战况实时变化。

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

is_winning is commonly used in combat events or combat-related decisions to trigger different narrative effects or rewards based on whether one side holds an advantage. For example, it can grant morale bonuses to the winning side, or be used in limit blocks to filter specific combatants, working in tandem with trait unlocks or combat modifiers to implement dynamic battlefield mechanics.

# Combat event: Morale boost for the winning side
combat_event = {
    id = my_mod.combat.1
    trigger = {
        is_winning = yes
        is_attacker = no   # Ensures the defending side is winning
    }
    option = {
        name = my_mod.combat.1.a
        # Add effects here
    }
}

Synergy

  • is_attacker / is_defender: When paired with is_winning, these allow precise distinction between "attacker winning" and "defender winning," eliminating logical ambiguity.
  • skill_advantage: Often checked simultaneously with combat victory to determine whether commander ability is the deciding factor in the outcome.
  • has_combat_modifier: Further checks for specific combat bonuses given that the side is already winning, useful for stacking conditions to trigger special events.
  • phase: Combined with combat phase checks, this distinguishes scenarios like "leading from the start" versus "comebacks in late-stage combat."

Common Pitfalls

  1. Scope confusion: is_winning can only be used within COMBATANT scope. Calling it in country or province scope will silently fail or throw an error—a common mistake for beginners who forget to enter the correct scope via combat-related blocks first.
  2. Semantic misinterpretation: Some developers mistakenly assume is_winning = yes means "already won the battle," when it actually reflects whether that side currently holds an advantage in the ongoing combat. The battle is not yet concluded, and the condition updates in real-time as the situation evolves.