Improved Damage Framework

Improved Damage Framework

10.1k Downloads

 

 

I'm a modpack creator, but I don't think all my players are going to want to read an entire essay on how combat works in my pack. Can I still use IDF?

Yes! Don't worry. I designed this mod with my own friends in mind, and they are all very ADHD. Some are borderline illiterate. This mod follows the common assumption of "BIGGER NUMBER = BETTER! :D" I have also made things clear in the UI what is good and what is bad (green text = good, red = bad, etc..). Anyone should be able to pick up and play an IDF-based pack with no issues. Perhaps not entirely optimally, but I believe a system in which players who don't want to bother optimizing and min-maxing can play alongside those who do is good game design.

Comes with borderlands-style hit indicators, and a health bar instead of hearts!

Press "o" to open your stat screen! (configurable).

New item tooltips! Also includes basic flat addition and multiplication enchantments. Only 1 flat and 1 amp enchant is allowed on each piece of equipment. The borders around the tooltip are from the mod LegendaryTooltips. IDF comes with integration to use elemental-looking borders based on the weapon's damage. (Make sure to remove the default selectors for rarity in LegendaryTooltips' config! Otherwise, all enchanted items will use the fire border.)

Install Patchouli to have a bestiary of all vanilla mobs and their stats! Documentation on how to add entries from other mods will be released in the future.

What are the new attributes?

  • Vanilla "Attack Damage," "Armor," and "Armor Toughness" stats have been renamed to "Physical Damage," "Physical Resistance," and "Defense" respectively.
  • New elemental attributes have been added: Fire, water, lightning, magic, and dark. These also have damage and resistance attributes.
  • New auxiliary attributes have been added: Force, lifesteal, armour penetration, critical chance, and evasion.
  • Special "damage classes" have been introduced: Strike, pierce, slash, crush, and generic.
  • Every mob has 5x their base health and 2x their base physical damage. For example, the player has a base of 100 max health and 2 physical damage, whereas in vanilla Minecraft the player has a base of 20 max health and 1 attack damage. Health is now displayed as a bar instead of as hearts to improve visibility. The armour bar has been removed in favour of a stat screen.

How does the new damage system work?

  • Defense (formerly "Armor Toughness"), is now an important stat that is used by every mob. When damage is calculated, the force attribute of the attacker will be compared with the defense attribute of the defender, and a damage multiplier (Max. double damage, Min. half damage) will be applied based on the difference.
  • Damage Classes are a new system introduced by IDF to further diversify mobs and weapons. There are five damage classes: strike, pierce, slash, crush, and generic. Every living entity has a modifier relating to each of these classes, and every weapon is of a certain damage class. For example, an iron sword is a weapon of the slash damage class. Zombies have a 125% slash modifier. An attack against a zombie with an iron sword will have a 1.25x damage modifier applied. This bonus stacks multiplicatively with the force/defense multiplier.
  • Enchantment resistances are now a percentage resistance to their specified damage sources that increases at a fixed rate per level. Fall, blast, projectile, and explosion resistance reduce total damage by 6.25% per level. This means, for example, that wearing a full set of blast protection 4 armour will grant 100% damage reduction from explosions (4 levels x 4 armour pieces x 6.25% = 100%). The general protection enchantment is weaker, granting 1.875% damage reduction per level for a total of 30% at 16 total levels.
  • Potion effect resistance, rather than decreasing damage taken by a percentage, increases all resistance values of the defender by a 20% per level. So, having the resistance 4 effect applied means you effectively have 1.8x of your normal resistances.
  • After all these multipliers are applied, the final damage of each element is reduced by the defender's damage reduction percentage for the respective element. Negative damage reduction is possible and as expected increases the damage taken by that element.

How do my resistance attributes get translated into percentage damage reduction?

  • Resistance does NOT get converted one to one into percentage damage reduction! Instead, the total resistance of the player is run through a math formula to determine how much damage reduction it should equate to. This ensures that the player cannot go over 100% damage reduction, and smoothes out of the curve for different values.

Combat Mechanics:

These changes are small changes that I believe make combat better and more interesting for the player or are necessary for weapon diversity.

  • Attacks at less than or equal to 30% strength will have no effect.
  • Attacks at less than or equal to 80% strength will have no knockback.
  • Attacks that are not full strength will not apply lifesteal.
  • Shields no longer have a 5-tick delay to raise.
  • The force of bow attacks is multiplied by the velocity of the arrow. The force of player attacks is influenced by the attack strength, such that at full strength the player will swing with their full force attribute.
  • Player and mob attacks ignore target i-frames. Slimes and magma cubes are exempt from this as their form of attack is contact damage. Because of this change, targets with active i-frames will no longer take the difference in damage when hit with a damage source stronger than the original one.
  • Target knockback from any attack has been removed. Knockback is determined based on the force/defense ratio, sprinting, and the attacker's knockback attribute.
  • Natural sources of damage, like lava, fire, cactus, etc. have been changed to deal %maxhp damage. Lava deals the most at 20%maxhp, while cactus, poison, starvation, and berry bushes deal the least at 5%maxhp. Everything else is somewhere in between.
  • Thorns enchantment now deals 1% of the attacker's maxhp for every level of thorns the defender is wearing.
  • Fall damage now grows exponentially. It starts to ramp up and become dangerous at around 13 blocks of height.
  • Explosions do 5x their usual damage.

Auxiliary Attributes:

  • Lifesteal is an attribute that ranges from 0 to 100%. It heals a percentage of total post-mitigation damage dealt by the attacker. On melee attacks from a player, it will only proc if the attack was full strength.
  • Armour penetration is also an attribute that ranges from 0 to 100%. It causes the attacker to ignore a percentage of the defender’s physical resistance. It does not reduce any of the other resistances.
  • Critical chance is the new implementation of Minecraft’s default critical hit system. Players will no longer crit when attacking when falling. Now, the player has an attribute called critical chance that ranges from 0 to 100%. Any given attack dealt by the player has that percentage chance to crit.
  • Evasion is a defensive attribute that also ranges from 0 to 100%. When attacked, the defender will have that percentage chance for the attack to not have any effect.

Why make all these changes?

    The goal of IDF, as stated before, is to diversify the combat and adventuring aspects of minecraft. In vanilla Minecraft, this isn’t as much of an issue as there are few combat options. In modpacks, however, the issue arises that one weapon usually emerges that eclipses all others. This relegates huge portions of content. Why bother going through a mod’s progression system, if the end result of that mod is a sword that does less damage than what you have already? Why go on an adventure to find dungeons, structures, and loot, if you already have the best gear?

    By adding elemental damage types and resistances, every weapon is allowed to shine in some way. Maybe your sword does a lot of fire damage, but what if you need to go to the nether and fight blazes? Should you get a water damage sword? Or maybe avoid the issue and create a sword that does a mix of water and fire damage. The possibilities are endless.

    The health and damage changes were made because it allows weapons to have greater differences in attributes, since mobs will have far greater max health.

 

I'm a mod developer, and I want to make an addon to IDF. How do I do that?

I actually originally started developing IDF because I wanted to make weapon mods, so I made sure to make the API easy to use. Add IDF to your dev environment, and you should be good to go. There are two events you can hook into, called PreMitigationDamageEvent and PostMitigationDamageEvent. To make equipment, extend IDFSwordItem, IDFDiggerItem, IDFTier, IDFArmourItem, or IDFArmourMaterial instead of their vanilla counterparts. I will update the API and write better documentation when I have the time. I will also post my example mod soon.

I'm a pack developer. How do I configure all this?

Compatibility + Configuration

    With such a large-scale rework, it may seem like most mods wouldn’t be compatible. This is not the case. I designed this mod with modpacks in mind, and 99% of mods should be compatible out of the box. This is because of the way vanilla attributes are handled, in that vanilla damage, armour, and armour toughness are still used albeit in a different way. What this means is that damage sources from other mods will simply do all physical damage, and armour will only provide physical damage and defense. The armour toughness rating will likely need to be edited by the pack creator to balance everything since defense(armour toughness) plays a huge role in how the game works with IDF’s changes. This brings us to the config section.

    IDF will generate multiple config files. In the common config toml file, you can find a list of DamageSource msgId’s that will be allowed to ignore i-frames and a list of entities that are blacklisted from ignoring i-frames (only takes effect if “mob” is contained in the first list). In the client config, there is the option to disable the change to the health display and the option to re-add the armour hud display.

    Most importantly, inside “config/ImprovedDamageFramework,” you can find 8 files that allow you to change the attributes of every mob and item in the game. I will explain each of these files one by one:

 

entity_data.json:

  • For vanilla attributes, the value you put here will be ADDED to what the mob already has. For example, giving zombies 2 armour/physical resistance in this file will mean zombies in-game have 4 armour/physical resistance, since zombies have a base of 2 armour in vanilla Minecraft. For attributes that are NOT in the base game, the value you put here will of course be exactly what the mob gets in-game. I.e, giving zombies 4 fire damage means they have 4 fire damage in-game. 
  • Most mobs have a base of 0 knockback, so putting 0.4 for this will give them standard knockback as IDF removes the default knockback feature of Minecraft.
  • BE CAREFUL with how movement speed works. It is not how you think. If you want to change this value, I’d recommend looking at the Minecraft wiki article on attribute modifiers(this file uses operation 0).
  • Lifesteal, armour penetration, and evasion should be inputted as values from 0 to 100, not 0 - 1. For example, 50.0 for lifesteal means that mob will have 50% lifesteal.
  • The damage class multipliers are inputted as values from 0 - inf, where 1.0 = 100%. For example, 1.25 for slash multiplier means that mob will take 125% damage from slash sources.
  • All the resistances, including armour, are inputted as pre-calculation values. This means putting 25 for fire resistance does not grant the mob 25% damage reduction from fire, but rather 25 fire resistance which will be calculated into a damage reduction percentage as described above.

source_catcher.json

This was specifically made for pack creators to include damage sources that are not in vanilla Minecraft. There is an example value in there for MrCrayfish's gun mod that tells IDF what to do with bullet damage. Each entry should take a DamageSource object's msgId. The element values in the json objects are conversion ratios and should total no greater than 1. Any leftover damage will be left as physical damage. So, having 0.25 for magic, 0.25 for fire, and 0 for everything else means the source will be converted to do 25% fire damage, 25% magic damage, and 50% physical damage. The armour penetration value should be 0 - 100.

weapons/armour files

  • Notice that there are 3 files for both weapons and armour. If you don’t know any of the details of how Minecraft attributes work, ignore the operation_multiply_base and operation_multiply_total files. Using the operation_addition files is very simple. Any value inputted here will be added to what the weapon or armour piece already has in that attribute.
  • Everything here is consistent with how the entity_data file works.
  • Be careful of the attack speed stat on weapons. In Minecraft, the player has a default attack speed of 4, which is usually lowered by whatever they’re holding. For example, all swords in vanilla Minecraft have an attack speed attribute of -2.4.
  • Items will only grant their attributes if equipped in the proper slot. So, giving netherite helmets +5 fire damage will only grant the wearer +5 fire damage if it's equipped in the head slot.
  • You can add any item in the game to any of these files. Just copy the formatting of any of the entries but change the name, and you’re good to go. 

Technical Things + FAQ

This section is primarily for mod authors and modpack creators who know about backend things. First of all, this mod already includes the changes made by Darkhax's maxhealthfix and attributefix. There is no need to install these 2 with IDF. This mod uses a variety of overwrite mixins to integrate properly into Minecraft. Second, IDF uses mixins to integrate properly into Minecraft. This, of course, means that mods that try to inject into these methods will be completely incompatible with IDF. The methods that IDF overwrites are the following:

- Every static method in DamageSource.class

- LivingEntity.actuallyHurt(DamageSource, float)

- Player.actuallyHurt(DamageSource, float)

- Player.attack(Entity)

LAST NOTES. THIS MOD IS IN ALPHA STAGE, AND AS SUCH THERE MAY BE BUGS, OVERSIGHTS, AND BALANCING PROBLEMS. PLEASE USE THE COMMENTS TO PROVIDE FEEDBACK ON THE THESE. COMMENTS REQUESTING VERSIONS OR MODLOADERS WILL BE IGNORED.

I UPLOADED THE MOD HERE TO MAKE IT EASIER FOR ME TO TEST IN MODPACKS. FEEL FREE TO USE AND TEST YOURSELF, BUT BE WARNED THAT THINGS MAY BE UNSTABLE AND SUBJECT TO CHANGE.