Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Yet another LCS source question: effect of lower quality and damaged armor  (Read 1181 times)

enigma74

  • Bay Watcher
    • View Profile

I'm trying to look into the C++ source (at least I think it's C++) of the LCS code for the effects of damaged and inferior quality armor on the armor base stats.  It'd be nice to know if my third rate heavy body armor stacks up with the first-rate army body armor.

Here's what I'm pretty sure about so far, but I'd like a confirmation to someone who can actually read this.  Damage code for combat.cpp:
Spoiler (click to show/hide)
I think this means any damaged armor has it's armor values cut in half, unless I misunderstand the comment.  The next part, dealing with quality and armor penetration is completely beyond me:
Spoiler (click to show/hide)
I'm sure there's another section of the code I'm missing that's really important, but I wouldn't know better.  Specifically, I'm trying to find the effects of each worse quality modifier (second rate, third rate, etc) on armor values.  I suspect that each negative quality modifier reduces the total armor by -1 in an incremental fashion.

« Last Edit: September 14, 2011, 01:17:32 pm by enigma74 »
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Yet another LCS source question: effect of lower quality and damaged armor
« Reply #1 on: September 14, 2011, 01:29:00 pm »

I have no idea what "mod" is, but it seems like the "armor" value (whatever that represents) gets decremented by 1 for each step down in quality. I think. It's hard to examine that code completely out of context like that.
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Yet another LCS source question: effect of lower quality and damaged armor
« Reply #2 on: September 14, 2011, 02:40:51 pm »

The first block of code you quoted refers exclusively to the effect of bunker gear on fire damage. Damaged bunker gear halves fire damage, while undamaged bunker gear -- regardless of quality -- quarters it.

In the second code block, each total armor point reduces mod2 by 1, damaged gear reduces mod2 by an additional 1. Twice mod2 is subtracted from mod if mod2 is positive -- so armor has no effect on mod if it's so damaged that the effect would be negative. The actual damage is altered based on mod -- if mod is below 0, damage is reduced greatly, and if it's above 0, it's increased greatly. mod is a measure of how "critical" or "glancing" the blow is.

Example:

1. mod starts out at 0 (a glancing blow). You have a first-rate armor 2 item. mod2 becomes 2, mod becomes -4, and the damage inflicted is 1/16 normal.

2. mod starts out at 2 (a well-aimed hit). You have a fourth-rate armor 2 item. mod2 becomes -1 (your armor is shoddy to the point of uselessness), mod is unchanged and remains 2, and the damage inflicted is four times normal.

3. mod starts out at 5 (a vital hit). You have a damaged second-rate armor 7 item. mod2 becomes 5 (-1 for damage, -1 for quality), mod becomes -5 (-[5*2] for mod2), and the damage inflicted is 1/16 normal. Thick armor, even if shoddy, saved you from a good blow. If it's a rifle, you'll probably still take damage and be bleeding, but not be killed.

4. mod starts out at 18, because the attacker is a flippin' ninja. You are an Abrams tank with armor plating of 15. mod2 becomes -15, mod becomes -12, and damage inflicted is 1/64 normal. Have fun hacking that tank apart with your sword.

The base damage coming into this is determined by the weapon; shotguns and assault rifles can do huge damage, while a syringe is likely to have negligible base damage. Obviously, even an empty fist, with a sufficiently high mod value, with do crippling damage, and a katana with a very negative mod value will only shave a few unnoticeable points off the enemy's health (especially because tanks don't bleed out after being cut). The initial value of mod is determined by the health of the target (high health reduces it, low health increases it) and the relative attack and defense rolls (a huge to-hit roll increases it, a glancing blow reduces it). Even if all factors favor the defender, mod will never go below 0 and thus result in less than normal damage unless armor is applied.



Edit: Pardon, as complicated as my explanation is, it's still wrong -- though it's close. mod2 also includes another random amount of armor (0-armor) and subtracts off the armorpenetration value of the weapon. For melee weapons, armorpenetration goes up by 1 for each 4 points of strength you have above the minimum strength needed to use the weapon effectively. So a good ninja will have some armorpenetration against the tank, but is still unlikely to cleave through it. I won't change my examples because I don't have time. I have work to do. :)
« Last Edit: September 14, 2011, 02:50:15 pm by Jonathan S. Fox »
Logged

enigma74

  • Bay Watcher
    • View Profile
Re: Yet another LCS source question: effect of lower quality and damaged armor
« Reply #3 on: September 14, 2011, 04:03:18 pm »

Thank you very much!  Now, I don't understand the exact math you used because I am unfamiliar with the modulo operator - if that's what it is No it seems you are using mod and mod2 as simple variables, I see that now.  But I understand that each point of armor reduces damage in what seems to be an exponential function.

So if I get this right:
Start with base armor value.  Subtract 1 for damaged armor, and 1 more for each 'rate quality' it is below first-rate armor.  The damage is reduced by a geometric function linked to "damamount".  However, you have to factor in the attacker's armor penetration.

What this means in-game, I think, is that a single point of armor is actually very important.  Poor quality damaged civilian body armor (initial value of 5) won't help very much, but even fourth-rate damaged heavy body armor (with initial value 10) is still useful.
« Last Edit: September 14, 2011, 04:27:56 pm by enigma74 »
Logged