Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
woundinfection2.c
Go to the documentation of this file.
2 {
3  static const int AGENT_THRESHOLD_ACTIVATE = 250;
4  static const int AGENT_THRESHOLD_DEACTIVATE = 0;
5 
6  static const int PAIN_EVENT_INTERVAL_MIN = 6;
7  static const int PAIN_EVENT_INTERVAL_MAX = 12;
8 
9 
10  static const float DAMAGE_PER_SEC = 0.04;
11 
12  protected float m_NextEvent;
13  protected float m_Time;
14 
15  override void Init()
16  {
17  m_TrackActivatedTime = false;
18  m_ID = eModifiers.MDF_WOUND_INFECTION2;
21  m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_WOUND_INFECT_2;
22  }
23 
24  override string GetDebugText()
25  {
26  return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
27  }
28 
29  override protected bool ActivateCondition(PlayerBase player)
30  {
31  if(player.GetSingleAgentCount(eAgents.WOUND_AGENT) >= AGENT_THRESHOLD_ACTIVATE)
32  {
33  return true;
34  }
35  else
36  {
37  return false;
38  }
39  }
40 
41  override protected void OnActivate(PlayerBase player)
42  {
43  player.IncreaseDiseaseCount();
44  m_NextEvent = Math.RandomFloatInclusive( PAIN_EVENT_INTERVAL_MIN, PAIN_EVENT_INTERVAL_MAX );
45 
46  SymptomBase shivers = player.GetSymptomManager().QueueUpSecondarySymptomEx(SymptomIDs.SYMPTOM_HAND_SHIVER);
47  if ( shivers )
48  {
49  CachedObjectsParams.PARAM1_INT.param1 = 3;
50  shivers.SetParam(CachedObjectsParams.PARAM1_INT);
51  }
52 
53  }
54 
55  override protected void OnDeactivate(PlayerBase player)
56  {
57  player.DecreaseDiseaseCount();
58  player.GetSymptomManager().RemoveSecondarySymptom(SymptomIDs.SYMPTOM_HAND_SHIVER);
59  }
60 
61  override protected bool DeactivateCondition(PlayerBase player)
62  {
63  if(player.GetSingleAgentCount(eAgents.WOUND_AGENT) <= AGENT_THRESHOLD_DEACTIVATE)
64  {
65  return true;
66  }
67  else
68  {
69  return false;
70  }
71  }
72 
73  override protected void OnTick(PlayerBase player, float deltaT)
74  {
75  m_Time += deltaT;
76 
77  if ( m_Time >= m_NextEvent )
78  {
79  if( player.IsAntibioticsActive() )
80  {
81  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_PAIN_LIGHT);
82  }
83  else
84  {
85  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_PAIN_HEAVY);
86  float damage = m_Time * (DAMAGE_PER_SEC + player.GetHealthRegenSpeed());
87  player.AddHealth("","", -damage);
88  }
89 
90  m_Time = 0;
91  m_NextEvent = Math.RandomFloatInclusive( PAIN_EVENT_INTERVAL_MIN, PAIN_EVENT_INTERVAL_MAX );
92  }
93 
94 
95  }
96 };
m_Time
protected float m_Time
Definition: carscript.c:146
m_SyncID
eModifierSyncIDs m_SyncID
Definition: modifierbase.c:29
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
CachedObjectsParams
Definition: utilityclasses.c:9
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
SymptomBase
Definition: statebase.c:1
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
PlayerBase
Definition: playerbaseclient.c:1
eAgents
eAgents
Definition: eagents.c:2
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
eModifierSyncIDs
eModifierSyncIDs
Definition: modifiersmanager.c:2
WoundInfectStage2Mdfr
Definition: woundinfection2.c:1
Math
Definition: enmath.c:6
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