Armor Fix for All Weapons
Makes armor reduce damage from ALL weapon types (instead of only ranged) and fixes some ranged weapons where armor was working too much (shotgun) or not at all (Oda’s gun).
The Problem:
Thanks to some observations by Scissors123454321 that shotguns and some other weapons were doing very little damage to the player, I discovered some weird stuff in the game’s armor logic. After some digging, it looks like there are some incorrect data values the game uses to calculate damage reduction for armor for certain weapons, but not others.
Armor is supposed to reduce damage by 0.1 DPS per point of armor. That’s what it says in the game. That means that the reduction per hit is different for each weapon, since a shotgun or submachine gun hits more often and for smaller amounts of damage than a rifle or something like that.
In the unmodded game, when processing a hit to the player, the game pulls an “attacksPerSec” stat for the weapon the NPC is using and uses that and the armor point amount to calculate the damage reduction. The problem is that the attacksPerSec value is clearly wrong for a few ranged weapons, and is 0 for all melee weapons, causing those to be unaffected by armor. I don’t know if making melee weapons unaffected by armor is intentional or not.
For my armor_works_against_melee mod I just changed attacksPerSec to a new value I found through experimentation whenever it was set to 0. This was ok for melee weapons, but didn’t fix the problem with shotguns and other weapons which I didn’t know about.
The Solution:
My new solution for all weapons is to calculate attacksPerSec using the NPC’s DPS value (determined by their level and the difficulty setting) and the damage of the hit, making the armor damage reduction consistent across all attacks. This results in an identical reduction for most ranged weapons, and a corrected reduction for shotguns (used to be reduced by over 100% for a typical amount of armor), turrets (same), Oda’s smart gun (no reduction in unmodded game), and probably some other weapons I didn’t encounter in my testing. If you want to test the effects yourself, note that armor can’t reduce damage below 1. So you should be able to see that shotgun blasts do as low as 1 damage to you per bullet in the unmodded game if you have a normal amount of armor for your level.
Note: NPCs do not have armor. There is a perk that makes tech weapons ignore armor, I think, and if that has any affect it must be processed somewhere else. Maybe it just grants a bonus to damage.
Installation
Make sure to DELETE armor_works_against_melee if you were using that one. If you use Lifepath Bonuses and Gang/Corp Traits you can just skip this mod because I will incorporate this fix into that mod. They modify the same redscript function, so I have to do it that way.
IMPORTANT: This mod depends on redscript. Download and install that first!
To install this mod, extract the zip file into the Cyberpunk 2077 installation folder (the mod files go to “Cyberpunk 2077/r6/scripts”).