Skip to content

EmakiAttribute

EmakiAttribute 负责真实属性、资源和战斗结算。它定义 RPG 属性、伤害类型和条件,并为其他模块提供 PDC 属性 API。装备属性应写入 Attribute payload,而不是只写在 Lore 里。

基本信息

项目
模块版本4.6.4
主命令/emakiattribute
别名/eattribute/ea
硬依赖EmakiCoreLib
软依赖MythicMobs、PlaceholderAPI、MMOItems
默认权限emakiattribute.useemakiattribute.points 默认 true;其余管理权限默认 op

它解决什么问题

当原版属性不足以表达 RPG 战斗时,可以用 EmakiAttribute 定义自己的属性和伤害逻辑,例如:

  • 物理攻击、法术攻击、投射物攻击。
  • 物理防御、法术防御、投射物防御。
  • 暴击率、暴击伤害、暴击抵抗。
  • 护甲穿透、法术穿透、真实伤害。
  • 生命、法力、生命恢复、法力恢复。
  • 闪避、吸血、攻速、移动速度、原版属性映射。

这些属性可以来自 Item、Forge、Strengthen、Gem、Skills 或其他模块写入的 PDC。Attribute 负责汇总和计算,而不是让其他插件各自重复实现一套数值系统。

默认配置目录

text
plugins/EmakiAttribute/
├── config.yml
├── attribute_balance.yml
├── attributes/
├── conditions/
├── damage_types/
├── lore_formats/
├── presets/
├── gui/
├── lang/
└── data/

目录说明:

目录 / 文件作用
attributes/每个属性的定义。
damage_types/伤害类型,例如 physical、projectile、spell。
conditions/属性读取条件(PDC 读取规则)定义。
lore_formats/属性在 Lore 中的展示格式。
attribute_balance.yml属性平衡语义与战力权重配置。
presets/属性预设定义。
gui/属性点 GUI 配置(attribute_points.yml)。
lang/语言文件(内置 zh_CN.ymlen_US.yml)。
data/运行时数据,例如 data/parent_attributes/<UUID>.yml

典型工作流

  1. attributes/ 中定义属性。
  2. lore_formats/ 中定义展示格式。
  3. damage_types/ 中定义伤害类型如何计算。
  4. 让 Item / Forge / Strengthen / Gem 等模块写入属性 payload。
  5. 玩家装备变化或执行同步后,Attribute 汇总属性。
  6. 战斗发生时,根据伤害类型、攻击方属性、防御方属性计算结果。
  7. 通过消息、ActionBar、PAPI 或 debug 输出结果。

与其他模块的关系

模块协作方式
EmakiItem自定义物品可以携带基础属性和套装属性。
EmakiForge锻造结果可写入额外属性。
EmakiStrengthen强化星级可增加属性。
EmakiGem宝石可提供属性。
EmakiSkills技能释放可读取或消耗 Attribute 资源,也可检查属性门槛。
MythicMobs可作为技能或怪物战斗生态的一部分。
PlaceholderAPI对外展示玩家属性、资源或战斗数据。

功能页面

页面内容
配置目录主配置、属性目录、伤害目录、条件目录和排查顺序。
属性定义属性字段、展示格式和属性 ID 设计。
属性衰减曲线高数值属性的阈值、曲线和调参建议。
伤害系统多阶段伤害管线、hard lock、命中反馈和恢复配置。
条件系统装备条件、属性条件与跨模块条件。
Lore 格式Lore 展示模板与读取正则。
命令与权限/ea 命令、lint、preview、dump、source、trace 和调试。
占位符PlaceholderAPI 输出与伤害消息模板变量。
MythicMobs 集成属性伤害 mechanic、临时属性 mechanic 与属性条件。
CoreLib 动作Attribute 注册的 Action ID 与参数。
APIEmakiAttributeApiPdcAttributeApi 与接入约定。
事件 API对外公开的 Bukkit 事件。
伤害事件 APIEmakiAttributeDamageEvent 详解。
JavaScript 脚本脚本模块门面与扩展注册 API。

建议配置顺序

  1. 先使用默认属性启动服务器,确认模块正常加载。
  2. 添加或修改一个属性文件,执行 reload / lint 检查。
  3. 让一个测试物品写入该属性。
  4. 使用 preview / dump 命令确认属性被读取。
  5. 再接入伤害类型和战斗测试。

config.yml 主要字段

字段类型默认值说明
languagestringzh_CN语言文件名(对应 lang/ 目录下的文件)。
release_default_databooleantrue是否释放内置示例属性、伤害类型、条件、词条格式与脚本示例。
hard_lock_damagebooleantrue全局硬锁定伤害。为 true 时所有匹配的伤害事件都走属性系统。
default_damage_typestringphysical默认伤害类型 ID。未匹配到特定类型时使用。
projectile_damage_typestringprojectile投射物命中时使用的伤害类型 ID。
vanilla_event_damage.enabledbooleantrue原版事件伤害完美接管;关闭时走兼容合成伤害模式。
vanilla_event_damage.damage_typestringdefault_damage_type未单独映射的原版伤害使用的伤害类型。
same_signature_ignores_invulnerability.enabledbooleantrue同批次同签名攻击是否互相无视原版受伤间隔。
same_signature_ignores_invulnerability.window_mslong500同批次判定时间窗,单位毫秒。
regen_interval_ticksinteger20资源回复计算间隔(tick)。最小值 1。20 tick = 1 秒。
sync_delay_ticksinteger1属性同步延迟(tick)。装备变化后等待多少 tick 再同步。最小值 0。
health_display_scaling.enabledbooleanfalse是否压缩客户端血条显示;不改变真实生命与伤害结算。
health_display_scaling.targetdouble20.0客户端显示的目标血量。
synthetic_hit_feedback.knockbackbooleantrue兼容模式下合成伤害是否补发击退。
synthetic_hit_feedback.knockback_strengthdouble0.4击退强度。
synthetic_hit_feedback.hurt_soundbooleantrue兼容模式下合成伤害是否播放受伤音效。

资源配置

default_profile.resources 定义玩家默认资源:

字段类型默认值说明
idstring同小节 key资源 ID(如 healthmana);内置配置用小节 key 表示。
display_namestringid显示名称。
default_maxdouble0默认最大值。
min_maxdouble0最大值下限(属性加成后不低于此值)。
max_maxdouble极大值最大值上限。
sync_to_bukkitbooleanfalse是否同步到 Bukkit 原版生命值(仅 health 资源需要)。
full_on_initbooleantrue初始化时是否填满资源。
regen_per_seconddouble0每秒自然回复量。

内置默认资源:

  • health:默认最大 20,同步到 Bukkit,最小上限 1,最大上限 2048。
  • mana:默认最大 100,不同步到 Bukkit,最小上限 0,最大上限 99999。

Attribute 注册的动作

EmakiAttribute 会向 CoreLib 动作系统注册属性伤害、临时属性、资源、标签和同步动作。完整 Action ID、参数和示例已拆分到 CoreLib 动作

常用示例:

yaml
actions:
  - 'attributedamage amount=50 type=physical'
  - 'attribute_add effect_id=forge_buff attribute=physical_attack value=20 duration_ticks=10s'
  - 'attribute_resource_consume resource=mana amount=20'
  - 'attribute_sync all=false'