Advertisement
revolucas

Basic Hit order of operation

Jan 18th, 2017
1,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. X-Ray S.T.A.L.K.E.R. bullet/protection calculation
  2. Basic Hit order of operation
  3. -----------------------------
  4. Where HitPower is hit_power * k_hit
  5. Where AP is k_ap
  6. -----------------------------
  7. *NOTE* This is for fire_wound damage type only! Bullets!
  8. 1. We start off with HitPower (ie. hit_power * k_hit)
  9. 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)
  10. 3. HitThroughArmor check for Helmet and Outfit:
  11. * BoneArmor (2nd param from damages.ltx) is multiplied by EquipmentCondition
  12. * if BoneArmor is less than or equal to zero goto step 4
  13. * if AP <= BoneArmor then HitPower is multiplied by hit_fraction_actor
  14. * if AP > BoneArmor:
  15. d_hit_power = (AP - BoneArmor) / AP;
  16. if (d_hit_power < hit_fraction) { d_hit_power = hit_fraction }
  17. HitPower = HitPower * d_hit_power
  18.  
  19. 4. HitPower is multiplied by (creature hit type immunity minus booster immunity)
  20. 5. Health lost is HitPower*health_hit_scale*BoneScale (actor.ltx);
  21.  
  22. *NOTES*
  23. * 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.
  24. * Do not confuse immunity in calculation above with outfit immunities. This is strictly the immunities from the creature section!
  25.  
  26. You can test this calculation by pasting and running this code: https://pastebin.com/ZfmSRhPd
  27. Into https://www.lua.org/demo.html
  28.  
  29. -------------------------------------------
  30. How it works for other damage types
  31. -------------------------------------------
  32. 1. We start off with base HitPower
  33. 2. If damage type is wound, wound2, strike or explosion then 'factor' is 1.0. If not, then 'factor' is 0.1.
  34. 3. HitPower is calculated as (HitTypeProtection*EquipmentCondition) * factor
  35. 4. If damage type is radiation, telepathic or chemical burn: HitPower = HitPower - BoosterProtection
  36. 4. HitPower = HitPower * (CreatureImmunity - BoosterImmunity)
  37. 5. HitPower = HitPower*health_hit_scale
  38. 6. If type is Wound, then HitPower = HitPower * BoneScale
  39. 7. Health - HitPower
  40.  
  41. Final Formulas:
  42. Burn | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
  43. ChemicalBurn | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
  44. Explosion | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
  45. Radiation | m_fDeltaRadiation += ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) )
  46. Shock | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
  47. Strike | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
  48. Telepatic | m_fHealthLost = ( (HitPower -((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale
  49. Wound | m_fHealthLost = ( (HitPower - ((HitTypeProtection*EquipmentCondition) * 0.1) - BoosterProtection) * (CreatureImmunity - BoosterImmunity) ) * health_hit_scale * m_fHitBoneScale
  50. -------------------------------------------
  51. Understanding damages.ltx:
  52. -------------------------------------------
  53. bone = coeff, BoneArmor, bonePassBullet
  54.  
  55. 1. Coefficient (Used only in multiplayer calculation which is slightly different then above)
  56. 2. Bone Armor
  57. 3. Value greater then 0.5 means bullets can pass through bone. Default is 0 if unspecified. (unused in singleplayer)
  58.  
  59. -------------------------------------------
  60. Understanding Outfit/Helmet Immunity
  61. -------------------------------------------
  62. hit_power *= GetHitImmunity(hit_type)
  63. condition - hit_power
  64.  
  65. 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