Advertisement
revolucas

hit_fraction_npc

Aug 16th, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1.     float hit_power = HDS.power * m_fRankImmunity;
  2.  
  3.     if(m_boneHitProtection && HDS.hit_type == ALife::eHitTypeFireWound)
  4.     {
  5.         float BoneArmor = m_boneHitProtection->getBoneArmor(HDS.bone());
  6.         float ap = HDS.armor_piercing;
  7.         if(!fis_zero(BoneArmor, EPS))
  8.         {
  9.             if(ap > BoneArmor)
  10.             {
  11.                 float d_hit_power = (ap - BoneArmor) / ap;
  12.                 if(d_hit_power < m_boneHitProtection->m_fHitFracNpc)
  13.                     d_hit_power = m_boneHitProtection->m_fHitFracNpc;
  14.  
  15.                 hit_power *= d_hit_power;
  16.                 VERIFY(hit_power>=0.0f);
  17.             }
  18.             else
  19.             {
  20.                 hit_power *= m_boneHitProtection->m_fHitFracNpc;
  21.                 HDS.add_wound = false;
  22.             }
  23.         }
  24.  
  25.         if ( wounded() ) //уже лежит => добивание
  26.         {
  27.             hit_power = 1000.f;
  28.         }
  29.     }
  30.     HDS.power = hit_power;
  31.  
  32.  
  33.  
  34.  
  35. --------------------------------------
  36. void  CDamageManager::HitScale          (const int element, float& hit_scale, float& wound_scale, bool aim_bullet)
  37. {
  38.     if(BI_NONE == u16(element))
  39.     {
  40.         //считаем что параметры для BI_NONE заданы как 1.f
  41.         hit_scale = 1.f * m_default_hit_factor;
  42.         wound_scale = 1.f * m_default_wound_factor;
  43.         return;
  44.     }
  45.  
  46.     IKinematics* V      = smart_cast<IKinematics*>(m_object->Visual());         VERIFY(V);
  47.     // get hit scale
  48.     float scale = 0.f; 
  49.  
  50.     if ( aim_bullet )
  51.     {
  52.         scale           = V->LL_GetBoneInstance(u16(element)).get_param(3);
  53.     }
  54.  
  55.     // in case when not 1st bullet or 1st bullet has scale unset (== 0)
  56.     if ( !aim_bullet || !scale )
  57.     {
  58.         scale           = V->LL_GetBoneInstance(u16(element)).get_param(0);
  59.     }
  60.  
  61.     hit_scale           = scale;
  62.    
  63.     // get wound scale
  64.     scale               = V->LL_GetBoneInstance(u16(element)).get_param(2);
  65.     wound_scale         = scale;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement