Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
bloodregen.c
Go to the documentation of this file.
2 {
3  override void Init()
4  {
5  m_TrackActivatedTime = false;
6  m_ID = eModifiers.MDF_BLOOD_REGEN;
9  }
10 
11  override bool ActivateCondition(PlayerBase player)
12  {
13  float m_MaxBlood = player.GetMaxHealth("GlobalHealth", "Blood");
14  if ( player.GetHealth("GlobalHealth", "Blood") <= m_MaxBlood )
15  {
16  return true;
17  }
18  else
19  {
20  return false;
21  }
22  }
23 
24  override void OnActivate(PlayerBase player)
25  {
26  }
27 
28 
29  override bool DeactivateCondition(PlayerBase player)
30  {
31  float m_MaxBlood = player.GetMaxHealth("GlobalHealth", "Blood");
32  if ( player.GetHealth("GlobalHealth", "Blood") >= m_MaxBlood )
33  {
34  return true;
35  }
36  else
37  {
38  return false;
39  }
40  }
41 
42  override void OnTick(PlayerBase player, float deltaT)
43  {
44  float regen_modifier_water = GetRegenModifierWater( player.GetStatWater().Get() );
45  float regen_modifier_energy = GetRegenModifierEnergy( player.GetStatEnergy().Get() );
46  float blood_regen_speed = PlayerConstants.BLOOD_REGEN_RATE_PER_SEC * regen_modifier_water * regen_modifier_energy;
47  /*
48  PrintString("regen_modifier_water" + regen_modifier_water);
49  PrintString("regen_modifier_energy" + regen_modifier_energy);
50  PrintString("blood_regen_speed" + blood_regen_speed);
51  */
52  player.AddHealth("","Blood", blood_regen_speed * deltaT );
53  }
54 
55  float GetRegenModifierWater(float water)
56  {
57  float modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_WATER_HIGH;
58  int water_level = m_Player.GetStatLevelWater();
59 
60  /*
61  if( water < PlayerConstants.BLOOD_REGEN_THRESHOLD_WATER_MID ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_WATER_MID}
62  if( water < PlayerConstants.BLOOD_REGEN_THRESHOLD_WATER_LOW ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_WATER_LOW}
63  */
64 
65  if( water_level == EStatLevels.MEDIUM ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_WATER_MID}
66  if( water_level >= EStatLevels.LOW ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_WATER_LOW}
67 
68  return modifier;
69  }
70 
71  float GetRegenModifierEnergy(float energy)
72  {
73  float modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_ENERGY_HIGH;
74  int energy_level = m_Player.GetStatLevelEnergy();
75 
76  //if( energy < PlayerConstants.BLOOD_REGEN_THRESHOLD_ENERGY_MID ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_ENERGY_MID}
77  //if( energy < PlayerConstants.BLOOD_REGEN_THRESHOLD_ENERGY_LOW ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_ENERGY_LOW}
78 
79  if( energy_level == EStatLevels.MEDIUM ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_ENERGY_MID}
80  if( energy_level >= EStatLevels.LOW ) {modifier = PlayerConstants.BLOOD_REGEN_MODIFIER_ENERGY_LOW}
81 
82  return modifier;
83  }
84 
85 
86 };
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
BloodRegenMdfr
Definition: bloodregen.c:1
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
PlayerBase
Definition: playerbaseclient.c:1
PlayerConstants
Definition: playerconstants.c:1
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
EStatLevels
EStatLevels
Definition: estatlevels.c:1
m_ID
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition: effect.c:49
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition: modifiersmanager.c:33