
Mebahel的RPG - 抗性与弱点
一个轻量级且高度可配置的战斗框架,通过为每个生物添加全面的物理(斩击、穿刺、钝击)和元素抗性与弱点系统,将Minecraft转变为战术体验。
在本视频中,你可以看到根据武器有效性显示的不同颜色的命中标记。准星右侧还会根据元素有效性显示红色或绿色的命中标记。
Mebahel RPG Resistance & Weakness
Mebahel RPG Resistance & Weakness 是 Minecraft 的一个轻量级战斗 API 与平衡框架,开箱即支持原版生物以及 Mebahel's Creatures - Draugr Invasion 和 Dwarven Automatons 中的生物,无需初始配置。它基于物理武器类型和元素伤害类型添加可配置的伤害倍率,允许实体对剑、箭、锤、火、霜或任何其他模组添加的自定义元素做出独特反应。
目标很简单:让战斗更具可读性、更具策略性,并更容易在原版生物、模组生物和大型 RPG 风格整合包之间进行平衡。
依赖
Forge / NeoForge
Fabric
核心功能
- 物理伤害类别:斩击、穿刺和钝击
- 元素伤害类别:火焰和冰霜
- 可扩展的自定义元素,例如神圣、毒素、奥术、闪电,或模组开发者想要注册的任何自定义元素
- 通过
entities.json实现完全可配置的实体倍率 - 数据包支持预设平衡
- 数据包可自动向配置添加缺失条目,而不会覆盖玩家编辑
- 可选的物理和元素有效性命中标记反馈
- 色盲友好命中标记模式
- 安全支持当前未安装模组的实体 ID
伤害类型
默认系统将伤害分为两层。
| 层级 | 类型 | 用途 |
|---|---|---|
| 物理 | 斩击、穿刺、钝击 | 代表武器或攻击形态 |
| 元素 | 火焰、冰霜 | 代表魔法或元素属性 |
两层可以同时生效。
例如,一支冰霜箭可能被检测为:
| 层级 | 检测到的类型 |
|---|---|
| 物理 | 穿刺 |
| 元素 | 冰霜 |
最终伤害计算为:
finalDamage = baseDamage × physicalMultiplier × elementalMultiplier
倍率规则
| 倍率 | 含义 |
|---|---|
1.0 |
中性伤害 |
> 1.0 |
弱点,伤害增加 |
< 1.0 |
抗性,伤害减少 |
0.0 |
完全免疫 |
大多数生物推荐的平衡范围在 0.75 到 1.25 之间。
默认原版平衡概览
默认预设旨在保持原版战斗的熟悉感,同时添加有意义的 RPG 风格优势。
| 实体 | 斩击 | 穿刺 | 钝击 | 火焰 | 冰霜 |
|---|---|---|---|---|---|
minecraft:zombie |
1.0 | 0.9 | 1.1 | 1.25 | 0.9 |
minecraft:husk |
1.0 | 0.9 | 1.1 | 1.2 | 0.95 |
minecraft:drowned |
1.0 | 0.9 | 1.1 | 1.1 | 1.0 |
minecraft:zombie_villager |
1.0 | 0.9 | 1.1 | 1.25 | 0.9 |
minecraft:skeleton |
1.0 | 0.95 | 1.15 | 1.1 | 0.9 |
minecraft:stray |
1.0 | 0.95 | 1.15 | 1.15 | 0.85 |
minecraft:wither_skeleton |
1.0 | 0.95 | 1.1 | 0.85 | 1.1 |
minecraft:creeper |
1.0 | 1.05 | 0.9 | 1.1 | 0.95 |
minecraft:spider |
1.1 | 0.95 | 0.95 | 1.2 | 0.9 |
minecraft:cave_spider |
1.1 | 0.95 | 0.95 | 1.2 | 0.9 |
minecraft:witch |
1.0 | 1.0 | 1.0 | 1.1 | 0.95 |
minecraft:pillager |
1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
minecraft:vindicator |
1.0 | 1.0 | 1.05 | 1.0 | 1.0 |
minecraft:evoker |
1.0 | 1.0 | 1.0 | 1.1 | 0.95 |
minecraft:vex |
1.05 | 1.05 | 1.0 | 1.1 | 0.95 |
minecraft:ravager |
0.95 | 0.9 | 1.1 | 1.05 | 0.95 |
minecraft:guardian |
0.95 | 1.0 | 1.05 | 1.15 | 0.9 |
minecraft:elder_guardian |
0.95 | 1.0 | 1.1 | 1.15 | 0.9 |
minecraft:slime |
1.0 | 1.0 | 1.1 | 1.0 | 1.0 |
minecraft:silverfish |
1.0 | 1.0 | 1.1 | 1.0 | 1.0 |
minecraft:endermite |
1.05 | 1.0 | 0.95 | 1.1 | 0.95 |
minecraft:enderman |
1.0 | 1.0 | 0.95 | 1.15 | 0.9 |
minecraft:shulker |
0.9 | 0.9 | 1.15 | 1.0 | 1.0 |
minecraft:ender_dragon |
1.0 | 0.95 | 1.05 | 0.9 | 1.05 |
minecraft:blaze |
1.0 | 1.0 | 1.0 | 0.75 | 1.25 |
minecraft:magma_cube |
1.0 | 1.0 | 1.05 | 0.8 | 1.2 |
minecraft:ghast |
1.0 | 1.05 | 0.95 | 0.9 | 1.1 |
minecraft:piglin |
1.0 | 1.0 | 1.0 | 1.05 | 0.95 |
minecraft:piglin_brute |
1.0 | 1.0 | 1.05 | 1.05 | 0.95 |
minecraft:zombified_piglin |
1.0 | 0.9 | 1.1 | 0.85 | 0.95 |
minecraft:hoglin |
1.0 | 0.95 | 1.1 | 1.0 | 1.05 |
minecraft:zoglin |
1.0 | 0.95 | 1.1 | 0.85 | 1.05 |
minecraft:wither |
1.0 | 0.95 | 1.0 | 0.9 | 1.05 |
minecraft:warden |
1.0 | 0.95 | 1.05 | 0.95 | 0.95 |
minecraft:phantom |
1.0 | 1.1 | 1.0 | 1.1 | 0.95 |
内置 Mebahel 预设
基础配置还可以包含 Mebahel 生态生物的预设。即使相关模组未安装,这些条目也是安全的,因为它们以实体 ID 字符串形式存储。
Dwarven Automatons
| 实体 | 斩击 | 穿刺 | 钝击 | 火焰 | 冰霜 |
|---|---|---|---|---|---|
mebahelcreaturesdwarven:dwarven_sphere |
0.8 | 0.8 | 1.4 | 1.0 | 1.0 |
mebahelcreaturesdwarven:dwarven_centurion |
0.8 | 0.8 | 1.4 | 1.0 | 1.0 |
mebahelcreaturesdwarven:dwarven_spider |
0.8 | 0.8 | 1.4 | 1.0 | 1.0 |
mebahelcreaturesdwarven:dwarven_spider_guardian |
0.8 | 0.8 | 1.4 | 1.0 | 1.0 |
矮人自动机是金属构造体。它们抵抗斩击和穿刺伤害,但易受钝击冲击伤害。
Draugr Invasion
| 实体 | 斩击 | 穿刺 | 钝击 | 火焰 | 冰霜 |
|---|---|---|---|---|---|
mebahelcreaturesdraugr:draugr |
1.15 | 0.9 | 0.9 | 1.2 | 0.85 |
mebahelcreaturesdraugr:draugr_archer |
1.15 | 0.9 | 0.9 | 1.2 | 0.85 |
mebahelcreaturesdraugr:draugr_wight |
1.15 | 0.9 | 0.9 | 1.2 | 0.85 |
mebahelcreaturesdraugr:draugr_scourge |
1.2 | 0.85 | 0.85 | 1.15 | 0.8 |
mebahelcreaturesdraugr:draugr_overlord |
1.2 | 0.85 | 0.85 | 1.15 | 0.8 |
mebahelcreaturesdraugr:skeleton_warrior |
1.1 | 0.9 | 0.9 | 1.15 | 0.9 |
mebahelcreaturesdraugr:skeleton_warrior_head |
1.1 | 0.9 | 0.9 | 1.15 | 0.9 |
mebahelcreaturesdraugr:infernal_draugr |
1.15 | 0.9 | 0.9 | 0.75 | 1.25 |
mebahelcreaturesdraugr:flame_atronach |
1.0 | 1.0 | 1.0 | 0.75 | 1.25 |
尸鬼(Draugr)是古老的亡灵战士。它们弱于斩击伤害和火焰,但抵抗穿刺、钝击冲击和冰霜。
配置文件
模组在以下位置创建配置:
config/mebahel-rpg_resistance-weakness/
| 文件 | 用途 |
|---|---|
config.json |
伤害检测、关键词、优先级和客户端反馈选项 |
entities.json |
实体特定的抗性与弱点倍率 |
实体配置
entities.json 控制每个生物的实际伤害倍率。
示例:
{
"entities": {
"minecraft:zombie": {
"mebahelrpgresistanceweakness:slash": 1.0,
"mebahelrpgresistanceweakness:pierce": 0.9,
"mebahelrpgresistanceweakness:blunt": 1.1,
"mebahelrpgresistanceweakness:fire": 1.25,
"mebahelrpgresistanceweakness:frost": 0.9
}
}
}
这意味着:
| 伤害类型 | 倍率 | 结果 |
|---|---|---|
| 斩击 | 1.0 | 中性 |
| 穿刺 | 0.9 | 伤害减少 10% |
| 钝击 | 1.1 | 伤害增加 10% |
| 火焰 | 1.25 | 伤害增加 25% |
| 冰霜 | 0.9 | 伤害减少 10% |
检测配置
伤害检测在 config.json 中配置。
模组使用武器、弹射物和物品的稳定 ID 和翻译键来检测伤害类型。这避免依赖已翻译的显示名称或自定义物品名称。
示例检测部分:
{
"elementDetection": {
"physicalPriority": [
"mebahelrpgresistanceweakness:blunt",
"mebahelrpgresistanceweakness:pierce",
"mebahelrpgresistanceweakness:slash"
],
"elementalPriority": [
"mebahelrpgresistanceweakness:frost",
"mebahelrpgresistanceweakness:fire"
],
"needles": {
"mebahelrpgresistanceweakness:slash": [
"sword",
"blade",
"slash",
"claw",
"claymore",
"cutlass",
"katana",
"scythe",
"sickle",
"dagger",
"axe",
"war_axe",
"halberd"
],
"mebahelrpgresistanceweakness:pierce": [
"arrow",
"bow",
"bolt",
"trident",
"spear",
"lance",
"javelin",
"rapier",
"pierce"
],
"mebahelrpgresistanceweakness:blunt": [
"mace",
"hammer",
"warhammer",
"club",
"blunt",
"anchor",
"fist",
"pickaxe",
"staff",
"wand"
],
"mebahelrpgresistanceweakness:fire": [
"fire",
"flame",
"burn",
"lava",
"inferno"
],
"mebahelrpgresistanceweakness:frost": [
"frost",
"ice",
"freeze",
"snow",
"stalhrim"
]
}
}
}
物理优先级
当武器匹配多个关键词时,physicalPriority 决定哪种物理类型胜出。
例如,pickaxe(镐)包含 axe(斧),但它应被视为钝击。将 blunt 放在 slash 之前可确保镐被正确分类。
元素优先级
当伤害来源匹配多个元素关键词时,elementalPriority 决定哪种元素类型胜出。
例如,同时包含 fire 和 frost 关键词的自定义物品将使用优先级列表中第一个匹配的元素。
客户端反馈
模组包含可选的命中标记反馈,以显示攻击是有效还是被抵抗。
配置部分:
{
"clientFeedback": {
"showPhysicalHitmarker": true,
"showElementalHitmarker": true,
"colorblindMode": false
}
}
| 选项 | 描述 |
|---|---|
showPhysicalHitmarker |
启用或禁用物理有效性命中标记 |
showElementalHitmarker |
启用或禁用元素有效性命中标记 |
colorblindMode |
使用蓝色/橙色代替绿色/红色 |
默认颜色
| 结果 | 普通模式 | 色盲模式 |
|---|---|---|
| 有效伤害 | 绿色 | 蓝色 |
| 被抵抗伤害 | 红色 | 橙色 |
| 中性伤害 | 白色 | 白色 |
物理命中标记使用通用物理图标。
元素命中标记使用通用元素图标,因此兼容神圣、毒素、闪电或奥术等自定义元素。
数据包支持
数据包可为原版或模组生物添加新的预设值。
数据包实体文件放置位置:
data/<namespace>/rpg_resweak/entities/<entity_namespace>/<entity_path>.json
示例路径:
data/my_rpg_pack/rpg_resweak/entities/minecraft/zombie.json
推荐格式:
{
"mebahelrpgresistanceweakness:slash": 1.0,
"mebahelrpgresistanceweakness:pierce": 0.9,
"mebahelrpgresistanceweakness:blunt": 1.1,
"mebahelrpgresistanceweakness:fire": 1.25,
"mebahelrpgresistanceweakness:frost": 0.9
}
也支持旧格式:
{
"multipliers": {
"mebahelrpgresistanceweakness:slash": 1.0,
"mebahelrpgresistanceweakness:pierce": 0.9,
"mebahelrpgresistanceweakness:blunt": 1.1
}
}
数据包值的应用方式
数据包作为预设发挥作用。
加载数据包时:
- 新实体会被添加到
entities.json - 缺失的元素倍率会被添加
- 现有的玩家编辑值永远不会被覆盖
这意味着数据包可安全用于现有世界和整合包。
示例:
如果 entities.json 已包含:
{
"entities": {
"minecraft:zombie": {
"mebahelrpgresistanceweakness:fire": 1.5
}
}
}
而数据包提供:
{
"mebahelrpgresistanceweakness:fire": 1.25,
"mebahelrpgresistanceweakness:frost": 0.9
}
最终配置保留玩家值,只添加缺失的值:
{
"entities": {
"minecraft:zombie": {
"mebahelrpgresistanceweakness:fire": 1.5,
"mebahelrpgresistanceweakness:frost": 0.9
}
}
}
加载顺序
计算伤害时,模组按此顺序检查值:
| 优先级 | 来源 |
|---|---|
| 1 | 运行时覆盖 |
| 2 | entities.json |
| 3 | 数据包值 |
| 4 | 回退值 1.0 |
在正常游戏中,一旦生成,entities.json 就是主要的事实来源。
添加自定义元素
其他模组可通过 API 注册新的元素伤害类型。这对于需要神圣、毒素、闪电、奥术、暗影或光辉伤害等自定义元素的 RPG 系统非常有用。
自定义元素有两个重要部分:
| 部分 | 用途 |
|---|---|
| 元素 ID | 用于配置和数据包的唯一标识符,例如 my_mod:holy |
| 关键词 | 检测器用于识别攻击属于此元素的关键词 |
示例:注册神圣元素。
Identifier HOLY = new Identifier("my_mod", "holy");
RPGElements.registerElementalWithNeedles(
HOLY,
new ElementDefinition(HOLY),
List.of(
"holy",
"sun",
"light",
"silver",
"radiant"
)
);
第三个参数 List.of(...) 定义该元素的检测关键词。检测器检查由武器 ID、弹射物 ID、物品 ID 和翻译键构建的稳定签名。如果其中一个签名包含匹配的关键词,攻击就可被归类为该元素。
例如,上述神圣元素可能从以下 ID 检测到:
| ID 或翻译键 | 匹配关键词 |
|---|---|
my_mod:silver_sword |
silver |
my_mod:holy_staff |
holy |
item.my_mod.radiant_blade |
radiant |
my_mod:sun_arrow |
sun |
元素注册后,即可像任何内置元素一样在 entities.json 中使用:
{
"entities": {
"minecraft:zombie": {
"my_mod:holy": 1.25
}
}
}
这意味着僵尸受到被检测为 my_mod:holy 的攻击时伤害增加 25%。
自定义元素也可用于数据包:
{
"my_mod:holy": 1.25,
"my_mod:poison": 0.75
}
示例数据包路径:
data/my_rpg_pack/rpg_resweak/entities/minecraft/zombie.json
自定义元素的检测优先级
当自定义元素通过 RPGElements.registerElementalWithNeedles(...) 注册后,可将其添加到 config.json 的 elementalPriority 中。
示例:
{
"elementDetection": {
"elementalPriority": [
"my_mod:holy",
"mebahelrpgresistanceweakness:frost",
"mebahelrpgresistanceweakness:fire"
]
}
}
当同一攻击匹配多个元素关键词时,优先级很重要。elementalPriority 中第一个匹配的元素会被选中。
例如,如果物品 ID 为 my_mod:holy_fire_sword,且 holy 和 fire 都匹配,则选中的元素取决于 elementalPriority 中的顺序。
推荐的关键词规则
为获得最佳兼容性,请使用可能出现在物品或弹射物 ID 中的小写英文关键词。
推荐:
List.of("holy", "sun", "light", "silver", "radiant")
避免过于通用的关键词,例如:
List.of("the", "magic", "item", "weapon")
通用关键词可能意外地将过多攻击归类为自定义元素。
自定义元素会自动受到通用元素命中标记的支持。命中标记不需要为每个元素设置自定义图标或颜色;它只指示攻击的元素部分是否有效、被抵抗或中性。
面向模组开发者的 API
模组可直接通过 API 定义默认倍率。
添加五种基础元素
MebahelsRPGWeaknessesResistances.addBasic(
ModEntities.MY_ENTITY,
1.0f, // slash
0.9f, // pierce
1.2f, // blunt
1.25f, // fire
0.85f // frost
);
添加或更新一个默认值
MebahelsRPGWeaknessesResistances.putDefault(
ModEntities.MY_ENTITY,
new Identifier("my_mod", "holy"),
1.25f
);
putDefault 是安全的。它仅在玩家尚未配置值时才写入值。
强制运行时和配置覆盖
MebahelsRPGWeaknessesResistances.setMultiplier(
ModEntities.MY_ENTITY,
new Identifier("my_mod", "holy"),
1.5f
);
这适用于命令、调试工具或管理员侧平衡。它会覆盖配置值。
面向整合包作者的说明
- 使用数据包分发平衡预设
- 使用
entities.json进行最终的服务器端调优 - 除非设计高冲击机制,否则将大多数值保持在
0.75到1.25之间 - 除非有意完全免疫,否则避免将值设为
0.0 - 来自缺失模组的实体 ID 是安全的;在相关模组安装之前它们保持未使用
- 数据包不会覆盖
entities.json中已有的玩家或服务器编辑
总结
Mebahel RPG Resistance & Weakness 为 Minecraft 提供了一个干净、可配置的 RPG 战斗层。它为模组开发者和整合包作者提供了一种灵活的方式,使敌人感觉独特,而无需将平衡硬编码到实体类中。
无论你想让骷髅惧怕锤子、自动机抵抗箭矢、火焰生物无视火焰,还是亡灵在神圣魔法下燃烧,这个模组都提供了干净实现这些的框架。
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。