Skip to content

CoreLib 动作

EmakiAttribute 启用后会向 CoreLib 动作注册表追加属性、资源、标签和同步相关动作。它们可以写在支持 CoreLib Action 的配置节点中,例如 Forge/Strengthen/Cooking/Skills/Item 的动作列表、CoreLib 动作模板,或由其他插件通过 CoreLib ActionExecutor 触发。

本页只记录 EmakiAttribute 注册的 CoreLib 动作;CoreLib 自带的消息、命令、经济、物品、脚本等通用动作见 CoreLib 动作系统。当前 Action ID 只使用下表中的规范名,不再提供历史别名入口。

动作 ID 速查

动作 ID用途需要玩家上下文
attributedamage对当前玩家造成一次 Attribute 自定义伤害。
attribute_add给当前玩家添加临时属性值。
attribute_set设置当前玩家的临时属性值。
attribute_remove移除当前玩家指定 effect_id 的临时属性。
attribute_resource_consume消耗当前玩家指定资源。
attribute_resource_add增加当前玩家指定资源当前值。
attribute_resource_set设置当前玩家指定资源当前值。
attribute_resource_remove扣除当前玩家指定资源当前值。
attribute_tag_add按属性标签批量添加临时属性。
attribute_tag_remove按属性标签移除临时属性。
attribute_tag_clear按属性标签清理临时属性。
attribute_sync同步当前玩家或全部在线玩家属性/资源状态。all=false 时是
attribute_refresh刷新 Attribute 缓存,并同步当前玩家或全部在线玩家。all=false 时是

attributedamage

对当前动作上下文中的玩家造成一次 Attribute 伤害。伤害类型为空时使用 EmakiAttribute 的默认伤害类型。

参数类型必填默认值说明
amountDOUBLE基础伤害值。
typeSTRING""伤害类型 ID;留空使用默认伤害类型。
causeSTRINGCUSTOMBukkit EntityDamageEvent.DamageCause,如 CUSTOMMAGICENTITY_ATTACK
yaml
actions:
  - 'attributedamage amount=25 type=physical cause=CUSTOM'

临时属性动作

临时属性按 effect_id 标识。重复写入同一个 effect_id 时,会命中同一条临时属性记录;具体加算或覆盖行为由属性定义的 temporary_stack_mode 和动作实现决定。

attribute_add

给当前玩家添加临时属性值。

参数类型必填默认值说明
effect_idSTRING临时效果 ID。
attributeSTRING属性 ID。
valueDOUBLE临时属性值。
duration_ticksTIME持续时间,必须大于 0;支持 CoreLib 时间写法。
yaml
actions:
  - 'attribute_add effect_id=forge_bonus attribute=physical_attack value=12 duration_ticks=10s'

attribute_set

设置当前玩家的临时属性值。参数与 attribute_add 相同。

yaml
actions:
  - 'attribute_set effect_id=arena_buff attribute=physical_attack value=30 duration_ticks=200t'

attribute_remove

移除当前玩家指定 effect_id 的临时属性。

参数类型必填默认值说明
effect_idSTRING要移除的临时效果 ID。
yaml
actions:
  - 'attribute_remove effect_id=arena_buff'

资源动作

资源动作会通过 EmakiAttribute 的资源同步边界修改玩家资源当前值;resource 必须是已加载的资源 ID。

动作 IDamount 要求说明
attribute_resource_consume> 0消耗资源,最低扣到 0。
attribute_resource_add> 0增加资源当前值,并按资源同步规则截断。
attribute_resource_set>= 0设置资源当前值。
attribute_resource_remove> 0扣除资源,最低扣到 0。
参数类型必填默认值说明
resourceSTRING资源 ID,如 healthmana
amountDOUBLE操作数量。
yaml
actions:
  - 'attribute_resource_consume resource=mana amount=20'
  - 'attribute_resource_add resource=mana amount=10'
  - 'attribute_resource_set resource=stamina amount=100'
  - 'attribute_resource_remove resource=rage amount=5'

标签临时属性动作

attribute_tag_add 会对所有带指定标签的属性添加临时值;attribute_tag_removeattribute_tag_clear 会移除这些标签属性对应的临时属性。

attribute_tag_add

参数类型必填默认值说明
tagSTRING属性标签,不区分大小写。
valueDOUBLE对每个命中属性施加的临时值。
duration_ticksTIME持续时间,必须大于 0。
effect_prefixSTRING""临时效果 ID 前缀;为空时使用默认生成规则。
stack_modeSTRING""可选临时叠加模式,如 REPLACESTACK
yaml
actions:
  - 'attribute_tag_add tag=DEBUFF value=-5 duration_ticks=5s effect_prefix=poison stack_mode=REPLACE'

attribute_tag_remove / attribute_tag_clear

参数类型必填默认值说明
tagSTRING要移除临时属性的属性标签。
yaml
actions:
  - 'attribute_tag_remove tag=DEBUFF'
  - 'attribute_tag_clear tag=BUFF'

同步动作

attribute_sync

同步当前玩家或全部在线玩家的属性/资源状态。

参数类型必填默认值说明
allBOOLEANfalse是否同步全部在线玩家。false 时需要玩家上下文。

attribute_refresh

先刷新 Attribute 缓存,再同步玩家。

参数类型必填默认值说明
allBOOLEANtrue是否同步全部在线玩家。false 时只同步当前玩家,需要玩家上下文。
yaml
actions:
  - 'attribute_sync all=false'
  - 'attribute_refresh all=true'

使用提示

  • attribute_sync all=trueattribute_refresh all=true 外,本页动作都需要玩家上下文。
  • 如果需要让 MythicMobs 技能直接对目标生物添加或清除临时属性,请使用 MythicMobs 集成 中的 emaki_attribute_addemaki_attribute_removeemaki_attribute_add_tagemaki_attribute_clear_tag
  • duration_ticks 使用 CoreLib TIME 解析,20t1s1000ms 都可用;纯数字按 tick 处理。