Mebahel's RPG - 抗性 & 弱点

模组

原名 Mebahel's RPG - Resistance & Weakness · 作者 Mebahel

一个轻量且高度可配置的战斗框架,通过为每个生物添加全面的物理(斩击、穿刺、钝击)和元素抗性/弱点系统,将《Minecraft》转变为一场战术体验。

0 本站下载 0 关注 更新于 6 个月前

需要前置:Fabric API

最新 1.0.18-fabric-1.20.1 · 1.20.1 · Fabric / Quilt

一键开服(送7天)

在此视频中,你可以看到根据武器效率不同而显示不同颜色的命中标记。此外,在准星右侧还会根据元素效率显示红色或绿色的命中标记。

Mebahel RPG 抗性 & 弱点

Mebahel RPG Resistance & Weakness 是一个轻量级的战斗 API 和平衡框架,专为 Minecraft 打造,开箱即用支持原版生物以及来自 Mebahel's Creatures - Draugr Invasion 和 Dwarven Automatons 的生物,无需初始配置。它添加了基于物理武器类型和元素伤害类型的可配置伤害乘数,允许实体对剑、箭矢、锤、火焰、霜冻或其他模组添加的任何自定义元素做出独特的反应。

目标很简单:让战斗更具可读性、更具战术性,并更容易在原版生物、模组生物以及大型 RPG 风格整合包之间进行平衡。


依赖项

Forge / NeoForge

Fabric


核心特性

  • 物理伤害类别:Slash(斩击)、Pierce(穿刺) 和 Blunt(钝击)
  • 元素伤害类别:Fire(火焰) 和 Frost(霜冻)
  • 可扩展的自定义元素,例如 Holy(神圣)、Poison(毒素)、Arcane(奥术)、Lightning(闪电),或者模组开发者想要注册的任何自定义元素
  • 通过 entities.json 完全可配置的实体乘数
  • 数据包支持预设平衡
  • 数据包可以自动向配置中添加缺失条目,而不会覆盖玩家的手动编辑
  • 可选的物理和元素有效性命中标记反馈
  • 色盲友好的命中标记模式
  • 安全支持尚未安装的模组的实体 ID

伤害类型

默认系统将伤害分为两个层级。

层级 类型 目的
Physical (物理) Slash, Pierce, Blunt 代表武器或攻击形状
Elemental (元素) Fire, Frost 代表魔法或元素属性

这两个层级可以同时应用。

例如,一支霜冻箭可能被检测为:

层级 检测到的类型
Physical (物理) Pierce (穿刺)
Elemental (元素) Frost (霜冻)

最终伤害计算如下:

finalDamage = baseDamage × physicalMultiplier × elementalMultiplier


乘数规则

乘数 含义
1.0 中性伤害
> 1.0 弱点,伤害增加
< 1.0 抗性,伤害减少
0.0 完全免疫

大多数生物的推荐平衡范围在 0.75 到 1.25 之间。


默认原版平衡概览

默认预设旨在保持原版战斗的熟悉感,同时增添有意义的 RPG 风格优势。

Entity (实体) Slash (斩击) Pierce (穿刺) Blunt (钝击) Fire (火焰) Frost (霜冻)
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

Entity Slash Pierce Blunt Fire Frost
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

矮人自动机是金属构造体。它们抵抗劈砍和穿刺伤害,但易受钝击影响。

亡灵入侵

Entity Slash Pierce Blunt Fire Frost
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/

File Purpose
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
    }
  }
}

这意味着:

Damage Type Multiplier Result
Slash 1.0 Neutral
Pierce 0.9 伤害减少 10%
Blunt 1.1 伤害增加 10%
Fire 1.25 伤害增加 25%
Frost 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
  }
}
Option Description
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,  // 挥砍
        0.9f,  // 穿刺
        1.2f,  // 钝击
        1.25f, // 火焰
        0.85f  // 冰霜
);

添加或更新一个默认值

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 战斗层。它为模组开发者和整合包作者提供了一种灵活的方式,使敌人具有独特的感知,而无需在实体类中进行硬编码平衡。

无论你是想让骷髅畏惧连枷,让自动机抵抗箭矢,让火焰生物无视火焰,还是让不死生物在神圣魔法下燃烧,此模组都提供了干净利落的实现框架。

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源