Redo damage system, Armor system
yeelp opened this issue ยท 4 comments
The attribute system works, but it's flawed. Attack Speed, Armor and Armor Toughness need to be reapplied as AttributeModifiers which is fine initially, but there's two fatal flaws:
-
Sweep attacks: Mobs in sweep range take full damage, because of how the DamageHandler calculates damage. Fixing this would be annoying and finicky.
-
Attack Cooldown: Attack Speed means nothing if the player inflicts the same amount of damage no matter what. Implementing a cooldown tracker for this system is indicative of huge flaws in the system itself.
SOLUTION: Switch to Capabilities. The Capability represents the spread of the damage across the 3 categories, not the actual amount of damage the weapon inflicts. Wooden Pickaxes, for example, could have a 50% spread between Piercing and Bludgeoning. It doesn't matter how much damage the Wooden Pickaxe does, half the damage will be inflicted as Piercing and the other half as Bludgeoning. The spread is a physical property of the tool itself, taking into account material and construction (read: tool type). Thus, having it modifiable by attributes makes no sense. This also takes care of how to apply potion effects, criticals and attribute modifiers, as any increase in damage is now spread out over the three damage categories according to the tool's damage type distribution.
Armor seems to work fine with attributes, but maybe it's better to switch it over to capabilities anyway?
There's also the question of how armor should be done in the first place. Should the regular armor system as we know it be applicable to this damage calculation or should reduction only be done by armor resistances provided by this mod? I think a distribution system similar to damage would work great but this may be a little trickier to get Minecraft to handle.
Here's an idea. Armor as a whole will be stripped of armor and armor toughness points. Any armor or armor toughness provided through external means (think: Iron Skin and Diamond Skin from PotionCore) behave as normal, but armor itself will only block (or increase!) what's specified in its resistances/weaknesses. Armors not listed in the config will keep their armor and armor toughness points, but provide no additional resistances. The new resistance system can have a 'toughness' property that behaves similarly to armor toughness, but this is by no means necessary.
There are some damage sources that aren't assigned a damage type by Distinct-Damage-Descriptions due to not being from an mob attack, item, or projectile, such as being in lava, standing on/in magma blocks, cactus, and sweet berry bushes, suffocating, and more. In vanilla, armor reduces damage taken from some of these sources (such as being in lava or cactus). With this mod installed, will armor still reduce damage taken from damage sources that aren't assigned a damage type?
Additionally, will all damage be treated the same when it comes to damaging the armor itself (in terms of durability), or will some damage types damage the armor more than others?
So the current plan (which has changed slightly from what was previously mentioned here) is as follows:
Cactus (and if a more modern version of the mod is made, sweet berry bushes) counts as piercing damage, and explosions may count as bludgeoning damage. Other damage sources that are normally blocked by armor in vanilla will continue to be blocked and handled the exact same way.
When it comes to damaging the armor, durability damage is done based on how much damage gets absorbed by each armor piece, per damage type (Basically an extension of Minecraft's way of doing it). So depending on how an attack is distributed, some damage types may end up reducing durability more than others. But there's no particular bias towards any damage type.
This is of course all subject to change. The biggest problem is that there are lots of ways to implement a more complicated/dynamic armor system, but no one "right" way. Finding an armor system that serves this mod's needs best is trickier than I originally thought. The basic idea is that each armor piece should have strengths and weaknesses, and with ideal config setup, there shouldn't exist armor pieces that outclass every other armor piece in the game, undermining the whole system. What's the point of the player side combat changes this mod makes as a whole if full diamond armor still makes you almost invincible?