{
  "_spec_version": "0.2.1",
  "character": "Kuhara",
  "name_zh": "九原",
  "element": "NATURE",

  "resources": [
    {
      "id": "bullet",
      "name_zh": "攻約子彈",
      "max": null,
      "initial": 0,
      "regen": { "rate": 0 },
      "decay": { "rate": 0 }
    },
    {
      "id": "terminal_energy",
      "name_zh": "終結能量",
      "max": 100,
      "initial": 0,
      "regen": { "rate": 0 },
      "decay": { "rate": 0 }
    }
  ],

  "cooldowns": [
    { "id": "skill_cd", "duration_sec": "unknown", "charges": 1, "starts_ready": true },
    { "id": "c6_cd", "duration_sec": 5, "charges": 1, "starts_ready": true }
  ],

  "states": [
    {
      "id": "seed",
      "name_zh": "致命攻約",
      "target": "enemy",
      "max_stacks": 1,
      "phases": [
        {
          "id": "immature",
          "exit_mode": "timer",
          "duration_sec": 5,
          "on_enter": [],
          "on_tick": { "effect": { "type": "hit", "key": "Seed", "count": 1 }, "interval_sec": 1 },
          "on_exit": [{ "type": "transition_phase", "state_id": "seed", "to_phase": "clearable" }]
        },
        {
          "id": "clearable",
          "exit_mode": "timer",
          "duration_sec": 25,
          "on_enter": [],
          "on_tick": { "effect": { "type": "hit", "key": "Seed", "count": 1 }, "interval_sec": 1 },
          "on_exit": [{ "type": "hit", "key": "BudEnd", "count": 1 }]
        }
      ],
      "accumulator": {
        "total_tick_damage": { "tracks": "tick_damage", "reset_on": "state_remove" }
      },
      "_note": "引爆（BudBoom）由 Trigger 處理，不走 phase.on_exit。remove_state Effect 硬移除，不觸發 on_exit。自然超時才走 on_exit → BudEnd。"
    }
  ],

  "modifiers": [
    {
      "id": "c1_atk_per_seed",
      "name_zh": "知曉與制衡",
      "target_stat": "atk",
      "operation": "multiply",
      "value": 1.05,
      "scope": "self",
      "duration_sec": null,
      "stacking": { "max_stacks": 3, "per_stack": 0.05 },
      "active_condition": { "op": "count_targets_with_state", "state_id": "seed", "compare": "gt", "value": 0 },
      "stacking_source": "state.seed.target_count"
    },
    {
      "id": "c2_seed_dot_multiply",
      "name_zh": "過往消息皆為利刃（DOT）",
      "target_stat": "hit_rate",
      "operation": "multiply",
      "value": 2.0,
      "scope": "self",
      "duration_sec": null,
      "hit_filter": ["Seed"],
      "source_trigger_filter": null,
      "active_condition": null
    },
    {
      "id": "c4_detonate_multiply",
      "name_zh": "出手即致命",
      "target_stat": "hit_rate",
      "operation": "multiply",
      "value": 1.5,
      "scope": "self",
      "duration_sec": null,
      "hit_filter": ["BudBoom"],
      "source_trigger_filter": ["hold_detonate_seed"],
      "active_condition": null
    },
    {
      "id": "c5_dmg_vs_seed",
      "name_zh": "掌握底細的優越",
      "target_stat": "dmg_bonus",
      "operation": "add",
      "value": 0.08,
      "scope": "self",
      "duration_sec": null,
      "active_condition": { "op": "has_state", "state_id": "seed", "target": "enemy" }
    }
  ],

  "triggers": [
    {
      "id": "normal_gain_bullet",
      "on": "action_cast",
      "filter": { "action_id": "normal_combo" },
      "condition": null,
      "effects": [{ "type": "modify_resource", "resource_id": "bullet", "amount": 2 }]
    },
    {
      "id": "normal_s5_apply_seed",
      "on": "action_hit",
      "filter": { "action_id": "normal_combo", "stage": 5 },
      "condition": null,
      "effects": [{ "type": "apply_state", "state_id": "seed", "target": "enemy" }]
    },
    {
      "id": "hold_consume_bullet",
      "on": "action_cast",
      "filter": { "action_id": "hold_attack" },
      "condition": { "op": "gt", "left": "resource.bullet.current", "right": 0 },
      "effects": [
        { "type": "modify_resource", "resource_id": "bullet", "amount": -1 },
        { "type": "hit", "key": "BranchPower", "count": 1 }
      ]
    },
    {
      "id": "hold_detonate_seed",
      "on": "action_hit",
      "filter": { "action_id": "hold_attack" },
      "condition": { "op": "and", "operands": [
        { "op": "has_state", "state_id": "seed", "target": "enemy" },
        { "op": "eq", "left": "state.seed.phase", "right": "clearable" }
      ]},
      "effects": [
        { "type": "hit", "key": "BudBoom", "count": 1 },
        { "type": "remove_state", "state_id": "seed", "target": "enemy" }
      ]
    },
    {
      "id": "evade_gain_bullet_and_seed",
      "on": "action_cast",
      "filter": { "action_id": "evade_counter" },
      "condition": null,
      "effects": [
        { "type": "modify_resource", "resource_id": "bullet", "amount": 2 },
        { "type": "apply_state", "state_id": "seed", "target": "enemy" }
      ]
    },
    {
      "id": "skill_gain_bullet_and_seed",
      "on": "action_cast",
      "filter": { "action_id": "skill" },
      "condition": null,
      "effects": [
        { "type": "modify_resource", "resource_id": "bullet", "amount": 4 },
        { "type": "apply_state", "state_id": "seed", "target": "enemy" }
      ]
    },
    {
      "id": "qte_gain_bullet",
      "on": "action_cast",
      "filter": { "action_id": "qte" },
      "condition": null,
      "effects": [{ "type": "modify_resource", "resource_id": "bullet", "amount": 2 }]
    },
    {
      "id": "ultra_force_clearable",
      "on": "action_cast",
      "filter": { "action_id": "ultra" },
      "condition": { "op": "and", "operands": [
        { "op": "has_state", "state_id": "seed", "target": "enemy" },
        { "op": "eq", "left": "state.seed.phase", "right": "immature" }
      ]},
      "effects": [{ "type": "transition_phase", "state_id": "seed", "to_phase": "clearable" }]
    },
    {
      "id": "ultra_final_detonate",
      "on": "action_hit",
      "filter": { "action_id": "ultra", "hit_key": "UltraSkill4" },
      "condition": { "op": "has_state", "state_id": "seed", "target": "enemy" },
      "effects": [
        { "type": "hit", "key": "BudBoom", "count": 1, "override_rate": 4.0 },
        { "type": "remove_state", "state_id": "seed", "target": "enemy" }
      ]
    },
    {
      "id": "passive2_seedreaction_apply",
      "_name": "創生花命中未締結目標 → 強制締結",
      "on": "action_hit",
      "filter": { "hit_key": "SeedReaction" },
      "condition": { "op": "not", "operand": { "op": "has_state", "state_id": "seed", "target": "enemy" } },
      "effects": [{ "type": "apply_state", "state_id": "seed", "target": "enemy" }]
    },
    {
      "id": "passive2_seedreaction_detonate",
      "_name": "創生花命中已締結目標 → 追加清算",
      "on": "action_hit",
      "filter": { "hit_key": "SeedReaction" },
      "condition": { "op": "has_state", "state_id": "seed", "target": "enemy" },
      "effects": [{ "type": "hit", "key": "SeedReaction", "count": 1 }]
    },
    {
      "id": "c2_ultra_detonate_heal",
      "_name": "Q 清算按累積總傷 5% 全隊回血",
      "on": "action_hit",
      "filter": { "action_id": "ultra", "hit_key": "UltraSkill4" },
      "condition": { "op": "has_state", "state_id": "seed", "target": "enemy" },
      "effects": [{ "type": "heal", "scope": "team", "scale": "state.seed.accumulator.total_tick_damage", "rate": 0.05 }],
      "_constellation": "c2"
    },
    {
      "id": "c3_ultra_detonate_unbal",
      "_name": "Q 引爆額外扣 4 傾陷值",
      "on": "action_hit",
      "filter": { "action_id": "ultra", "hit_key": "UltraSkill4" },
      "condition": { "op": "has_state", "state_id": "seed", "target": "enemy" },
      "effects": [{ "type": "modify_resource", "resource_id": "target.unbal", "amount": -4 }],
      "_constellation": "c3"
    },
    {
      "id": "c6_enemy_skill_hit",
      "_name": "已締結目標每次釋放技能受 200% 傷害",
      "on": "action_cast",
      "filter": { "source": "enemy" },
      "condition": { "op": "has_state", "state_id": "seed", "target": "enemy" },
      "effects": [{ "type": "hit", "key": "TargetActivateSkill", "count": 1 }],
      "cooldown_sec": 5,
      "_constellation": "c6"
    }
  ],

  "actions": {
    "normal_combo": {
      "id": "normal_combo",
      "name_zh": "秘密成型時",
      "type": "normal",
      "cost": null,
      "cooldown_id": null,
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [{ "key": "Melee1", "count": 1 }] },
        { "stage": 2, "hits": [{ "key": "Melee2", "count": 1 }, { "key": "Melee2_1", "count": 1 }] },
        { "stage": 3, "hits": [{ "key": "Melee3", "count": 1 }, { "key": "Melee3_1", "count": 1 }, { "key": "Melee3_2", "count": 1 }] },
        { "stage": 4, "hits": [{ "key": "Melee4", "count": 1 }, { "key": "Melee4_1", "count": 1 }, { "key": "Melee4_2", "count": 1 }, { "key": "Melee4_3", "count": 1 }] },
        { "stage": 5, "hits": [{ "key": "Melee5", "count": 1 }] }
      ],
      "on_cast": [],
      "triggers": ["normal_gain_bullet", "normal_s5_apply_seed"]
    },
    "hold_attack": {
      "id": "hold_attack",
      "name_zh": "資訊導向型",
      "type": "hold",
      "cost": null,
      "cooldown_id": null,
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [{ "key": "Branch", "count": 1 }] }
      ],
      "on_cast": [],
      "triggers": ["hold_consume_bullet", "hold_detonate_seed"],
      "_note": "BranchPower hit 由 hold_consume_bullet Trigger 條件觸發（有子彈時）"
    },
    "aim": {
      "id": "aim",
      "name_zh": "契機鎖定",
      "type": "aim",
      "cost": null,
      "cooldown_id": null,
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [{ "key": "AimAttack", "count": 1 }] }
      ],
      "on_cast": [],
      "triggers": []
    },
    "air_attack": {
      "id": "air_attack",
      "name_zh": "俯瞰全局",
      "type": "air",
      "cost": null,
      "cooldown_id": null,
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [{ "key": "AirAttack", "count": 1 }] }
      ],
      "on_cast": [],
      "triggers": [],
      "_note": "傷害隨落下高度提升，最高 2×"
    },
    "evade_counter": {
      "id": "evade_counter",
      "name_zh": "局勢逆轉",
      "type": "evade_counter",
      "cost": null,
      "cooldown_id": null,
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [{ "key": "PerfectEvadeAttack", "count": 1 }] }
      ],
      "on_cast": [],
      "triggers": ["evade_gain_bullet_and_seed"]
    },
    "skill": {
      "id": "skill",
      "name_zh": "情報獵手",
      "type": "skill",
      "cost": null,
      "cooldown_id": "skill_cd",
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [
          { "key": "Skill1", "count": 1 },
          { "key": "Skill2", "count": 4 },
          { "key": "Skill3", "count": 1 }
        ]}
      ],
      "on_cast": [],
      "triggers": ["skill_gain_bullet_and_seed"]
    },
    "ultra": {
      "id": "ultra",
      "name_zh": "終局清帳",
      "type": "ultra",
      "cost": { "resource_id": "terminal_energy", "amount": 100 },
      "cooldown_id": null,
      "cast_condition": { "op": "gte", "left": "resource.terminal_energy.current", "right": 100 },
      "stages": [
        { "stage": 1, "hits": [
          { "key": "UltraSkill1", "count": 1 },
          { "key": "UltraSkill2", "count": 3 },
          { "key": "UltraSkill3", "count": 7 },
          { "key": "UltraSkill4", "count": 1 }
        ]}
      ],
      "on_cast": [],
      "triggers": ["ultra_force_clearable", "ultra_final_detonate"]
    },
    "qte": {
      "id": "qte",
      "name_zh": "秘聞鎖定",
      "type": "qte",
      "cost": null,
      "cooldown_id": null,
      "cast_condition": null,
      "stages": [
        { "stage": 1, "hits": [{ "key": "QTE", "count": 1 }] }
      ],
      "on_cast": [],
      "triggers": ["qte_gain_bullet"]
    }
  },

  "passives": {
    "passive_1": {
      "name_zh": "順勢而獲",
      "desc": "創生強化：額外生成 1 株創生株，場上上限提升至 6 株",
      "triggers": [],
      "_note": "創生株機制屬於場景互動，不直接影響 DPS 計算"
    },
    "passive_2": {
      "name_zh": "風聲為我所用",
      "desc": "創生花命中未締結目標強制締結；命中已締結目標追加清算",
      "triggers": ["passive2_seedreaction_apply", "passive2_seedreaction_detonate"]
    }
  },

  "constellations": {
    "c1": {
      "name_zh": "知曉與制衡",
      "modifier_ids": ["c1_atk_per_seed"]
    },
    "c2": {
      "name_zh": "過往消息皆為利刃",
      "modifier_ids": ["c2_seed_dot_multiply"],
      "trigger_ids": ["c2_ultra_detonate_heal"]
    },
    "c3": {
      "name_zh": "優勢初成",
      "trigger_ids": ["c3_ultra_detonate_unbal"]
    },
    "c4": {
      "name_zh": "出手即致命",
      "modifier_ids": ["c4_detonate_multiply"]
    },
    "c5": {
      "name_zh": "掌握底細的優越",
      "modifier_ids": ["c5_dmg_vs_seed"]
    },
    "c6": {
      "name_zh": "知曉每一條秘密",
      "trigger_ids": ["c6_enemy_skill_hit"]
    }
  }
}
