EmakiAttribute
EmakiAttribute 负责真实属性、资源和战斗结算。它定义 RPG 属性、伤害类型和条件,并为其他模块提供 PDC 属性 API。装备属性应写入 Attribute payload,而不是只写在 Lore 里。
基本信息
| 项目 | 值 |
|---|---|
| 模块版本 | 4.6.4 |
| 主命令 | /emakiattribute |
| 别名 | /eattribute、/ea |
| 硬依赖 | EmakiCoreLib |
| 软依赖 | MythicMobs、PlaceholderAPI、MMOItems |
| 默认权限 | emakiattribute.use、emakiattribute.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.yml、en_US.yml)。 |
data/ | 运行时数据,例如 data/parent_attributes/<UUID>.yml。 |
典型工作流
- 在
attributes/中定义属性。 - 在
lore_formats/中定义展示格式。 - 在
damage_types/中定义伤害类型如何计算。 - 让 Item / Forge / Strengthen / Gem 等模块写入属性 payload。
- 玩家装备变化或执行同步后,Attribute 汇总属性。
- 战斗发生时,根据伤害类型、攻击方属性、防御方属性计算结果。
- 通过消息、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 与参数。 |
| API | EmakiAttributeApi、PdcAttributeApi 与接入约定。 |
| 事件 API | 对外公开的 Bukkit 事件。 |
| 伤害事件 API | EmakiAttributeDamageEvent 详解。 |
| JavaScript 脚本 | 脚本模块门面与扩展注册 API。 |
建议配置顺序
- 先使用默认属性启动服务器,确认模块正常加载。
- 添加或修改一个属性文件,执行 reload / lint 检查。
- 让一个测试物品写入该属性。
- 使用 preview / dump 命令确认属性被读取。
- 再接入伤害类型和战斗测试。
config.yml 主要字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
language | string | zh_CN | 语言文件名(对应 lang/ 目录下的文件)。 |
release_default_data | boolean | true | 是否释放内置示例属性、伤害类型、条件、词条格式与脚本示例。 |
hard_lock_damage | boolean | true | 全局硬锁定伤害。为 true 时所有匹配的伤害事件都走属性系统。 |
default_damage_type | string | physical | 默认伤害类型 ID。未匹配到特定类型时使用。 |
projectile_damage_type | string | projectile | 投射物命中时使用的伤害类型 ID。 |
vanilla_event_damage.enabled | boolean | true | 原版事件伤害完美接管;关闭时走兼容合成伤害模式。 |
vanilla_event_damage.damage_type | string | 同 default_damage_type | 未单独映射的原版伤害使用的伤害类型。 |
same_signature_ignores_invulnerability.enabled | boolean | true | 同批次同签名攻击是否互相无视原版受伤间隔。 |
same_signature_ignores_invulnerability.window_ms | long | 500 | 同批次判定时间窗,单位毫秒。 |
regen_interval_ticks | integer | 20 | 资源回复计算间隔(tick)。最小值 1。20 tick = 1 秒。 |
sync_delay_ticks | integer | 1 | 属性同步延迟(tick)。装备变化后等待多少 tick 再同步。最小值 0。 |
health_display_scaling.enabled | boolean | false | 是否压缩客户端血条显示;不改变真实生命与伤害结算。 |
health_display_scaling.target | double | 20.0 | 客户端显示的目标血量。 |
synthetic_hit_feedback.knockback | boolean | true | 兼容模式下合成伤害是否补发击退。 |
synthetic_hit_feedback.knockback_strength | double | 0.4 | 击退强度。 |
synthetic_hit_feedback.hurt_sound | boolean | true | 兼容模式下合成伤害是否播放受伤音效。 |
资源配置
default_profile.resources 定义玩家默认资源:
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | string | 同小节 key | 资源 ID(如 health、mana);内置配置用小节 key 表示。 |
display_name | string | 同 id | 显示名称。 |
default_max | double | 0 | 默认最大值。 |
min_max | double | 0 | 最大值下限(属性加成后不低于此值)。 |
max_max | double | 极大值 | 最大值上限。 |
sync_to_bukkit | boolean | false | 是否同步到 Bukkit 原版生命值(仅 health 资源需要)。 |
full_on_init | boolean | true | 初始化时是否填满资源。 |
regen_per_second | double | 0 | 每秒自然回复量。 |
内置默认资源:
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'