Skip to content

强化配方

强化配方定义装备在不同星级的成功率、材料消耗、失败惩罚、效果和动作。文件位于 recipes/*.yml,文件名即为配方的内部标识。

顶层字段

字段类型说明
idstring配方唯一 ID。
display_namestring配方显示名(MiniMessage 格式)。
gui_templatestringGUI 模板引用。
economyobject经济系统配置(每次强化扣费)。
limitsobject强化限制(最大星级、锻印等)。
success_ratesmap各星级基础成功率。
matchobject匹配规则(哪些装备可使用此配方)。
name_actionslist全局名称修改操作。
lore_actionslist全局 Lore 修改操作。
starsmap各星级阶段定义。

经济配置

yaml
economy:
  enabled: true
  currencies:
    - provider: "vault"
      currency_id: ""
      base_cost: 320
      cost_formula: "%base_cost% * %star%"
      display_name: "<gold>金币</gold>"

cost_formula 支持表达式,可引用 %base_cost%%star% 等变量。

强化限制

yaml
limits:
  max_star: 12
  max_temper: 4
  temper_chance_bonus_per_level: 5.0
  success_chance_cap: 90.0
字段说明
max_star最大可强化星级。
max_temper最大锻印等级(失败时累积,提升下次成功率)。
temper_chance_bonus_per_level每级锻印提供的成功率加成(百分比)。
success_chance_cap成功率上限(含锻印加成后不超过此值)。

匹配规则

yaml
match:
  slot_groups:
    - "weapon"

支持 slot_groups(装备槽位组)、lore_contains(Lore 包含文本)和 stats_any(拥有指定属性)。

全局名称与 Lore 修改

这些操作在每次强化成功后都会应用到物品上,支持 %star%%temper%%max_temper%%temper_color% 等占位符。

yaml
name_actions:
  - action: "append_suffix"
    value: " [+%star%]"

lore_actions:
  - action: "prepend"
    content:
      - "<gradient:#F2C46D:#C9703D>强化等级 +%star%</gradient>"
      - "<gray>锻印: %temper_color%%temper%/%max_temper%</gray>"

星级阶段定义(stars)

每个星级可以包含:

字段说明
name该星级的里程碑名称(可选,用于 GUI 展示)。
effects效果列表(统一格式)。
materials强化所需材料。
actions强化成功/失败时执行的动作。

效果类型

type说明
variables表达式引擎变量(用于 Lore 渲染、名称/Lore 模板和占位符上下文,不会自动写入 Attribute PDC)。
ea_attributeEmakiAttribute PDC 属性(显式覆盖)。
es_skillEmakiSkills 技能附加;payload 使用 es_skills 列表。
lore_action对物品 Lore 的修改。
name_action对物品名称的修改。

当前效果语义边界:

  • variables 只提供文本、占位符和动作模板上下文,不会自动成为 Attribute PDC 属性。
  • 需要真实属性输出时,必须显式配置 type: "ea_attribute"ea_attributes
  • 技能附加使用 type: "es_skill",但具体技能 ID 写在 es_skills 列表中。

Lore 操作策略

强化配方中的 Lore 操作遵循以下策略,确保每种属性在 Lore 中始终只有一行:

场景操作说明
★1 首次添加action: "append"首次使用 append 添加属性行。
★2+ 更新已有行action: "replace_line"通过 anchor 匹配已有行并替换为新数值。
里程碑解锁新属性replace_lineappend先更新旧行,再 append 添加新属性行。

星级示例

yaml
stars:
  # ★1: 首次添加属性行
  1:
    effects:
      - type: "variables"
        variables:
          physical_attack: 4
      - type: "lore_action"
        lore_actions:
          - action: "append"
            content:
              - "<gray>物理伤害: <gold>+4</gold></gray>"
    materials:
      - item_sources:
          - "minecraft-copper_ingot"
        amount: 1
      - item_sources:
          - "minecraft-gunpowder"
        amount: 2

  # ★2: 使用 replace_line 更新已有行
  2:
    effects:
      - type: "variables"
        variables:
          physical_attack: 4
      - type: "lore_action"
        lore_actions:
          - action: "replace_line"
            anchor: "物理伤害:"
            content:
              - "<gray>物理伤害: <gold>+8</gold></gray>"
    materials:
      - item_sources:
          - "minecraft-copper_ingot"
        amount: 1

  # ★6 里程碑: 解锁新属性
  6:
    name: "觉醒"
    effects:
      - type: "variables"
        variables:
          physical_attack: 6
          physical_crit_rate: 3
      - type: "ea_attribute"
        ea_attributes:
          physical_attack: 28.0
          physical_crit_rate: 3.0
      - type: "es_skill"
        es_skills:
          - "weapon_aura"
      - type: "lore_action"
        lore_actions:
          # 先更新已有行
          - action: "replace_line"
            anchor: "物理伤害:"
            content:
              - "<gray>物理伤害: <gold>+28</gold></gray>"
          # 再添加新属性行
          - action: "append"
            content:
              - "<gray>暴击率: <gold>+3%</gold></gray>"
              - "<yellow>★ 觉醒: 解锁武器光环</yellow>"
    materials:
      - item_sources:
          - "minecraft-iron_ingot"
        amount: 3
    actions:
      success:
        - 'sendmessage text="<gold>★ 觉醒!装备提升至 +%star%!</gold>"'
        - "playsound sound=minecraft:entity.player.levelup volume=1 pitch=1.5"
      failure:
        - 'sendmessage text="<red>强化失败,装备等级下降至 +%star%。</red>"'

分支配方

强化配方支持分支树系统,允许在特定星级分叉为不同的强化路线。详见 分支树系统 文档。

完整示例

yaml
id: "weapon_physical"
display_name: "<gold>物理武器强化</gold>"
gui_template: "strengthen_gui"

economy:
  enabled: true
  currencies:
    - provider: "vault"
      currency_id: ""
      base_cost: 320
      cost_formula: "%base_cost% * %star%"
      display_name: "<gold>金币</gold>"

limits:
  max_star: 12
  max_temper: 4
  temper_chance_bonus_per_level: 5.0
  success_chance_cap: 90.0

success_rates:
  1: 100.0
  2: 100.0
  3: 95.0
  4: 85.0
  5: 75.0
  6: 60.0
  7: 45.0
  8: 32.0
  9: 22.0
  10: 14.0
  11: 8.0
  12: 4.0

match:
  slot_groups:
    - "weapon"

name_actions:
  - action: "append_suffix"
    value: " [+%star%]"

lore_actions:
  - action: "prepend"
    content:
      - "<gradient:#F2C46D:#C9703D>强化等级 +%star%</gradient>"
      - "<gray>锻印: %temper_color%%temper%/%max_temper%</gray>"

stars:
  1:
    effects:
      - type: "variables"
        variables:
          physical_attack: 4
      - type: "lore_action"
        lore_actions:
          - action: "append"
            content:
              - "<gray>物理伤害: <gold>+4</gold></gray>"
    materials:
      - item_sources:
          - "minecraft-copper_ingot"
        amount: 1
  2:
    effects:
      - type: "variables"
        variables:
          physical_attack: 4
      - type: "lore_action"
        lore_actions:
          - action: "replace_line"
            anchor: "物理伤害:"
            content:
              - "<gray>物理伤害: <gold>+8</gold></gray>"
    materials:
      - item_sources:
          - "minecraft-copper_ingot"
        amount: 2