重构伤害
对围绕伤害的几项机制进行全面重构。本模组灵感来源于《黑暗之魂》和《Valheim》,旨在深化 Minecraft 的战斗体验。
效果累积
效果累积(Effect Build-Ups)是一种资源(类似生命值),默认值为零。某些事件(如受到伤害)会增加或减少这些资源。累积值也会随时间缓慢降低。
如果累积值达到特定阈值,将施加相应的状态效果,并将累积值重置为零。
目前存在以下效果累积:
- 流血(Bleeding)
- 燃烧(Burning)
- 冻结(Freezing)
- 中毒(Poisoned)
- 触电(Shocked)
- 失衡(Staggered)
效果累积会在 HUD 中显示。
该系统的几乎所有方面均可通过实体属性、配置文件和/或数据包进行配置。
状态效果
Overhauled Damage 添加了多种由效果累积使用的状态效果。它们可以在服务器配置中进行设置。
其中一些效果目前尚不具备游戏内效果,因为所需的第三方 API 尚未更新。
效果累积也可以配置为使用其他效果。
Overhauled Damage 添加的状态效果如下:
- "overhauleddamage:bleeding":造成实体最大生命值一定百分比的伤害。当实体移动时,伤害加倍。
- "overhauleddamage:burning":造成伤害。此效果试图以状态效果的形式重现硬编码的“on_fire”实体标志。
- "overhauleddamage:chilled":降低攻击速度和移动速度。
- "overhauleddamage:frozen":目前无游戏内效果。计划使实体无法移动并阻止任何行动。目前正在等待第三方模组更新。
- "overhauleddamage:poison":原版状态效果的可配置版本。与原版不同,此效果可以致死。
- "overhauleddamage:shocked":目前无游戏内效果。计划增加对该实体造成的伤害。目前正在等待第三方模组更新。
- "overhauleddamage:staggered":目前无游戏内效果。计划使实体无法移动并阻止任何行动。目前正在等待第三方模组更新。
- "overhauleddamage:hit_stun":降低攻击速度和移动速度。
重构伤害计算
在 Minecraft 中,施加给实体的每次伤害都有一个“伤害类型”(damage type)。它定义了死亡消息以及抗性机制等。
Overhauled Damage 扩展了这一系统。每个启用的重构模块自然会禁用对应的原版实现。
当实体受到伤害时,这不再仅仅减少生命值。根据伤害类型的不同,可能会产生各种效果。这可能仍然包括生命值减少,但也可能是效果累积增加,甚至法力/耐力也可能被修改。
具体发生什么,取决于伤害类型,或者更准确地说,取决于该伤害类型所属的类别(或攻击类型)。
攻击类型
每种“伤害类型”属于一个或多个类别(称为“攻击类型”)。这是由一组浮点值(称为乘数)定义的,每种攻击类型对应一个乘数。
攻击类型包括:
- 通用(Generic)
- 撞击(Bashing)
- 穿刺(Piercing)
- 挥砍(Slashing)
- 毒素(Poison)
- 火焰(Fire)
- 冰霜(Frost)
- 闪电(Lightning)
默认情况下,每种伤害类型对“通用”的乘数为 1.0,对其他类型的乘数为 0.0。例外情况在服务器配置中定义。
新的伤害计算的第一步是使用施加给实体的伤害量来确定每种攻击类型的数量。
attack_type_amount = damage_amount * attack_type_multiplier
真实伤害
位于 "overhauleddamage:is_true_damage" 伤害类型标签中的伤害类型将忽略自定义伤害计算。它们不受盾牌格挡、护甲或抗性的影响。它们不应用效果累积。它们仅对生命值(以及适用的法力/耐力)造成伤害。
格挡伤害
这部分计算仅在满足以下条件时发生:
- 受击实体当前正持盾格挡
- 伤害类型可以被装备的盾牌格挡(由 "minecraft:blocks_attacks" 数据组件决定)
- 安装了模组 "Blocking Overhaul"
- 服务器配置中启用了 Overhauled Damage 的 "Blocking Overhaul" 版本
- 如果安装了 "Stamina Attributes",实体还必须至少拥有一点耐力(或者 "blocking_requires_stamina" 服务器配置必须设置为 false)
弹反
弹反取代普通格挡,并在满足特定条件时增加弹反乘数(parry_multiplier):
- 实体位于 "blockingoverhaul:can_parry" 实体类型标签中
- 格挡时间(自开始格挡以来的刻数)等于或低于实体的 "blockingoverhaul:parry_window" 属性
- 攻击由 LivingEntity 引起
- 用于格挡的物品具有 "blockingoverhaul:parries_attacks" 数据组件
parry_multiplier = (若处于弹反状态) ? ("blockingoverhaul:parry_multiplier" 属性) : 1
耐力消耗应用
如果安装了 Stamina Attributes,将应用格挡/弹反攻击的耐力消耗。如果在此之后实体的耐力低于零,则格挡/弹反攻击的尝试失败,伤害量不会减少。
格挡伤害计算
格挡伤害的数量不再由 "minecraft:blocks_attacks" 数据组件决定,而是取决于攻击的伤害类型(更具体地说是其攻击类型)以及几个实体属性。有两种不同的模式:固定值减伤和基于百分比的减伤。
blocked_attack_type_amount = blocked_attack_type_damage_attribute * parry_multiplier
blocked_attack_type_amount = attack_type_amount * blocked_attack_type_damage_attribute * parry_multiplier / 100
失衡应用
所有 attack_type_stagger_amount 的总和随后将应用于受击实体的失衡累积值。如果该实体因此陷入失衡,则格挡/招架尝试失败且不会阻挡任何伤害。
attack_type_stagger_amount = (attack_type_amount - blocked_attack_type_amount) * attack_type_stagger_multiplier
伤害减免
如果格挡/招架尝试成功,则攻击量会被削减。
new_attack_type_amount = old_attack_type_amount - blocked_attack_type_amount
额外效果
如果攻击带有攻击者,那么格挡/招架会产生额外的后果。如果攻击被招架,则攻击者会立即陷入失衡。
如果攻击被正常格挡,则攻击方或防守方会根据一个变量值被击退。
additional_attack_type_knockback = old_attack_type_amount * attack_type_negative_block_force_multiplier
applied_knock_back = ((防守方的 "blockingoverhaul:block_force" 属性) * parry_multiplier) - (攻击方的 "minecraft:attack_knockback" 属性) + (所有 additional_attack_type_knockback 的总和) * total_applied_blocking_knockback_multiplier_config_option
如果 applied_knock_back 大于零,则将其应用于攻击者实体。
如果 applied_knock_back 小于零,则取其绝对值并应用于格挡者实体。
盔甲造成的伤害减免
剩余的各类型攻击量通过以下公式由盔甲进行减免:
effective_armor = armor_attribute * armor_toughness_attribute (此功能可在服务器配置中禁用)
attack_type_armor_damage = attack_type_amount * effective_armor * attack_type_armor_multiplier / 100;
attack_type_amount = attack_type_amount - attack_type_armor_damage
所有 attack_type_armor_damage 的总和随后用于损害实体的盔甲。
抗性造成的伤害减免
每种攻击类型都对应一个抗性属性。剩余的各类型攻击量通过以下公式由抗性进行减免:
attack_type_amount = attack_type_amount - (attack_type_amount * attack_type_resistance_attribute) / 100;
攻击的效果
剩余的各类型攻击量将对受击实体施加其效果。
流血累积
如果伤害类型属于 "overhauleddamage:applies_bleeding" 伤害类型标签,则该攻击可以施加流血累积值。该数值通过将每种攻击类型量乘以可配置的乘数并累加结果来计算。
燃烧累积
所施加的燃烧累积值即为 fire_amount。
寒冷效果与冻结累积
冰霜伤害会施加“寒冷”效果。效果持续时间为 frost_amount 乘以可配置的乘数。
所施加的冻结累积值即为 frost_amount。
失衡累积
如果没有尝试用盾牌格挡/招架该攻击,则现在将施加失衡累积值。该数值通过将每种攻击类型量乘以可配置的乘数并累加结果来计算。
中毒累积
所施加的中毒累积值即为 poison_amount。
冲击累积
所施加的冲击累积值即为 lightning_amount。
击退
如果没有尝试用盾牌格挡/招架该攻击,并且启用了 Knockback Overhaul,则现在将施加攻击击退。该数值通过将每种攻击类型量乘以可配置的乘数,并将总和乘以可配置的全局乘数来计算。
对生命/法力/耐力造成的伤害
“已应用伤害”的数量通过将每种剩余的攻击类型量乘以可配置的乘数并累加结果来计算。
如果安装了 Mana Attributes 和/或 Stamina Attributes,一部分“已应用伤害”可以从法力/耐力中扣除。剩余的“已应用伤害”部分则从实体的生命值中扣除。
Overhauled Damage 在原版 Minecraft 及整合包中的集成
Overhauled Damage 如何具体地集成到玩法和平衡中高度主观,因此大多数功能都可以广泛配置和/或使用数据驱动的方法进行配置。
大多数功能都有默认值,这些值大致合理,可用作自定义的基础。
如果在配置 Overhauled Damage 时有任何疑问或问题,您可以通过 GitHub 或 Discord 联系我。
API
Overhauled Damage 提供了一个 Java API,允许任何生物实体使用自定义伤害类型造成伤害。
实现 "UsesCustomDamageType" 接口并重写 "overhauleddamage$getCustomDamageType()" 方法。
内置数据包
Overhauled Damage 还附带了几个内置数据包,进一步整合了现有内容或添加了新内容。
Overhauled Damage Enchantments
此数据包添加了几个新的附魔:
- Bleeding Protection
- Frost Aspect
- Frost Protection
- Lightning Aspect
- Lightning Protection
- Poison Aspect
- Poison Protection
Vanilla Enchantments Overhaul
此数据包重做了部分原版附魔,以使用 Overhauled Damage 引入的机制。
这包括:
- Blast Protection
- Fire Aspect
- Fire Protection
- Projectile Protection
- Protection
Overhauled Damage
A complete overhaul to several mechanics revolving around damage. It is inspired by games like Dark Souls and Valheim and aims to deepen Minecraft's combat.
Effect Build-Ups
Effect Build-Ups are a resource (like health) and are zero by default. Certain events (like taking damage) increase or reduce these resources. Build-Ups are also slowly reduced over time.
If a build-up reaches a certain threshold, the corresponding status effect is applied and the build-up is set to zero again.
Currently, there are the following effect build-ups:
- Bleeding
- Burning
- Freezing
- Poisoned
- Shocked
- Staggered
Effect Build-ups are displayed in the HUD.
Almost all aspects of this system are configurable via entity attributes, config files and/or data packs.
Status Effects
Overhauled Damage adds several status effects that are used by the effect build-ups. They can be configured in the server config.
Some of these effects currently don't have a gameplay effect, since the required third-party APIs are not updated yet.
The Effect Build-Ups can also be configured to use other effects.
The status effects added by Overhauled Damage are:
- "overhauleddamage:bleeding", deals a percentage amount of the entities maximum health as damage. The damage is doubled when the entity is moving.
- "overhauleddamage:burning", deals damage. This effect attempts to recreate the hardcoded "on_fire" entity flag as a status effect.
- "overhauleddamage:chilled", reduces attack and movement speed.
- "overhauleddamage:frozen", has currently no gameplay effect. Is planned to immobilise the entity and prevent any actions. Currently waiting on third-party mods to update.
- "overhauleddamage:poison", a configurable version of the vanilla status effect. Unlike it's vanilla counter-part, this effect can kill.
- "overhauleddamage:shocked", has currently no gameplay effect. Is planned to increase damage dealt to the entity. Currently waiting on third-party mods to update.
- "overhauleddamage:staggered", has currently no gameplay effect. Is planned to immobilise the entity and prevent any actions. Currently waiting on third-party mods to update.
- "overhauleddamage:hit_stun", reduces attack and movement speed.
Overhauled Damage Calculation
Every instance of damage that is dealt to an entity in Minecraft has a "damage type". This defines the death message and mechanics like resistances.
Overhauled Damage expands this system. Each enabled overhaul naturally disables the corresponding vanilla implementation.
When an entity is damaged, this no longer just reduces health. Depending on the damage type, there can be a variety of effects. This can still include health reduction, but it can also be effect build-up increases and even mana/stamina can be modified.
What exactly happens, is determined by the damage type or more precisely, to which category (or attack type) the damage type belongs.
Attack Types
Each "damage type" belongs to one or more categories (called "attack types"). This is defined by a list of float values (called multipliers), one for each attack type.
The attack types are:
- Generic
- Bashing
- Piercing
- Slashing
- Poison
- Fire
- Frost
- Lightning
By default, every damage type has a multiplier of 1.0 for Generic and 0.0 for the rest. Exceptions to this are defined in the server config.
The first step of the new damage calculation is to determine the amount of each attack type, using the damage amount that was dealt to the entity.
attack_type_amount = damage_amount * attack_type_multiplier
True Damage
Damage types in the "overhauleddamage:is_true_damage" damage type tag will ignore the custom damage calculation. They are not affected by shield blocking, armor or resistance. They don't apply Effect Build-Ups. They just deal damage to health (and/or mana/stamina, if applicable).
Blocked Damage
This part of the calculation only happens if:
- the attacked entity is currently blocking with a shield
- the damage type can be blocked by the equipped shield (determined by the "minecraft:blocks_attacks" data component)
- the mod "Blocking Overhaul" is installed
- Overhauled Damage's "Blocking Overhaul" version is enabled in the server config
- if "Stamina Attributes" is installed, the entity also has to have at least one stamina (or the "blocking_requires_stamina" server config has to be set to false)
Parrying
Parrying replaces normal blocking and increases the parry_multiplier if certain conditions are met:
- the entity is in the "blockingoverhaul:can_parry" entity type tag
- the blocking time (the amount of ticks since the blocking was started) is equal or lower than the entity's "blockingoverhaul:parry_window" attribute
- the attack is caused by a LivingEntity
- the item used for blocking has the "blockingoverhaul:parries_attacks" data component
parry_multiplier = (if parrying) ? ("blockingoverhaul:parry_multiplier" attribute) : 1
Stamina Cost Application
If Stamina Attributes is installed, the stamina cost for blocking/parrying an attack is applied. If the entity's stamina is lower than zero after that, the attempt to block/parry the attack fails and the damage amount is not reduced.
Blocked Damage Calculation
The amount of blocked damage is no longer determined by the "minecraft:blocks_attacks" data component, but is now depending on the damage_type (more specifically on its attack_types) of the attack and on several entity attributes. There are 2 different modes, flat damage reduction and percentage based damage reduction.
blocked_attack_type_amount = blocked_attack_type_damage_attribute * parry_multiplier
blocked_attack_type_amount = attack_type_amount * blocked_attack_type_damage_attribute * parry_multiplier / 100
Stagger Application
The sum of all attack_type_stagger_amount is then applied to the stagger build-up of the attacked entity. If the entity gets staggered by this, then the block/parry attempt fails and no damage is blocked.
attack_type_stagger_amount = (attack_type_amount - blocked_attack_type_amount) * attack_type_stagger_multiplier
Damage Reduction
If the blocking/parrying attempt was successful, then the attack amount is reduced.
new_attack_type_amount = old_attack_type_amount - blocked_attack_type_amount
Additional Effects
If the attack had an attacker, then blocking/parrying has additional consequences. If the attack was parried, then the attacker gets staggered instantly.
If the attack was blocked normally, then either the attacking or the defending entity are knocked back by a variable amount.
additional_attack_type_knockback = old_attack_type_amount * attack_type_negative_block_force_multiplier
applied_knock_back = ((defender's "blockingoverhaul:block_force" attribute) * parry_multiplier) - (attacker's "minecraft:attack_knockback" attribute) + (sum of all additional_attack_type_knockback) * total_applied_blocking_knockback_multiplier_config_option
If applied_knock_back is greater zero, it is applied to the attacking entity.
If applied_knock_back is lesser zero, its absolute value is applied to the blocking entity.
Damage Reduction by Armor
The remaining attack type amounts are reduced by armor, using the following formula:
effective_armor = armor_attribute * armor_toughness_attribute (This can be disabled in the server config)
attack_type_armor_damage = attack_type_amount * effective_armor * attack_type_armor_multiplier / 100;
attack_type_amount = attack_type_amount - attack_type_armor_damage
The sum of all attack_type_armor_damage is then used to damage the entities armor.
Damage Reduction by Resistances
Each attack type has a corresponding resistance attribute. The remaining attack type amounts are reduced by resistance using the following formula:
attack_type_amount = attack_type_amount - (attack_type_amount * attack_type_resistance_attribute) / 100;
Effects of the Attack
The remaining attack type amounts apply their effects to the attacked entity.
Bleeding Build-Up
If the damage type is in the "overhauleddamage:applies_bleeding" damage type tag, the attack can apply bleeding build-up. The amount is calculated by multiplying each attack type amount with a configurable multiplier and adding up the results.
Burn Build-Up
The applied burn build-up is simply the fire_amount.
Chilled Effect and Freeze Build-Up
Frost damage applies the Chilled effect. The effect duration is the frost_amount * a configurable multiplier.
The applied freeze build-up is simply the frost_amount.
Stagger Build-Up
If no attempt was made to block/parry the attack with a shield, then stagger build-up is applied now. The amount is calculated by multiplying each attack type amount with a configurable multiplier and adding up the results.
Poison Build-Up
The applied poison build-up is simply the poison_amount.
Shock Build-Up
The applied shock build-up is simply the lightning_amount.
Knockback
If no attempt was made to block/parry the attack with a shield and the Knockback Overhaul is enabled, then the attack knockback is applied now. The amount is calculated by multiplying each attack type amount with a configurable multiplier and multiplying the sum with a configurable global multiplier .
Damage applied to health/mana/stamina
The amount of "applied damage" is calculated by multiplying each remaining attack type amount with a configurable multiplier and adding up the results.
If Mana Attributes and/or Stamina Attributes is installed, a portion of "applied damage" can be taken from mana/stamina. The remaining amount of "applied damage" is then taken from the entity's health.
Integration of Overhauled Damage into vanilla Minecraft and mod packs
How exactly Overhauled Damage should be integrated into the gameplay and balance of a mod pack is highly subjective, which is why most features can be configured extensively and/or use data driven methods for configuration.
Most features have default values that are somewhat reasonable and could be used as a baseline for customisations.
If you have any questions or problems when configuring Overhauled Damage, you can contact me on GitHub or Discord.
API
Overhauled Damage provides a Java API that allows any Mob entity to deal damage with a custom damage type.
Implement the "UsesCustomDamageType" interface and override the "overhauleddamage$getCustomDamageType()" method.
Built-in Data Packs
Overhauled Damage also comes with several built-in data packs, which further integrate existing or add new content.
Overhauled Damage Enchantments
This data pack adds several new enchantments:
- Bleeding Protection
- Frost Aspect
- Frost Protection
- Lightning Aspect
- Lightning Protection
- Poison Aspect
- Poison Protection
Vanilla Enchantments Overhaul
This data pack reworks some vanilla enchantments to use mechanics introduced by Overhauled Damage.
This includes:
- Blast Protection
- Fire Aspect
- Fire Protection
- Projectile Protection
- Protection
评论 0
登录后参与评分
还没有评论,来抢沙发吧