Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- X-Ray S.T.A.L.K.E.R. bullet/protection calculation
- Basic Hit order of operation
- -----------------------------
- Where HitPower is hit_power * k_hit
- Where AP is k_ap
- -----------------------------
- *NOTE* This is for fire_wound damage type only! Bullets!
- 1. We start off with HitPower (ie. hit_power * k_hit)
- 2. If NPC, then HitPower is multiplied by rank immunity: (immunities_novice_k + (immunities_experienced_k - immunities_novice_k) * (rank/100); where rank is clamped between 0 and 100)
- 3. HitThroughArmor check for Helmet and Outfit:
- * BoneArmor (2nd param from damages.ltx) is multiplied by EquipmentCondition
- * if BoneArmor is less than or equal to zero goto step 4
- * if AP <= BoneArmor then HitPower is multiplied by hit_fraction_actor
- * if AP > BoneArmor:
- d_hit_power = (AP - BoneArmor) / AP;
- if (d_hit_power < hit_fraction) { d_hit_power = hit_fraction }
- HitPower = HitPower * d_hit_power
- 4. HitPower is multiplied by (creature hit type immunity minus booster immunity)
- 5. Health lost is HitPower*health_hit_scale*BoneScale (actor.ltx);
- *NOTES*
- * This formula applies to both NPC and Actor, with the exception of rank immunity being applied and the fact that NPCs don't wear outfits. It's only applied if they are have an outfit slotted.
- * Do not confuse immunity in calculation above with outfit immunities. This is strictly the immunities from the creature section!
- You can test this calculation by pasting and running this code: https://pastebin.com/ZfmSRhPd
- Into https://www.lua.org/demo.html
- -------------------------------------------
- How it works for other damage types
- -------------------------------------------
- 1. We start off with base HitPower
- 2. If damage type is wound, wound2, strike or explosion then 'factor' is 1.0. If not, then 'factor' is 0.1.
- 3. HitPower is calculated as (HitTypeProtection*EquipmentCondition) * factor
- 4. If damage type is radiation, telepathic or chemical burn: HitPower = HitPower - BoosterProtection
- 4. HitPower = HitPower * (CreatureImmunity - BoosterImmunity)
- 5. HitPower = HitPower*health_hit_scale
- 6. If type is Wound, then HitPower = HitPower * BoneScale
- 7. Health - HitPower
- Final Formulas:
- Burn | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
- ChemicalBurn | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
- Explosion | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
- Radiation | m_fDeltaRadiation += ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) )
- Shock | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
- Strike | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
- Telepatic | m_fHealthLost = ( (HitPower -((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
- Wound | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale * m_fHitBoneScale
- -------------------------------------------
- Understanding damages.ltx:
- -------------------------------------------
- bone = coeff, BoneArmor, bonePassBullet
- 1. Coefficient (Used only in multiplayer calculation which is slightly different then above)
- 2. Bone Armor
- 3. Value greater then 0.5 means bullets can pass through bone. Default is 0 if unspecified. (unused in singleplayer)
- -------------------------------------------
- Understanding Outfit/Helmet Immunity
- -------------------------------------------
- hit_power *= GetHitImmunity(hit_type)
- condition - hit_power
- 1. Immunity only affects the piece of equipment or item. It determines how much an item degrades when taking damage from a certain damage type.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement