Skip to content

这页专门回答一个问题:

HNAttribute 现在给 MythicMobs 额外注册了哪些内部占位符,分别怎么写、读谁、返回什么?

如果你现在是在写:

  • conditions
  • skills
  • Mythic 技能里的占位符表达式
  • Buff / 周期实例联动

那这页就是最快入口。


一、先记住三套前缀

当前 HNAttribute 会向 MythicMobs 注册三组内部占位符:

text
<buff.XXX.YYY>
<periodic.XXX.YYY>
<attr.属性ID>

分别代表:

  • buff:读 Buff 运行时
  • periodic:读周期实例运行时
  • attr:读任意实体(玩家或怪物)的当前属性值

二、属性占位符(attr)

基础格式

text
<attr.属性ID>

例如:

text
<attr.attack_damage>
<attr.max_health>
<attr.fire_damage>

它读的是谁

buff / periodic 一样,优先读 trigger,没有时回退到 caster

也就是说:

  • 怪物技能里写 <attr.attack_damage>,读的是怪物自己的攻击力
  • 如果技能链里有 @trigger,读的是触发者(通常是玩家)的攻击力

返回值

  • 整数值返回不带小数点,例如 100
  • 浮点值保留两位小数,例如 15.50
  • 属性不存在或实体为空时返回 0

最常见的用法

1)在怪物技能里根据自身属性做判断

yaml
SkillCheck:
  Conditions:
  - attr{a=attack_damage;value=50;operator=>=}  # 用 hna-attribute condition
  Skills:
  - message{m="我的攻击力是 <attr.attack_damage>"} @self

2)在伤害公式里引用怪物属性

yaml
# 怪物技能:造成自身攻击力 150% 的伤害
- hna-damage{a=<attr.attack_damage>*1.5} @target

3)在 Mythic 条件里做属性门控

yaml
# 只有攻击力 >= 100 时才释放技能
Conditions:
- attr{a=attack_damage;value=100;operator=>=}

注意:上面的 attr condition 是 hna-attribute 条件的功能,和 <attr.xxx> 占位符是两回事。占位符用于文本替换,condition 用于逻辑判断。

和 PlaceholderAPI 的区别

<attr.attack_damage>%hnattr_attack_damage%
系统MythicMobs 内部占位符PlaceholderAPI
能读谁任意实体(玩家、怪物)仅玩家
用在哪Mythic 技能 / 条件 / 配置计分板、聊天、其他 PAPI 插件

三、Buff 内部占位符

基础格式

text
<buff.<BuffKey>.<Field>>

例如:

text
<buff.力量提升.time>
<buff.力量提升.level>
<buff.力量提升.has>

字段表格

占位符含义返回类型
<buff.力量提升.time>剩余 tick数字字符串
<buff.力量提升.ticks>time 同义写法数字字符串
<buff.力量提升.remaining>time 同义写法数字字符串
<buff.力量提升.level>Buff 等级数字字符串
<buff.力量提升.lv>level 同义写法数字字符串
<buff.力量提升.amplifier>level 同义写法数字字符串
<buff.力量提升.has>是否存在该 Buff1 / 0
<buff.力量提升.active>has 同义写法1 / 0

你最常用的 3 条

text
<buff.力量提升.has>
<buff.力量提升.time>
<buff.力量提升.level>

四、Periodic 内部占位符

基础格式

text
<periodic.<Key>.<Field>>

例如:

text
<periodic.burn-dot.has>
<periodic.burn-dot.stacks>
<periodic.burn-dot.remaining>

字段表格

占位符含义返回类型
<periodic.burn-dot.has>是否存在该周期实例1 / 0
<periodic.burn-dot.active>has 同义写法1 / 0
<periodic.burn-dot.stacks>当前实例 stacks数字字符串
<periodic.burn-dot.remaining>估算剩余总 tick数字字符串
<periodic.burn-dot.ticks>距离下一跳还剩多少 tick数字字符串
<periodic.burn-dot.runs>已完成次数数字字符串
<periodic.burn-dot.total>总 repeat 次数数字字符串

remaining 是怎么算的

当前实现里:

text
remaining = ticksUntilNext * (totalRepeats - completedRuns)

所以它表达的是一种剩余总 tick 的近似值,不是“剩余层数”也不是“剩余秒数格式化文本”。


五、这些占位符到底读谁

这一点非常重要。

当前实现会按这个顺序找上下文实体:

  1. 先读 trigger
  2. 如果没有可用 trigger,再读 caster

也就是说:

  • 如果当前技能链里有 trigger,大多数情况下占位符会先读 trigger
  • 没有 trigger 时,才会回退去读 caster

一句话理解:

Mythic 内部占位符不是固定永远读施法者,而是优先读 trigger。

这也是很多人明明写对了占位符,却感觉“为什么读的不是我想的那个实体”的常见原因。


六、返回规则

当前实现整体比较保守:

情况返回结果
参数为空 / 语法不完整0
上下文实体解析失败0
Buff / 周期实例不存在多数情况返回 0
has / active 命中1
数值型字段命中对应数字字符串

所以你在 Mythic 里最稳的判断方式通常是:

text
<buff.力量提升.has>
<periodic.burn-dot.has>

把它们当 1 / 0 使用。


七、最常见的写法示例

1)判断某 Buff 是否存在

text
<buff.力量提升.has>

2)读某 Buff 剩余时间

text
<buff.力量提升.remaining>

3)判断某 DOT 是否存在

text
<periodic.burn-dot.has>

4)读某 DOT 当前 stacks

text
<periodic.burn-dot.stacks>

5)读某 DOT 距离下一跳剩余 tick

text
<periodic.burn-dot.ticks>

八、最容易踩坑的地方

1)把这套语法和 PlaceholderAPI 搞混

这页说的是 MythicMobs 内部占位符:

text
<buff.力量提升.time>
<periodic.burn-dot.has>

它不是 PlaceholderAPI 的:

text
%hnattr_attack_damage%

如果你要查 PAPI,请直接看:


2)以为 periodic 的 key 支持模糊匹配

当前内部占位符这里走的是:

text
getInstanceView(null, targetId, key)

也就是说这里更适合写明确 key,例如:

text
<periodic.burn-dot.has>

不要默认把它当成和 hna-hasot{key="burn-*"} 一样的通配逻辑。


3)以为 remaining 是“剩余层数”

不是。

当前 periodic.xxx.remaining 表示的是:

  • 估算剩余总 tick

不是:

  • 剩余 repeats
  • 剩余 stacks
  • 剩余秒数字符串

如果你想看 stacks,请直接读:

text
<periodic.burn-dot.stacks>

九、和 HNAttribute 命令怎么配合排查

如果 Mythic 里占位符体感不对,最稳的排查顺序是:

Buff 线

text
/hnattr buffs
/hnattr source

Periodic 线

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

先确认 HNAttribute runtime 里真的有这个东西,再回头看 Mythic 占位符。


十、最短索引

你只想记最关键的几个

text
<attr.attack_damage>
<attr.max_health>
<buff.力量提升.has>
<buff.力量提升.time>
<buff.力量提升.level>
<periodic.burn-dot.has>
<periodic.burn-dot.stacks>
<periodic.burn-dot.remaining>

十一、这一页最该记住的重点

  1. MythicMobs 内部占位符当前有三组:attrbuffperiodic
  2. attr 可以读任意实体(包括怪物)的属性值,这是当前唯一能在服内查看怪物属性的方式
  3. buff 适合读 Buff 的存在、剩余 tick、等级
  4. periodic 适合读实例是否存在、stacks、ticks、remaining、runs、total
  5. 当前上下文实体优先读 trigger,没有时才回退到 caster
  6. 这套语法和 PlaceholderAPI 不是一回事
  7. 占位符体感不对时,先回 HNAttribute 的运行时命令确认状态

HN 系列插件文档