Distinct Damage Descriptions

Distinct Damage Descriptions

7.9k Downloads

Config options to control how much of each physical (and custom) damage type is blocked by shields

James103 opened this issue ยท 2 comments

commented

What if there was a way to configure how much of each damage type is blocked when you are blocking with a shield?
Example: you could make it so vanilla shields block 100% bludgeoning damage, 75% slashing damage, and 25% piercing damage. Any damage that gets through the shield block is handled as if you were not blocking with a shield.

Compatibility with Spartan Shields should allow you to specify how much damage of each type is blocked by each of the shields added by that mod. For example, you could make it so Gold shields don't block piercing damage, while only the Diamond and Obsidian tier shields block "Mega" damage (a custom damage type dealt by giant mobs).

commented

Each shield would have to extend ItemShield. If Tinker's Battle Signs extended ItemShield then they'd work to (although I don't think they do).

I need to look at Forge events and vanilla's source for a bit to see if such a thing were plausible. I want to say of course yes, but I shouldn't be too hasty.

I'd love to check the source for Spartan Shields to check and make sure they extend ItemShield, but it seems to be closed source.

commented

Seems possible. First I'd need to listen to a LivingAttackEvent, and determine if an entity is blocking with a shield at that time and if the attack location lines up with the shield. If so, I'll need to reduce the incoming damage appropriately. Then, I set the damage source to be unblockable with shields so it bypasses the vanilla checks, causing the rest of the damage to go through (hopefully this won't cause problems with other mods). I'll damage the shield by the amount absorbed, as per usual. The knockback vector the attacking entity is subjected to, if it exists, will be the exact same as vanilla, but I'll scale it to the percent of damage absorbed. e.g. if 30% of damage is absorbed by the shield then the attacking entity only gets 30% of the usual knockback.

I can extend such a mechanic to CraftTweaker scripts as well, by firing an event that I expose to ZenScript.