168 {
169 float dmg_max =
m_Player.GetMaxHealth(zone,
"Blood");
170 float bleed_threshold =
GetGame().
ConfigGetFloat(
"CfgAmmo " + ammo +
" DamageApplied bleedThreshold");
172 bleed_threshold = Math.Clamp(bleed_threshold,0,1);
173 float bleedingChance;
174 bool createBleedingSource = false;
175
176
177 if (BleedChanceData.CalculateBleedChance(damageTypeString, damage, bleed_threshold,bleedingChance))
178 {
179 float roll = Math.RandomFloat01();
180 createBleedingSource = bleedingChance != 0 && bleedingChance >= roll;
181
182 #ifdef ENABLE_LOGGING
183 if (LogManager.IsBleedingChancesLogEnable())
184 {
185 Debug.BleedingChancesLog(roll.
ToString(),
"BleedingSourcesManagerServer" ,
"n/a",
"bleeding random roll:");
186 }
187 #endif
188 }
189 else if (source && source.IsZombie())
190 {
191 int chance = Math.RandomInt(0,100);
192 if (chance <= damage)
193 {
194 createBleedingSource = true;
195 }
196 }
197 else if (damage > (dmg_max * (1 - bleed_threshold)))
198 {
199 createBleedingSource = true;
200 }
201
202 if (createBleedingSource)
203 {
204 #ifdef ENABLE_LOGGING
205 if (LogManager.IsBleedingChancesLogEnable())
206 {
207 Debug.BleedingChancesLog(
"true",
"BleedingSourcesManagerServer" ,
"n/a",
"Attempting to create bleeding source");
208 }
209 #endif
211 }
212 }
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool AttemptAddBleedingSource(int component)
proto native float ConfigGetFloat(string path)
Get float value from config on path.
string ConfigGetTextOut(string path)
Get string value from config on path.
proto string ToString(bool simple=true)
proto native CGame GetGame()