Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
influenza.c
Go to the documentation of this file.
2 {
3  const int AGENT_THRESHOLD_ACTIVATE = 300;
4  const int AGENT_THRESHOLD_DEACTIVATE = 200;
5 
6  override void Init()
7  {
8  m_TrackActivatedTime = false;
9  m_ID = eModifiers.MDF_INFLUENZA;
12  }
13 
14  override string GetDebugText()
15  {
16  return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
17  }
18 
19  override protected bool ActivateCondition(PlayerBase player)
20  {
21  if(player.GetSingleAgentCount(eAgents.INFLUENZA) >= AGENT_THRESHOLD_ACTIVATE)
22  {
23  return true;
24  }
25  return false;
26  }
27 
28  override protected void OnActivate(PlayerBase player)
29  {
30  player.IncreaseDiseaseCount();
31  }
32 
33  override protected void OnDeactivate(PlayerBase player)
34  {
35  player.DecreaseDiseaseCount();
36  }
37 
38  override protected bool DeactivateCondition(PlayerBase player)
39  {
40  return (player.GetSingleAgentCount(eAgents.INFLUENZA) <= AGENT_THRESHOLD_DEACTIVATE);
41  }
42 
43  override protected void OnTick(PlayerBase player, float deltaT)
44  {
45  float chance_of_cough = player.GetSingleAgentCountNormalized(eAgents.INFLUENZA);
46 
47  if( Math.RandomFloat01() < chance_of_cough / Math.RandomInt(5,20) )
48  {
49  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
50  }
51  }
52 };
InfluenzaMdfr
Definition: influenza.c:1
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
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
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