DayZ 1.24
Loading...
Searching...
No Matches
Cholera.c
Go to the documentation of this file.
2{
3 static const int AGENT_THRESHOLD_ACTIVATE = 250;
4 static const int AGENT_THRESHOLD_DEACTIVATE = 50;
5
6 static const int CHANCE_OF_VOMIT = 10;
7 static const int CHANCE_OF_VOMIT_AGENT = 30;
8 static const int WATER_DRAIN_FROM_VOMIT = 450;
9 static const int ENERGY_DRAIN_FROM_VOMIT = 310;
10 static const float WATER_LOSS_CHOLERA = 0.5;
11 static const float WATER_LOSS_CHOLERA_MIN = 0.1; // min multiplier of WATER_LOSS_CHOLERA
12 static const float STOMACH_MIN_VOLUME = 200; // for vomit symptom
13
21
22 override string GetDebugText()
23 {
24 return ("Activate threshold: " + AGENT_THRESHOLD_ACTIVATE + "| " + "Deativate threshold: " + AGENT_THRESHOLD_DEACTIVATE);
25 }
26
27 override protected bool ActivateCondition(PlayerBase player)
28 {
29 if (player.GetSingleAgentCount(eAgents.CHOLERA) >= AGENT_THRESHOLD_ACTIVATE)
30 return true;
31 else
32 return false;
33 }
34
35 override protected void OnActivate(PlayerBase player)
36 {
37 player.IncreaseDiseaseCount();
38 }
39
40 override protected void OnDeactivate(PlayerBase player)
41 {
42 player.DecreaseDiseaseCount();
43 }
44
45 override protected bool DeactivateCondition(PlayerBase player)
46 {
47 if (player.GetSingleAgentCount(eAgents.CHOLERA) <= AGENT_THRESHOLD_DEACTIVATE)
48 return true;
49 else
50 return false;
51 }
52
53 override protected void OnTick(PlayerBase player, float deltaT)
54 {
55 float water_loss = (deltaT * (WATER_LOSS_CHOLERA * Math.Max(WATER_LOSS_CHOLERA_MIN, player.GetSingleAgentCountNormalized(eAgents.CHOLERA))));
56 //Print( ( WATER_LOSS_CHOLERA * Math.Max( WATER_LOSS_CHOLERA_MIN, player.GetSingleAgentCountNormalized( eAgents.CHOLERA ) ) ) );
57 player.GetStatWater().Add(-water_loss);
58
59 float stomach_volume = player.m_PlayerStomach.GetStomachVolume();
61 {
62 int roll = Math.RandomInt(0, 100);
63 if (roll < (CHANCE_OF_VOMIT + (CHANCE_OF_VOMIT_AGENT * player.GetSingleAgentCountNormalized(eAgents.CHOLERA))))
64 {
65 SymptomBase symptom = player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT);
66 if (symptom)
67 {
68 symptom.SetDuration(Math.RandomIntInclusive(4, 8));
69
70 if (m_Player.GetStatWater().Get() > (WATER_DRAIN_FROM_VOMIT))
71 m_Player.GetStatWater().Add(-1 * WATER_DRAIN_FROM_VOMIT);
72 if (m_Player.GetStatEnergy().Get() > (ENERGY_DRAIN_FROM_VOMIT))
73 m_Player.GetStatEnergy().Add(-1 * ENERGY_DRAIN_FROM_VOMIT);
74 }
75 }
76 }
77 }
78};
eAgents
Definition EAgents.c:3
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
DayZPlayer m_Player
Definition Hand_Events.c:42
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
void OnTick(PlayerBase player, float deltaT)
Definition Cholera.c:53
static const int CHANCE_OF_VOMIT
Definition Cholera.c:6
static const float WATER_LOSS_CHOLERA
Definition Cholera.c:10
static const int AGENT_THRESHOLD_DEACTIVATE
Definition Cholera.c:4
bool ActivateCondition(PlayerBase player)
Definition Cholera.c:27
static const float WATER_LOSS_CHOLERA_MIN
Definition Cholera.c:11
void OnActivate(PlayerBase player)
Definition Cholera.c:35
override string GetDebugText()
Definition Cholera.c:22
void OnDeactivate(PlayerBase player)
Definition Cholera.c:40
bool DeactivateCondition(PlayerBase player)
Definition Cholera.c:45
static const int AGENT_THRESHOLD_ACTIVATE
Definition Cholera.c:3
static const int WATER_DRAIN_FROM_VOMIT
Definition Cholera.c:8
static const int CHANCE_OF_VOMIT_AGENT
Definition Cholera.c:7
static const int ENERGY_DRAIN_FROM_VOMIT
Definition Cholera.c:9
override void Init()
Definition Cholera.c:14
static const float STOMACH_MIN_VOLUME
Definition Cholera.c:12
Definition EnMath.c:7
eModifiers
Definition eModifiers.c:2
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54