Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
influenzaagent.c
Go to the documentation of this file.
2{
4
5 protected const float INVASIBILITY_INC_LOW_HC = 0.40;
6 protected const float INVASIBILITY_INC_MEDIUM_HC = 0.60;
7 protected const float INVASIBILITY_INC_CRITICAL_HC = 0.70;
8
9 protected const float INVASIBILITY_DEC_COMMON_COLD = -0.3;
10 protected const float INVASIBILITY_DEC_INFLUENZA = -0.3;
11 protected const float INVASIBILITY_DEC_PNEUMONIA = 0.00;
12
13 protected const int MAX_TIME_TO_CONTRACT = 8650;
14 protected const int CONTRACT_TIME_THRESHOLD_MIN = 10;
15 protected const int CONTRACT_TIME_THRESHOLD_MAX = 200;
16
18
19 protected const float CONTRACT_HEATCOMFORT_MODIFIER[3] = {
20 0.25, // low
21 0.6, // medium
22 1.0, // critical
23 };
24
25 protected int m_ElapsedTime;
26
27 override void Init()
28 {
29 m_Type = eAgents.INFLUENZA;
30 m_Invasibility = 0.33;
33 m_MaxCount = 1200;
34 m_Digestibility = 0.1;
35 m_AntibioticsResistance = 0; //deprecated, use m_DrugResistances to initialize this agents resistance to a specific drug, as seen on lines 42
38 m_Potency = EStatLevels.MEDIUM;
39 m_DieOffSpeed = 0.30;
40 m_ElapsedTime = 0.0;
41 m_DrugResistances.Set(EMedicalDrugsType.ANTIBIOTICS, 0.0);
42 }
43
44 override bool AutoinfectCheck(float deltaT, PlayerBase player)
45 {
46 if (!player.m_AgentPool.GetTemporaryResistance(eAgents.INFLUENZA))
47 {
48 float heatcomfort = player.GetStatHeatComfort().Get();
50 {
51 float subtractTimeModifier;
53
54 if (heatcomfort <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING && heatcomfort > PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL)
55 subtractTimeModifier = CONTRACT_HEATCOMFORT_MODIFIER[0];
56 else if (heatcomfort <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL && heatcomfort > PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_EMPTY)
57 subtractTimeModifier = CONTRACT_HEATCOMFORT_MODIFIER[1];
59 subtractTimeModifier = CONTRACT_HEATCOMFORT_MODIFIER[2];
60
61 float subtractTimeModified = subtractTimeRandomized * subtractTimeModifier;
62
63 m_TimeToContract -= subtractTimeModified;
65 {
66 m_ElapsedTime = 0;
68
69 return true;
70 }
71
72 m_ElapsedTime += deltaT;
73 }
74 else
75 {
76 m_ElapsedTime = Math.Clamp(m_ElapsedTime - deltaT, 0.0, float.MAX);
78 }
79 }
80
81 return false;
82 }
83
84 override bool CanAutoinfectPlayer(PlayerBase player)
85 {
86 if (player.GetStatHeatComfort().Get() < INFLUENZA_AGENT_AUTOINFECT_THRESHOLD_HC)
87 return true;
88
89 return false;
90 }
91
92 override float GetInvasibilityEx(PlayerBase player)
93 {
94 float heatComfort = player.GetStatHeatComfort().Get();
95
97 {
98 if (player.GetModifiersManager().IsModifierActive(eModifiers.MDF_PNEUMONIA))
100 if (player.GetModifiersManager().IsModifierActive(eModifiers.MDF_INFLUENZA))
102
104 }
105
106 if (heatComfort <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING && heatComfort > PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL)
108 else if (heatComfort <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL && heatComfort > PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_EMPTY)
112
114 }
115
117 {
118 if (player.GetModifiersManager().IsModifierActive(eModifiers.MDF_PNEUMONIA))
119 return EStatLevels.GREAT;
120
121 return super.GetPotencyEx(player);
122 }
123
124 override float GetDieOffSpeedEx(PlayerBase player)
125 {
126 if (player.GetModifiersManager().IsModifierActive(eModifiers.MDF_ANTIBIOTICS))
127 return GetDieOffSpeed() * 3;
128 else if (player.GetModifiersManager().IsModifierActive(eModifiers.MDF_IMMUNITYBOOST))
129 return GetDieOffSpeed() * 2;
130
131 return super.GetDieOffSpeedEx(player);
132 }
133}
int m_AutoinfectCount
Definition agentbase.c:9
float m_TransferabilityOut
to the player
Definition agentbase.c:6
float m_TransferabilityIn
how fast the agent grows when potent enough to grow
Definition agentbase.c:5
float m_TransferabilityAirOut
Definition agentbase.c:11
int m_MaxCount
multiplier for agents digested in the player stomach from an infected item(agents_transfered = digest...
Definition agentbase.c:8
float GetDieOffSpeed()
Definition agentbase.c:63
float m_DieOffSpeed
grow when player's immune system is at this level or lower
Definition agentbase.c:17
float m_Type
Definition agentbase.c:3
float m_Invasibility
Definition agentbase.c:4
void AgentBase()
how fast the agent dies off when not potent enough to grow(per sec)
Definition agentbase.c:19
EStatLevels m_Potency
Definition agentbase.c:16
float m_Digestibility
from the player
Definition agentbase.c:7
float m_AntibioticsResistance
transferibility airborne out
Definition agentbase.c:12
ref map< EMedicalDrugsType, float > m_DrugResistances
[0..1], 0 means antibiotics have full effect, 1 means no effect - deprecated, use the m_DrugResistanc...
Definition agentbase.c:14
const int AGENT_THRESHOLD_ACTIVATE
Definition commoncold.c:3
const float INVASIBILITY_INC_LOW_HC
const float CONTRACT_HEATCOMFORT_MODIFIER[3]
const float INVASIBILITY_DEC_INFLUENZA
const float INVASIBILITY_DEC_COMMON_COLD
override bool CanAutoinfectPlayer(PlayerBase player)
override float GetDieOffSpeedEx(PlayerBase player)
const int CONTRACT_TIME_THRESHOLD_MAX
min value of time [s] for subtraction from MAX_TIME_TO_CONTRACT (used for randomization)
override void Init()
const float INVASIBILITY_INC_CRITICAL_HC
int m_TimeToContract
max value of time [s] for subtraction from MAX_TIME_TO_CONTRACT (used for randomization)
const float INVASIBILITY_INC_MEDIUM_HC
const float INVASIBILITY_DEC_PNEUMONIA
override bool AutoinfectCheck(float deltaT, PlayerBase player)
const int MAX_TIME_TO_CONTRACT
const int CONTRACT_TIME_THRESHOLD_MIN
at this time [s], character will contract the disease
const float INFLUENZA_AGENT_AUTOINFECT_THRESHOLD_HC
override EStatLevels GetPotencyEx(PlayerBase player)
override float GetInvasibilityEx(PlayerBase player)
Definition enmath.c:7
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const float THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL
static const float THRESHOLD_HEAT_COMFORT_MINUS_EMPTY
eAgents
Definition eagents.c:3
EMedicalDrugsType
eModifiers
Definition emodifiers.c:2
const int MAX
Definition enconvert.c:27
EStatLevels
Definition estatlevels.c:2
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition enmath.c:106