DayZ 1.24
Loading...
Searching...
No Matches
BleedChanceData Class Reference

Static data of bleeding chance probabilities; currently used for melee only. More...

Inheritance diagram for BleedChanceData:
[legend]
Collaboration diagram for BleedChanceData:
[legend]

Static Private Member Functions

static void InitBleedChanceData ()
 
static void InitMeleeChanceMap ()
 
static void InitInfectedChanceMap ()
 
static void Cleanup ()
 
static bool CalculateBleedChance (string damageType, float bloodDamage, float bleedThreshold, out float bleedChance)
 returns 'false' when damageType is unhandled
 

Static Private Attributes

static const float BLOOD_HITPOINTS_UNIVERSAL = 100.0
 
static ref map< string, ref BleedChanceMaxMapm_DamageTypeMap
 

Additional Inherited Members

- Private Member Functions inherited from Managed
void IntroSceneCharacter ()
 
void ~IntroSceneCharacter ()
 
bool IsDefaultCharacter ()
 
void SetToDefaultCharacter ()
 
void SetCharacterID (int char_id)
 
int GetCharacterID ()
 
PlayerBase GetCharacterObj ()
 
TStringArray GetCharGenderList ()
 
TStringArray GetCharList (ECharGender gender)
 
TStringArray GetCharShirtsList ()
 
TStringArray GetCharPantsList ()
 
TStringArray GetCharShoesList ()
 
void SetCharacterGender (ECharGender gender)
 
bool IsCharacterFemale ()
 
ECharGender GetCharacterGender ()
 
vector GetPosition ()
 
int GetNextCharacterID ()
 
int GetPrevCharacterID ()
 
void CreateNewCharacterRandom ()
 
void CreateNewCharacterById (int character_id)
 
void CreateNewCharacterByName (string character_name, bool randomize_equip=true)
 
void CreateDefaultCharacter ()
 
void GetLastPlayedServer (int characterID, out string address, out string name, out int port)
 
void CreateNewCharacter ()
 
void LoadCharacterData (vector char_pos, vector char_rot, bool default_char=false)
 Generates random equip for the new IntroSceneCharacter, whatever is defined in 'cfgCharacterCreation'.
 
void CharacterUnload ()
 
void CharacterLoad (int character_id, vector char_pos, vector char_rot)
 
void SetupPlayerName (bool new_name)
 
void SetAttachment (string type, int slot)
 
string GetCharacterNameById (int char_id)
 
string GetCharacterName ()
 
void SaveCharName (string name)
 
void SaveDefaultCharacter ()
 
void TransferValues (PlayerBase player)
 
void Init ()
 
void OnScheduledTick (float deltatime)
 
void CheckValues ()
 
float GetBlood ()
 
float GetHealth ()
 
void CheckHealth ()
 
void CheckBlood ()
 
void SendInitValues ()
 Sends values on object creation.
 
void SendValue (int value_type, float value)
 
void ReceiveValue (int value_type, float value)
 
void OnRPC (ParamsReadContext ctx)
 
void ShowDebugValues (bool show)
 
void BleedingIndicator (int source_ID, int severity, GameplayEffectsDataBleeding parent)
 
void InitIndicator (vector position)
 
void StopIndicator (bool instant=false)
 
void StartRunningDrops ()
 
bool IsRunningDrops ()
 Are any drops currently being animated?
 
void TrySpawnNextDrop ()
 
void ResetSequence ()
 
void ResetIndicator ()
 
void Update (float timeSlice)
 
bool GetEndNow ()
 
int GetSeverity ()
 
void GameplayEffectsData (array< ref Widget > input, int type, int user_override=-1)
 
void Init (array< ref Widget > input, int type, Widget layout_root, int user_override=-1)
 
array< ref WidgetGetWidgetSet ()
 
int GetWidgetSetType ()
 
int GetWidgetSetID ()
 
bool HasDefinedHandle ()
 Returns 'true' if this class contains update info.
 
bool DataInitialized ()
 
void UpdateVisibility (bool state)
 
void RegisterData (Param p)
 
void Update (float timeSlice=0, Param p=null, int handle=-1)
 
void ForceStop ()
 
- Private Attributes inherited from Managed
int m_CharacterId
 
string m_CharacterType
 
MenuData m_CharacterDta
 
PlayerBase m_CharacterObj
 
vector m_CharacterPos
 
vector m_CharacterRot
 
ref TStringArray m_CharGenderList = new TStringArray
 
ref TStringArray m_CharShirtList = new TStringArray
 
ref TStringArray m_CharPantsList = new TStringArray
 
ref TStringArray m_CharShoesList = new TStringArray
 
ref map< ECharGender, ref array< string > > m_Characters = new map<ECharGender, ref array<string>>
 
ECharGender m_CharGender
 
bool m_InitialSyncSent
 
bool m_Initialized
 
bool m_Terminating = false
 
bool m_EndNow = false
 
bool m_IsRunning = false
 
int m_DropSpawnsQueued
 
int m_ActiveDropsCount
 
int m_Severity
 
int m_SourceID
 
GameplayEffectsDataBleeding m_ParentMetaData
 
array< floatm_DropProbabilityArray
 
float m_AverageFrequency
 
float m_SequenceTick
 
float m_SequenceDuration
 
float m_TimeElapsedTotal
 
float m_TimeElapsedSequence
 
float m_LastDropSpawnTime
 
float m_DropSpawnMinDelay
 
float m_DropSpawnMaxDelay
 
int m_CurrentDropProbabilityStep
 
int m_DropProbabilityRollsCount
 
vector m_BasePosition
 
ref set< ref BleedingIndicatorDropDatam_ActiveDrops
 
ref set< intm_CleanupQueue
 
ref array< ref Widgetm_WidgetArray
 
int m_Type
 
int m_WidgetSetIdentifier
 
Widget m_LayoutRoot
 

Detailed Description

Static data of bleeding chance probabilities; currently used for melee only.

Definition at line 4 of file BleedChanceData.c.

Member Function Documentation

◆ CalculateBleedChance()

static bool BleedChanceData::CalculateBleedChance ( string damageType,
float bloodDamage,
float bleedThreshold,
out float bleedChance )
inlinestaticprivate

returns 'false' when damageType is unhandled

Definition at line 70 of file BleedChanceData.c.

71 {
73 if (!bleedChanceMap)
74 return false;
75
79
80#ifdef DEVELOPER
82 {
83 Debug.BleedingChancesLog(armor.ToString(), "BleedChanceData", "n/a", "armor:");
84 Debug.BleedingChancesLog(bleedThreshold.ToString(), "BleedChanceData", "n/a", "bleedThreshold:");
85 }
86#endif
87
88 //unexpected values, unhandled
90 {
91 bleedChance = 1.0;
92
93#ifdef DEVELOPER
95 Debug.BleedingChancesLog(bleedChance.ToString(), "BleedChanceData", "n/a", "Unhandleed values, default bleeding chance used:");
96#endif
97
98 return true;
99 }
100
101 if (bleedChanceMap.Contains(valueLower))
103 else
104 {
105 float chanceMaxActual;
106
107 float floor = Math.Floor(valueLower / 10) * 10;
108 float ceil = Math.Ceil(valueLower / 10) * 10;
109 float pos = Math.InverseLerp(floor, ceil, valueLower);
110
111 float chanceMin = bleedChanceMap.Get(floor);
112 float chanceMax = bleedChanceMap.Get(ceil);
113
116 }
117
118#ifdef DEVELOPER
120 Debug.BleedingChancesLog(bleedChance.ToString(), "BleedChanceData", "n/a", "bleeding chance:");
121#endif
122
123 return true;
124 }
static ref map< string, ref BleedChanceMaxMap > m_DamageTypeMap
static const float BLOOD_HITPOINTS_UNIVERSAL
Definition Debug.c:14
static void BleedingChancesLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:213
static bool IsBleedingChancesLogEnable()
Definition Debug.c:814
Definition EnMath.c:7
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.

References Debug::BleedingChancesLog(), BLOOD_HITPOINTS_UNIVERSAL, Math::Ceil(), Math::Floor(), Math::InverseLerp(), LogManager::IsBleedingChancesLogEnable(), Math::Lerp(), m_DamageTypeMap, Math::Max(), and Math::Min().

Referenced by BleedingSourcesManagerBase::ProcessHit().

◆ Cleanup()

static void BleedChanceData::Cleanup ( )
inlinestaticprivate

Definition at line 64 of file BleedChanceData.c.

65 {
66 delete m_DamageTypeMap;
67 }

References m_DamageTypeMap.

Referenced by CGame::~DayZGame().

◆ InitBleedChanceData()

static void BleedChanceData::InitBleedChanceData ( )
inlinestaticprivate

Definition at line 10 of file BleedChanceData.c.

References InitInfectedChanceMap(), InitMeleeChanceMap(), and m_DamageTypeMap.

Referenced by CGame::DayZGame().

◆ InitInfectedChanceMap()

static void BleedChanceData::InitInfectedChanceMap ( )
inlinestaticprivate

Definition at line 41 of file BleedChanceData.c.

42 {
43 if (m_DamageTypeMap.Contains("Infected"))
44 ErrorEx("'Infected' damage type bleed chances already initialized!");
45
47
48 //keys have to be integers, recalculated later
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);
60
61 m_DamageTypeMap.Set("Infected", bleedChanceMaxMap);
62 }
map< int, float > BleedChanceMaxMap
enum ShapeType ErrorEx

References BLOOD_HITPOINTS_UNIVERSAL, ErrorEx, and m_DamageTypeMap.

Referenced by InitBleedChanceData().

◆ InitMeleeChanceMap()

static void BleedChanceData::InitMeleeChanceMap ( )
inlinestaticprivate

Definition at line 18 of file BleedChanceData.c.

19 {
20 if (m_DamageTypeMap.Contains("Melee"))
21 ErrorEx("'Melee' damage type bleed chances already initialized!");
22
24
25 //keys have to be integers, recalculated later
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);
37
39 }

References BLOOD_HITPOINTS_UNIVERSAL, ErrorEx, and m_DamageTypeMap.

Referenced by InitBleedChanceData().

Member Data Documentation

◆ BLOOD_HITPOINTS_UNIVERSAL

const float BleedChanceData::BLOOD_HITPOINTS_UNIVERSAL = 100.0
staticprivate

◆ m_DamageTypeMap

ref map<string, ref BleedChanceMaxMap> BleedChanceData::m_DamageTypeMap
staticprivate

The documentation for this class was generated from the following file: