Skip to content

概述

damage-modifiers 允许你在怪物配置中直接设置按伤害类型的最终受伤倍率,无需修改属性值。

基本语法

yaml
damage-modifiers:
  <伤害类型>: <倍率>

倍率说明

  • 1.0 = 正常伤害(100%)
  • 0.8 = 减少 20% 伤害(80%)
  • 1.5 = 增加 50% 伤害(150%)
  • 0.5 = 减少 50% 伤害(50%)
  • 0.0 = 完全免疫

基本示例

yaml
ElementDummy:
  Type: ZOMBIE
  Attribute:
    - "攻击力: 100"
    - "火焰抗性: 20"
  damage-modifiers:
    physical: 0.8    # 物理伤害只吃 80%
    fire: 1.5        # 火焰伤害吃 150%
    ice: 0.5         # 冰霜伤害只吃 50%

与抗性属性的区别

抗性属性(fire_resistance

  • 属于 HNAttribute 战斗管线的属性层
  • 参与公式计算
  • 可以被 Buff 修改
  • 可以被装备影响

伤害倍率(damage-modifiers

  • 属于怪物配置的最终倍率层
  • 在战斗管线之后应用
  • 固定值,不受 Buff 影响
  • 只在怪物配置中生效

结算顺序

text
1. 战斗管线计算(包括抗性属性)

2. 得出基础伤害

3. 应用 damage-modifiers 倍率

4. 最终伤害

适用场景

1. 怪物模板级弱点/抗性

yaml
FireElemental:
  Type: BLAZE
  damage-modifiers:
    fire: 0.0      # 完全免疫火焰
    ice: 2.0       # 冰霜伤害双倍

2. Boss 阶段性弱点

yaml
DragonBoss:
  Type: ENDER_DRAGON
  damage-modifiers:
    physical: 0.5
    magic: 1.0
  Skills:
  - skill{s=PhaseTwo} @self ~onTimer:100
  
PhaseTwo:
  Skills:
  # 第二阶段改变弱点
  - modifydamagemodifier{type=physical;value=1.0} @self
  - modifydamagemodifier{type=magic;value=0.5} @self

3. 快速配置不想加属性

yaml
SimpleZombie:
  Type: ZOMBIE
  # 不想配置一堆抗性属性,直接用倍率
  damage-modifiers:
    physical: 0.9
    fire: 1.2

作用范围

只要伤害明确标记了 damage-type,就会应用对应倍率:

  • hna-damage{dt=fire}
  • damage-type=fire 的 DOT ✓
  • 战斗管线产生的火焰伤害 ✓
  • 普通攻击(如果走了火焰通道)✓

完整示例

yaml
IceGolem:
  Type: SNOW_GOLEM
  Display: '&b冰霜魔像'
  Health: 800
  Attribute:
    - "攻击力: 80"
    - "冰霜伤害: 40"
    - "冰霜抗性: 30"
  damage-modifiers:
    physical: 0.7    # 物理抗性高
    fire: 2.0        # 火焰弱点
    ice: 0.0         # 完全免疫冰霜
    lightning: 1.5   # 雷电弱点

调试方法

text
/hnattr inspect
/hnattr source

注意事项

  1. 伤害类型名必须与 damage_types/*.yml 中定义的类型 ID 匹配
  2. 倍率为 0.0 时完全免疫该类型伤害
  3. 倍率可以大于 1.0,表示该类型伤害增强
  4. 不会影响治疗效果

相关文档

HN 系列插件文档