21 ErrorEx(
"'Melee' damage type bleed chances already initialized!");
26 bleedChanceMaxMap.Set(0,0.0);
27 bleedChanceMaxMap.Set(10,5.0);
28 bleedChanceMaxMap.Set(20,15.0);
29 bleedChanceMaxMap.Set(30,23.4);
30 bleedChanceMaxMap.Set(40,31.2);
31 bleedChanceMaxMap.Set(50,39.0);
32 bleedChanceMaxMap.Set(60,46.8);
33 bleedChanceMaxMap.Set(70,54.6);
34 bleedChanceMaxMap.Set(80,62.4);
35 bleedChanceMaxMap.Set(90,70.2);
44 ErrorEx(
"'Infected' damage type bleed chances already initialized!");
49 bleedChanceMaxMap.Set(0,0.0);
50 bleedChanceMaxMap.Set(10,5.0);
51 bleedChanceMaxMap.Set(20,15.0);
52 bleedChanceMaxMap.Set(30,27.5);
53 bleedChanceMaxMap.Set(40,40.0);
54 bleedChanceMaxMap.Set(50,55.0);
55 bleedChanceMaxMap.Set(60,60.0);
56 bleedChanceMaxMap.Set(70,70.0);
57 bleedChanceMaxMap.Set(80,75.0);
58 bleedChanceMaxMap.Set(90,85.0);
70 static bool CalculateBleedChance(
string damageType,
float bloodDamage,
float bleedThreshold, out
float bleedChance)
96 Debug.
BleedingChancesLog(bleedChance.ToString(),
"BleedChanceData" ,
"n/a",
"Unhandleed values, default bleeding chance used:");
103 if (bleedChanceMap.Contains(valueLower))
105 bleedChance = bleedChanceMap.Get(valueLower) * valueHigher / 10000;
109 float chanceMaxActual;
111 float floor =
Math.
Floor(valueLower / 10) * 10;
112 float ceil =
Math.
Ceil(valueLower / 10) * 10;
115 float chanceMin = bleedChanceMap.Get(floor);
116 float chanceMax = bleedChanceMap.Get(ceil);
118 chanceMaxActual =
Math.
Lerp(chanceMin,chanceMax,pos);
119 bleedChance = valueHigher * chanceMaxActual / 10000;
122 #ifdef ENABLE_LOGGING
map< int, float > BleedChanceMaxMap
static void InitMeleeChanceMap()
static bool CalculateBleedChance(string damageType, float bloodDamage, float bleedThreshold, out float bleedChance)
returns 'false' when damageType is unhandled
static void InitInfectedChanceMap()
static void InitBleedChanceData()
static ref map< string, ref BleedChanceMaxMap > m_DamageTypeMap
static const float BLOOD_HITPOINTS_UNIVERSAL
Static data of bleeding chance probabilities; currently used for melee only.
static void BleedingChancesLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
static bool IsBleedingChancesLogEnable()
proto string ToString(bool simple=true)
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float Ceil(float f)
Returns ceil of value.