主题
精灵属性
一、前置配置
属性由外部属性插件提供,先在 config.yml 选择属性类型:
yaml
buffType: "attribute_plus"支持的类型:
attribute_plussx_attributeAttributeSystemMythicLibSagaLoreStats
不同属性插件的属性名称可能不同,请使用对应插件支持的属性名称。
二、固定属性
在 companions.yml 的精灵节点下配置 attribute:
yaml
companions:
reaper:
attribute:
- "物理攻击: ${level * 1}"
- "最大生命: ${level * 2}"说明:
attribute是固定属性列表。${level}是精灵当前等级。${discountRate}是属性折扣变量。- 每行一条属性,格式为
属性名: 数值。
示例:
yaml
attribute:
- "物理攻击: ${level * 2 * discountRate}"全局折扣在主 config.yml 配置:
yaml
discountRate: 1isAllBuff: false 时仅当前使用的精灵提供属性;设为 true 后,会汇总所有已拥有实例的固定属性、随机属性与绑定装备属性,但仍需先选用一个精灵。
当前使用的实例折扣始终为 1,其他实例按各自 discountRate 计算,且公式中需要使用该变量。3.0.0 中精灵未配置此项时默认为 1;需要读取主配置值时,在该精灵节点填写 discountRate: ""。
三、随机属性
在 companions.yml 的精灵节点下配置 randomAttribute:
yaml
companions:
reaper:
randomAttribute:
- "物理攻击: ${10~50}"
- "魔法攻击: ${5~30}"说明:
randomAttribute是随机属性池。- 获得精灵时先随机品质,再按品质抽取属性条数。
- 抽取结果会保存到精灵实例,不会每次打开 GUI 时重新随机。
- 区间数值只抽取一次;公式中的
level、discountRate会保留,在属性计算时按当前等级与折扣求值。 - 属性池数量不足时,取出当前属性池中的全部属性。
随机范围支持两种写法:
yaml
randomAttribute:
- "物理攻击: 10~50"
- "魔法攻击: ${5~30 * discountRate}"四、随机属性品质
品质和每个品质抽取的属性条数在主 config.yml 的 quality 中配置:
yaml
quality:
normal:
amount: 1
weight: 45
advanced:
amount: 2
weight: 18
rare:
amount: 3
weight: 18
rarer:
amount: 4
weight: 9
epic:
amount: 5
weight: 9
mythical:
amount: 6
weight: 1amount:该品质抽取几条随机属性。weight:该品质被抽中的权重,数值越大越容易抽中。- 品质名称可以自行添加或修改,升级时应保留已有品质标识及其语言映射。
- 管理界面的品质洗炼会重新抽取品质和随机属性,需
companions.upgrade.refineQuality权限;按钮与费用在gui/upgrade.yml的quality.enable、quality.price中配置。
品质显示名称在 languages/zh_CN.yml 的 quality 中配置:
yaml
quality:
normal: "&f普通"
advanced: "&9高级"
rare: "&5稀有"
rarer: "&d罕见"
epic: "&6史诗"
mythical: "神话"五、属性名称显示
属性实际名称由属性插件识别。只想修改 GUI 中的显示名称,可以在 languages/zh_CN.yml 配置 attributeNames:
yaml
attributeNames:
attack_damage: "攻击力"这只会修改显示文本,不会修改实际生效的属性名称。
六、GUI 中显示属性
在精灵的 GUI.shop 或 GUI.open 的 description 中使用变量:
yaml
GUI:
shop:
description:
- "&6固定属性"
- "&7${attribute}"
- "&6随机属性范围"
- "&7${randomAttribute}"
open:
description:
- "&7等级: ${level}"
- "&7品质: ${quality}"
- "&7属性: ${attribute}"
- "&7随机属性: ${randomAttribute}"支持变量:
${attribute}:固定属性。${randomAttribute}:随机属性;商城显示属性范围,仓库显示已抽取结果。${level}:精灵等级。${quality}:精灵品质。
七、MythicLib 格式
使用 MythicLib 时,属性名填写 MMOItems/Language/stats.yml 中的属性 ID:
yaml
attribute:
- "MAX_HEALTH: 5"属性名不区分大小写,具体可用名称以 MythicLib 配置为准。