Skip to content

这一页的目标很简单:

从 0 做出一条完整的、能在服里实际测试的 RPG 数值链路。

我们会一步一步做出这套东西:

  1. 一件武器
  2. 一个 Buff
  3. 一个 DOT
  4. 一个 Mythic 技能入口
  5. 一整条验证命令

做完以后,你会得到一个最小但完整的样例:

  • 装备加攻击
  • Buff 再强化攻击
  • 攻击附带持续伤害
  • 周期实例可 inspect / debug

一、目标效果

我们最终想做成这样:

  • 玩家装备“灼炎长剑”
  • 这把武器提供:
    • 攻击力
    • 火焰伤害
  • 玩家还能获得一个 Buff:战意高涨
    • 进一步提高攻击力和暴击率
  • 当技能命中目标时,给目标挂一个灼烧 DOT
  • 灼烧 DOT 可以在 /hnattr periodic 里看到运行状态

二、第 1 步:先做一把测试武器

先做一件武器,Lore 写成:

text
攻击力: 120
火焰伤害: 25
暴击率: 8

装备后先验证

text
/hnattr inspect
/hnattr lookup
/hnattr trace attack_damage
/hnattr trace fire_damage

如果这一步不通,不要继续往下配。


三、第 2 步:加一个自定义 Buff 模板

打开任意 buffs/*.yml,例如新建:

text
plugins/HNAttribute/buffs/tutorial.yml

写入:

yml
战意高涨:
  display: "&c战意高涨"
  default-time: 120
  reapply-mode: REFRESH
  attributes:
    attack_damage:
      operation: ADD
      formula:
        mode: expression
        script: "15 + level * 10"
    crit_chance:
      operation: ADD
      formula:
        mode: expression
        script: "3 + level * 2"

重载并验证

text
/hnattr reload
/hnattr buff list 战意
/hnattr buff apply 战意高涨 120 1
/hnattr buffs
/hnattr trace attack_damage
/hnattr trace crit_chance

你应该能看到:

  • buff:战意高涨
  • 攻击力上升
  • 暴击率上升

四、第 3 步:加一个声明式灼烧 DOT

新建:

text
plugins/HNAttribute/periodic/tutorial.yml

在文件顶层新增(也可以放在 effects: 节点下):

yml
tutorial-burn-dot:
  enabled: true
  mode: instance
  selector: mobs
  interval: 40
  tags: [tutorial, burn]
  condition:
    mode: expression
    script: target_health > 2
  instance:
    source: nearest-player
    interval: 20
    duration: 80
    reapply-mode: refresh
    max-stacks: 3
    tick-condition:
      mode: expression
      script: target_health > 1
    fail-policy: cancel
  actions:
    - type: damage
      amount: 2

这段配置意味着什么

  • 每 40 tick 扫描怪物
  • 给符合条件的怪物挂一个灼烧实例
  • 实例每 20 tick 造成 2 点伤害
  • 持续 80 tick
  • 最多叠到 3 层

重载并验证

text
/hnattr reload
/hnattr periodic list all

然后继续:

text
/hnattr periodic inspect tutorial-burn-dot
/hnattr periodic debug detail tutorial-burn-dot

如果你附近有怪,就能看到实例被创建、跳动、取消或到期。


五、第 4 步:如果有 MythicMobs,再接一个技能入口

如果服务器装了 MythicMobs,你可以再做一个最短技能:

text
hna-dot{amount=3;duration=60;interval=20;mode=refresh;key="tutorial-skill-burn";damage-type="fire";tags="tutorial,skill"} @target

你可以怎么理解它

  • 每跳伤害:3
  • 持续时间:60 tick
  • 间隔:20 tick
  • key:tutorial-skill-burn
  • 类型:火焰 DOT

触发后这样验证

text
/hnattr periodic list all
/hnattr periodic inspect tutorial-skill-burn
/hnattr periodic debug detail tutorial-skill-burn

六、第 5 步:把整条链路串起来测

现在你可以按下面顺序实际测试:

1)装备武器

确认:

text
/hnattr inspect
/hnattr lookup

2)施加 Buff

text
/hnattr buff apply 战意高涨 120 1
/hnattr buffs

3)看属性来源是否已经叠加

text
/hnattr source
/hnattr trace attack_damage

4)触发 DOT

  • 如果你用声明式实例,就靠环境扫描触发
  • 如果你用 Mythic 技能,就实际施法一次

5)看周期实例是否真的跑起来

text
/hnattr periodic list all
/hnattr periodic inspect tutorial-burn-dot

七、你实际会看到的系统分层

做完这一整套以后,你就会真的理解这几个层:

装备层

提供基础属性:

  • attack_damage
  • fire_damage
  • crit_chance

Buff 层

进一步追加来源:

  • buff:战意高涨

周期层

再额外创建一个运行中的 DOT 实例:

  • tutorial-burn-dot
  • tutorial-skill-burn

调试层

可以分别查:

text
/hnattr inspect
/hnattr source
/hnattr trace attack_damage
/hnattr buffs
/hnattr periodic inspect tutorial-burn-dot

这就是 HNAttribute 当前最大的价值:

装备、Buff、技能 DOT 并不是三套散装系统,而是能被统一查看、统一排查、统一解释。


八、如果哪一步不通,最该先看哪里

装备不通

看:

text
/hnattr inspect

Buff 不通

看:

text
/hnattr buff list
/hnattr buffs
/hnattr trace <属性ID>

DOT 不通

看:

text
/hnattr periodic list
/hnattr periodic inspect <key>
/hnattr periodic debug detail <key>

九、下一步你可以怎么扩

这个完整样例跑通之后,你就可以很自然地继续扩:

  • 把 Buff 改成防御型或治疗型
  • 把 DOT 改成 HOT
  • 给实例加 on-expire 爆发
  • 改成 stackmerge
  • source 改成 owner
  • 用不同 damage-type 区分元素伤害

如果你接下来最想学的是“常用 DOT/HOT 模板怎么写”,下一页建议直接看:

HN 系列插件文档