Armor mechanics

Posts
13
Likes
2
Hello,

I have been told that armor (AR) is NOT 1:1 with hitpoints (HP).

If AR was 1:1 with HP, if I took 10 damage from a blaster and I had 100 HP and 30 AR, I would end up with 100 HP and 20 AR.

How does AR function in the code?

Thank you.
 

{Δ} Achilles

Banned
Nerd
Posts
1,042
Likes
795
As for armor, I was informed that every point of armor drops damage by up to 50%, and that there is damage variation in that (So it isn't always consistent).

As for SBD, literally no one knows, not even the devs understand the damage reduction on SBD. There are like 2-3 different forms of damage reduction on SBD and some of it is very specific, and my questions to devs have largely gone with them going "Wait, what?" halfway through looking at the code. So my best advice to worrying about SBDs is: They're overpowered, just shoot them and move on.
 

Hexodious

Moderator
Movie Battles II Team
Posts
722
Likes
722
Armour affects hit location modifier bonuses on top of raw additional points. @GoodOl'Ben was actually looking at this part of the code yestery and should be able to clarify further.
 

Noob

Just a Guy
Donator
Movie Battles II Team
Posts
1,523
Likes
1,638
SBD have 1 hitbox afaik, there are no dmg modifiers for where you hit an SBD
 

Tempest

Gameplay Design
Movie Battles II Team
Posts
740
Likes
1,137
For reference, "heavy" weapons are these "mod" (explained in the armor calculations):
FALLING, EXPLOSIVE, TRIGGER_HURT + electrical/flame/poison variants, WATERELECTRICAL, FORCE_DESTRUCTION, VEHICLE (not sure if this applies to deka or if deka weapons are changed to something like blasters), emplaced turrets, Clone blobs, SBD cannons, ion blasts (not sure if this is referring to the big cannon or something else), sniper weapons, terrain mounted turrets (like on RC), rockets, TDs, all grenades except cryoban, and lightsabers (checked for in regards to which armor is being used/calculated against).

Only damage modifiers on SBD are in regards to what kind of armor it has (mag plating, blast armor, cortosis) as well as battery level. They work as follows:
- Mag plating: Reduces damage to 60% of whatever the current (in the function) "damage" calculated value is.
- Cortosis: When you hit an SBD, there's a 1.5s timer that is set. For each time you hit an SBD in general, it increments what's called the "Cortosis Vulnerability Hit Count". If the on-hit timer has been exceeded, this value is reset back to 0. When hitting the SBD, if you've hit it once, "damage" is reduced to 20% of its current calculated value. If twice, then to 40%.
- Blast armor: If it's melee, "damage" is reduced to 80% of its current value. If it's a "heavy" projectile weapon, then "damage" is reduced to 60% of its current calculated value.

Then it goes to battery levels:
If you're not in low power mode, you get damage reduction as follows:
- If you have >= 70 battery, damage reduction factor is 0.4
- If you have >= 40 battery, damage reduction factor is 0.3
Otherwise, damage reduction factor is 0.2.
"damage" then has a reduction of "damage * damage reduction factor).

Battery drain is then calculated as follows:
- Set initial BatteryDrain value to ("damage" / 3).
- If you have cortosis and "mod" is a saber, BatteryDrain is then set to 33% of its current value.
BatteryDrain is then subtracted from your battery pool.
P.S. If you have 0 battery, you can then be knocked over.

Armor calculation is as follows:
CheckArmor function is fed the following variables:
  • "damage" - value based on weapon base damage, modifiers like cortosis, class modifiers (wook fury), and a gazillion other small things that can make it go up or down
  • "flags" - special modifiers like only taking damage from sabers, no knockback (since this is tied into damage b/c janky code), etc
  • "mod" - means of damage aka source of damage; basically specifies the weapon type (which can then be combined with class checks for open mode for specific instances), force power used, and so on.
  • "location damage modifier" - pretty self explanatory
THEN (this isn't going to go into details regarding specific interactions of things, just general process)

- Initially, total damage that can be negated via armor is initially set to "damage".

FIRST
Check if "mod" is a saber via slashes or saber throw:
- If so, Check: If negatable damage >= 1.2 * current armor -> negatable damage is set to (1.2 * current armor). I guess armor gives 20% extra damage reduction vs sabers? TIL.

Else (otherwise):
IF the target is not a deka OR if "mod" is a rocket) && "flags" includes DAMAGE_HALF_ABSORB (Only rockets (direct hits, not splash damage) bypass droideka shields. - copypaste from comments):

1a) Check if "location damage modifier" has a non-zero value (checks if negatable damage > ("damage" * ARMOR_PROTECTION (which is 0.50 so that 50% value was accurate in some manner) * "location damage modifier". If so, negatable damage is set to "damage" * ARMOR_PROTECTION, otherwise negatable damage is set to current armor / "location damage modifier".
1b) If "location damage modifier" is zero, negatable damage is set to ceil("damage" * ARMOR_PROTECTION). If save >= count, it's set to count. Side note about ceil:
ceil function returns the smallest integer that is greater than or equal to x (ie: rounds up the nearest integer).

ELSE (to the deka and such things check):
1a) Check IF "location damage modifier" has a non-zero value -> Checks if current armor > (damage * "location damage modifier"). If so, set negatable damage equivalent to "damage". Otherwise, set negatable damage to (current armor / "location damage modifier").
1b) ELSE, check IF (negatable damage >= current armor -> if so, set negatable damage to current armor).

SECOND
2) If no negatable damage, return 0 to the G_Damage function that called CheckArmor. This would then be used as the value for sorting out the damage to be dealt.

THIRD
IF "mod" is a saber via slashing/saber throw:
3) if "flags" has DAMAGE_HALF_ARMOR_REDUCTION, armor is reduced in the amount of (negatable damage / 1.2* ARMOR_REDUCTION_FACTOR, which is 0.50)). Otherwise, armor is reduced in the amount of negatable damage / 1.2
ELSE
IF "flags" has DAMAGE_HALF_ARMOR_REDUCTION....
3a) Check if "location damage modifier" is non-zero -> if so, reduce armor by (negatable damage * "location damage modifier" * ARMOR_REDUCTION_FACTOR). Otherwise, reduce armor by "location damage modifier" * ARMOR_REDUCTION_FACTOR.
ELSE (to DAMAGE_HALF_ARMOR_REDUCTION flag)
3b) Check if "location damage modifier" is non-zero -> armor is reduced by negatable damage * "locational damage modifier". Otherwise, reduce armor by negatable damage.

FOURTH
We exit the CheckArmor function. If there's any non-zero value returned from the function, amount of armor to be reduced is set to that value. Physical damage is also set to that same value for some reason...

FIFTH
Lots of weird vehicle related stuff.

SIXTH
Set all the stuff like who attacked the target to whoever did it. Then mark the damage to be dealt to armor and health as well as how much knockback is to be done.

TL;DR
This is why I started cleaning up the damage code.
 
Last edited:

StarWarsGeek

Internal Beta Team
Posts
497
Likes
403
I guess armor gives 20% extra damage reduction vs sabers? TIL.
This is a relatively recent addition (from when Stassin was still working on sabers I think). If I remember right, the reason this was done is to prevent blue from 1-hitting full armor ET/commanders.
 
Top