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