View difference between Paste ID: tLFjijSa and spv4YzaZ
SHOW: | | - or go back to the newest paste.
1-
! This formula only applies to mods using CoC 1.5 R7 damage calculation ! Currently only Anomaly 1.5 beta 3.0 and later versions are officially using this system. It includes new values for greater control, matching calculation between the player and human NPCs, and new calculation of bleeding.
1+
--[[
2
NOTE: This formula only applies to mods using CoC 1.5 R7 damage calculation ! Currently only Anomaly 1.5 beta 3.0 and later versions are officially using this system. It includes new values for greater control, matching calculation between the player and human NPCs, and new calculation of bleeding.
3
4
This is for fire_wound hit type (aka bullets) only!
5
6
AP is the penetration value: k_ap * ap_modifier | k_ap is the ammo configuration; ap_modifier is a new weapon stat to enable more accurate simulation of ballistics; AP is also used for material penetration
7
BoneArmor (BA) is the second value per bone in damages.ltx sections. It is basically the amount of body armor or protection per area.
8
hit_fraction is also found in damages.ltx, but only for NPCs. Player values are set per outfit in their section.
9
HitPower is the raw damage value: hit_power * k_hit * bullet_hit_power_k -- weapon damage * ammo * suppressor | It is very important to note that bullet drop also affects the final damage output. Damage linearly scales with how much velocity was lost since the projectile left the muzzle. This means if your muzzle velocity was 800, but only 400 on impact, the damage will be cut in half. The game also simulates ballistic coefficient, which is controlled by a global (air_resistance_k) and per ammo (k_air_resistance) value. This means you can determine how fast projectiles loose their speed, and thus damage.
10
hit_scale is the body part damage multiplier, found in creature configs. It is the first value, and is configured per bone/area. The third value is the bleeding multiplier.
11
ap_scale is also a new value, which I personally use to reduce large differences between AP and BoneArmor, by (kinda) skewing the formula. It is far from a perfect solution, but a simple and surprisingly effective one. It is configured in damages.ltx
12
13
This formula does not factor in bleeding. During testing I found it wildly inconsistent when displayed on the debug hud. It is very important to note that bleeding mainly depends on the difference between AP and BA (when AP is bigger) and its configuration per creature. This can be easily changed in engine by commenting or uncommenting a line which checks if AP was bigger than BA.
14
One more important note on AP: When the difference between BA and AP is more than 1.0, damage will increase over the base hit_power. This is one of the main causes of the broken system used in most Misery based mods, resulting in AP not just fighting body armor, but providing increase in raw damage and bleeding.
15
There is something important missing from this formula (albeit for a good reason): The first value in damages.ltx right before BA. This is one more multiplier for final damage that only applies if AP > BA is true. Why would I leave it out? Well, I very very strongly recommend never using it. I played around with it included, and all it ever did was create inconsistency holes where the final damage jumps up or down when close to the threshold.
16
17
- Balathruin -
18-
Use this site to run the code: https://www.lua.org/cgi-bin/demo
18+
19
Use this site to run the code: https://www.lua.org/cgi-bin/demo ]]--
20
21
local AP = 0.2
22
local BoneArmor = 0.1
23
local hit_fraction = 0.5
24
local HitPower = 0.5
25
local hit_scale = 1
26
local ap_scale = 0.75
27
28
local d_hit_power = (AP - BoneArmor) / (AP * ap_scale)
29-
d_hit_power = hit_fraction
29+
30
    d_hit_power = hit_fraction
31-
 if d_hit_power > 1 then -- clamp in engine
31+
32-
 d_hit_power = 1
32+
if d_hit_power > 1 then -- clamp in engine
33-
 end
33+
    d_hit_power = 1
34
end
35
36
HitPower = HitPower * d_hit_power * hit_scale
37
 
38
print(HitPower)