EmakiAttribute
EmakiAttribute 负责真实属性和战斗计算。它定义 RPG 属性、资源、伤害类型和条件,并向其他模块提供 PDC 属性 API。装备属性应写入 Attribute payload,而不是只写在 Lore 里。
基本信息
| 项目 | 值 |
|---|---|
| 模块版本 | 4.1.0 |
| 主命令 | /emakiattribute |
| 别名 | /eattribute、/ea |
| 硬依赖 | EmakiCoreLib |
| 软依赖 | MythicMobs、PlaceholderAPI、MMOItems |
| 默认权限 | emakiattribute.use 默认 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/
├── profiles/
└── lang/目录说明:
| 目录 / 文件 | 作用 |
|---|---|
attributes/ | 每个属性的定义。 |
damage_types/ | 伤害类型,例如 physical、projectile、spell。 |
conditions/ | 条件定义,可供其他模块引用。 |
lore_formats/ | 属性在 Lore 中的展示格式。 |
attribute_balance.yml | 属性平衡或全局数值配置。 |
profiles/ | 玩家或默认档案相关配置,取决于版本实现。 |
lang/ | 语言文件。 |
典型工作流
- 在
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、命中反馈和恢复配置。 |
| 条件系统 | 装备条件、属性条件与跨模块条件。 |
| 命令与权限 | /ea 命令、lint、preview、dump 和调试。 |
| 占位符 | PlaceholderAPI 输出。 |
| API | PDC 属性 API 和伤害事件扩展。 |
建议配置顺序
- 先使用默认属性启动服务器,确认模块正常加载。
- 添加或修改一个属性文件,执行 reload / lint 检查。
- 让一个测试物品写入该属性。
- 使用 preview / dump 命令确认属性被读取。
- 再接入伤害类型和战斗测试。
config.yml 主要字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
language | string | zh_CN | 语言文件名(对应 lang/ 目录下的文件)。 |
hard_lock_damage | boolean | true | 全局硬锁定伤害。为 true 时所有匹配的伤害事件都走属性系统。 |
default_damage_type | string | physical | 默认伤害类型 ID。未匹配到特定类型时使用。 |
regen_interval_ticks | integer | 20 | 资源回复计算间隔(tick)。最小值 1。20 tick = 1 秒。 |
sync_delay_ticks | integer | 1 | 属性同步延迟(tick)。装备变化后等待多少 tick 再同步。最小值 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 | — | 资源 ID(如 health、mana)。 |
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 动作系统注册了以下动作:
| 动作 ID | 参数 | 说明 |
|---|---|---|
attributedamage | amount(必填)、type(可选,默认 default_damage_type)、cause(可选,默认 CUSTOM) | 对当前玩家施加属性伤害。 |
attribute_add | effect_id、attribute、value、duration_ticks | 添加临时属性加成效果。 |
attribute_set | effect_id、attribute、value、duration_ticks | 设置临时属性值。 |
attribute_remove | effect_id | 移除指定 ID 的临时属性效果。 |
动作示例
yaml
actions:
# 对玩家造成 50 点物理属性伤害
- 'attributedamage amount=50 type=physical'
# 给玩家添加 10 秒的攻击力加成
- 'attribute_add effect_id=forge_buff attribute=physical_attack value=20 duration_ticks=200'
# 移除临时效果
- 'attribute_remove effect_id=forge_buff'