主题
这页带你从零开始配置周期伤害 (DOT) 和周期治疗 (HOT) 效果,并验证它们能正常工作。
一、准备工作
确认文件位置
周期效果配置文件位于:
text
plugins/HNAttribute/periodic/目录结构:
text
plugins/HNAttribute/periodic/settings.yml # 全局设置
plugins/HNAttribute/periodic/*.yml # 具体效果定义理解周期效果的两种模式
- direct: 简单周期动作,定时扫描并执行
- instance: 真正的状态实例,可追踪、可调试
选择建议:
- 简单周期回血/掉血 →
direct - DOT / HOT / 状态玩法 →
instance
二、第一步:配置简单周期回血 (direct)
打开或创建 periodic/custom.yml,添加:
yml
简单回血: # 周期效果的唯一标识符
enabled: true # 是否启用此效果
selector: players # 选择器: players(玩家), mobs(怪物), all(所有实体)
interval: 20 # 扫描间隔 (tick), 20 tick = 1 秒
condition: "target_health < target_max_health && target_health_regen > 0"
# 触发条件: 未满血且有生命恢复属性
actions: # 执行的动作列表
- type: heal # 动作类型: heal(治疗), damage(伤害), buff(施加Buff)
amount: "target_health_regen" # 数值: 使用目标的生命恢复属性值这段配置的含义
- enabled: 启用此效果
- selector: 选择玩家
- interval: 每 20 tick (1 秒) 扫描一次
- condition: 条件为"未满血且生命恢复 > 0"
- actions: 执行治疗动作,数值为
health_regen属性值
验证步骤
text
/hnattr reload给自己装备一件带"生命恢复: 5"的物品,受伤后观察是否回血。
三、第二步:配置中毒 DOT (instance)
现在配置一个真正的 DOT 效果:
yml
中毒: # DOT 效果示例
enabled: true # 启用此效果
mode: instance # 模式: direct(直接执行), instance(实例模式,可叠加)
selector: mobs # 选择怪物
interval: 40 # 扫描间隔 40 tick (2 秒)
tags: [poison, dot] # 标签,用于分类和查询
condition: "target_health > 3" # 创建实例的条件: 目标血量 > 3
instance: # 实例配置
source: nearest-player # 来源: nearest-player(最近玩家), self(自己), custom(自定义)
interval: 20 # 实例执行间隔 20 tick (1 秒)
duration: 100 # 实例持续时间 100 tick (5 秒)
reapply-mode: refresh # 重施策略: refresh(刷新), stack(叠加), ignore(忽略)
tick-condition: "target_health > 1" # 每次执行前的条件检查: 血量 > 1
fail-policy: cancel # 条件失败时的策略: cancel(取消实例), skip(跳过本次)
actions: # 执行的动作
- type: damage # 造成伤害
amount: 1.5 # 固定伤害值 1.5这段配置的含义
顶层字段
- mode:
instance- 使用实例模式 - selector:
mobs- 选择怪物 - interval:
40- 每 40 tick 扫描一次 - tags:
[poison, dot]- 标签 - condition: 目标血量 > 3 时才创建实例
instance 字段
- source:
nearest-player- 来源为最近的玩家 - interval:
20- 实例每 20 tick 跳一次 - duration:
100- 持续 100 tick (5 秒) - reapply-mode:
refresh- 重复施加时刷新 - tick-condition: 每跳前检查血量 > 1
- fail-policy:
cancel- 条件失败时取消实例
actions 字段
- type:
damage- 造成伤害 - amount:
1.5- 每次 1.5 点伤害
验证步骤
text
/hnattr reload
/hnattr periodic list
/hnattr periodic inspect 中毒四、第三步:配置持续治疗 HOT (instance)
yml
持续治疗:
enabled: true
mode: instance
selector: players
interval: 40
tags: [hot, regen]
condition:
mode: expression
script: target_health < target_max_health
instance:
source: self
interval: 20
duration: 100
reapply-mode: refresh
tick-condition:
mode: expression
script: target_health < target_max_health
fail-policy: cancel
actions:
- type: heal
amount: 2与 DOT 的区别
- actions.type:
heal而不是damage - source:
self- 来源为自己 - condition: 未满血时才创建实例
五、重施策略详解
refresh (推荐)
重复施加时刷新持续时间。
适合:
- 中毒刷新
- HOT 刷新
- 大多数传统状态技能
stack
在层数上限内叠层。
适合:
- 流血层数
- 灼烧层数
- 可见层数玩法
示例:
yml
流血:
enabled: true
mode: instance
selector: mobs
interval: 20
tags: [bleed, stack]
condition:
mode: expression
script: target_health > 5
instance:
source: nearest-player
interval: 20
duration: 80
reapply-mode: stack
max-stacks: 5
tick-condition:
mode: expression
script: target_health > 1
fail-policy: cancel
actions:
- type: damage
amount: 1merge
把数值和次数一起合并。
适合:
- 想让重复命中越来越痛
- 希望持续时间也叠加的效果
ignore
已有实例就跳过。
适合:
- 同 key 只允许存在一个实例的玩法
六、生命周期钩子
instance 模式支持生命周期钩子:
on-apply
实例创建时触发一次。
yml
中毒强化:
enabled: true
mode: instance
selector: mobs
interval: 40
condition:
mode: expression
script: target_health > 4
instance:
source: nearest-player
interval: 20
duration: 80
reapply-mode: refresh
on-apply:
- type: damage
amount: 2
actions:
- type: damage
amount: 1on-expire
实例自然到期时触发。
yml
蓄积爆发:
enabled: true
mode: instance
selector: players
interval: 40
condition:
mode: expression
script: target_health < target_max_health
instance:
source: self
interval: 20
duration: 80
reapply-mode: refresh
fail-policy: cancel
on-expire:
- type: heal
amount: 6
actions:
- type: heal
amount: 1on-cancel
实例被取消时触发。
on-skip
某一跳被跳过时触发。
七、调试周期效果
查看所有实例
text
/hnattr periodic list
/hnattr periodic list all
/hnattr periodic list <玩家名>查看实例详情
text
/hnattr periodic inspect <key>打开调试
text
/hnattr periodic debug detail <key>清理实例
text
/hnattr periodic clear <玩家名> <key>
/hnattr periodic clearall八、常见问题
效果没有触发
检查:
- 文件是否保存在
periodic/目录 enabled: true是否设置- 是否执行了
/hnattr reload condition是否满足
instance 没有创建
检查:
/hnattr periodic list是否显示实例selector是否正确condition是否满足interval是否太长
实例创建了但不跳动
检查:
instance.interval是否设置tick-condition是否满足fail-policy是否为cancel- 用
/hnattr periodic inspect <key>查看详情
数值不对
检查:
actions.amount是否正确- 公式是否正确
- 用
/hnattr periodic debug detail <key>查看详细日志
九、与 MythicMobs 集成
施加 DOT
text
hna-dot{amount=2;duration=60;interval=20;mode=refresh;key="burn-dot"} @target施加 HOT
text
hna-hot{amount=2;duration=60;interval=20;mode=refresh;key="regen-hot"} @target触发额外一跳
text
hna-triggerdot{key="burn-dot"} @target提前引爆
text
hna-detonatedot{key="burn-dot";stacks=3;consume=true} @target更多 MythicMobs 集成方法,参见:
十、下一步
现在你已经学会了如何配置周期效果,可以继续学习:
- 周期效果 Cookbook - 更多周期效果配方
- DOT/HOT/周期实例配置速查 - 快速查阅字段说明
- 周期效果 (DOT/HOT) - 核心概念详解
