DayZ 1.24
Loading...
Searching...
No Matches
CholeraMdfr Class Reference
Inheritance diagram for CholeraMdfr:
[legend]
Collaboration diagram for CholeraMdfr:
[legend]

Protected Member Functions

bool ActivateCondition (PlayerBase player)
 
void OnActivate (PlayerBase player)
 
void OnDeactivate (PlayerBase player)
 
bool DeactivateCondition (PlayerBase player)
 
void OnTick (PlayerBase player, float deltaT)
 

Private Member Functions

override void Init ()
 
override string GetDebugText ()
 

Static Private Attributes

static const int AGENT_THRESHOLD_ACTIVATE = 250
 
static const int AGENT_THRESHOLD_DEACTIVATE = 50
 
static const int CHANCE_OF_VOMIT = 10
 
static const int CHANCE_OF_VOMIT_AGENT = 30
 
static const int WATER_DRAIN_FROM_VOMIT = 450
 
static const int ENERGY_DRAIN_FROM_VOMIT = 310
 
static const float WATER_LOSS_CHOLERA = 0.5
 
static const float WATER_LOSS_CHOLERA_MIN = 0.1
 
static const float STOMACH_MIN_VOLUME = 200
 

Detailed Description

Definition at line 1 of file Cholera.c.

Member Function Documentation

◆ ActivateCondition()

bool CholeraMdfr::ActivateCondition ( PlayerBase player)
inlineprotected

Definition at line 27 of file Cholera.c.

28 {
29 if (player.GetSingleAgentCount(eAgents.CHOLERA) >= AGENT_THRESHOLD_ACTIVATE)
30 return true;
31 else
32 return false;
33 }
eAgents
Definition EAgents.c:3
static const int AGENT_THRESHOLD_ACTIVATE
Definition Cholera.c:3

References AGENT_THRESHOLD_ACTIVATE.

◆ DeactivateCondition()

bool CholeraMdfr::DeactivateCondition ( PlayerBase player)
inlineprotected

Definition at line 45 of file Cholera.c.

46 {
47 if (player.GetSingleAgentCount(eAgents.CHOLERA) <= AGENT_THRESHOLD_DEACTIVATE)
48 return true;
49 else
50 return false;
51 }
static const int AGENT_THRESHOLD_DEACTIVATE
Definition Cholera.c:4

References AGENT_THRESHOLD_DEACTIVATE.

◆ GetDebugText()

override string CholeraMdfr::GetDebugText ( )
inlineprivate

Definition at line 22 of file Cholera.c.

23 {
24 return ("Activate threshold: " + AGENT_THRESHOLD_ACTIVATE + "| " + "Deativate threshold: " + AGENT_THRESHOLD_DEACTIVATE);
25 }

References AGENT_THRESHOLD_ACTIVATE, and AGENT_THRESHOLD_DEACTIVATE.

◆ Init()

override void CholeraMdfr::Init ( )
inlineprivate

Definition at line 14 of file Cholera.c.

15 {
17 m_ID = eModifiers.MDF_CHOLERA;
20 }
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
eModifiers
Definition eModifiers.c:2

References DEFAULT_TICK_TIME_ACTIVE, DEFAULT_TICK_TIME_INACTIVE, m_ID, m_TickIntervalActive, m_TickIntervalInactive, and m_TrackActivatedTime.

◆ OnActivate()

void CholeraMdfr::OnActivate ( PlayerBase player)
inlineprotected

Definition at line 35 of file Cholera.c.

36 {
37 player.IncreaseDiseaseCount();
38 }

◆ OnDeactivate()

void CholeraMdfr::OnDeactivate ( PlayerBase player)
inlineprotected

Definition at line 40 of file Cholera.c.

41 {
42 player.DecreaseDiseaseCount();
43 }

◆ OnTick()

void CholeraMdfr::OnTick ( PlayerBase player,
float deltaT )
inlineprotected

Definition at line 53 of file Cholera.c.

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 }
DayZPlayer m_Player
Definition Hand_Events.c:42
static const int CHANCE_OF_VOMIT
Definition Cholera.c:6
static const float WATER_LOSS_CHOLERA
Definition Cholera.c:10
static const float WATER_LOSS_CHOLERA_MIN
Definition Cholera.c:11
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
static const float STOMACH_MIN_VOLUME
Definition Cholera.c:12
Definition EnMath.c:7
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

References CHANCE_OF_VOMIT, CHANCE_OF_VOMIT_AGENT, ENERGY_DRAIN_FROM_VOMIT, m_Player, Math::Max(), Math::RandomInt(), Math::RandomIntInclusive(), STOMACH_MIN_VOLUME, WATER_DRAIN_FROM_VOMIT, WATER_LOSS_CHOLERA, and WATER_LOSS_CHOLERA_MIN.

Member Data Documentation

◆ AGENT_THRESHOLD_ACTIVATE

const int CholeraMdfr::AGENT_THRESHOLD_ACTIVATE = 250
staticprivate

Definition at line 3 of file Cholera.c.

Referenced by ActivateCondition(), and GetDebugText().

◆ AGENT_THRESHOLD_DEACTIVATE

const int CholeraMdfr::AGENT_THRESHOLD_DEACTIVATE = 50
staticprivate

Definition at line 4 of file Cholera.c.

Referenced by DeactivateCondition(), and GetDebugText().

◆ CHANCE_OF_VOMIT

const int CholeraMdfr::CHANCE_OF_VOMIT = 10
staticprivate

Definition at line 6 of file Cholera.c.

Referenced by OnTick().

◆ CHANCE_OF_VOMIT_AGENT

const int CholeraMdfr::CHANCE_OF_VOMIT_AGENT = 30
staticprivate

Definition at line 7 of file Cholera.c.

Referenced by OnTick().

◆ ENERGY_DRAIN_FROM_VOMIT

const int CholeraMdfr::ENERGY_DRAIN_FROM_VOMIT = 310
staticprivate

Definition at line 9 of file Cholera.c.

Referenced by OnTick().

◆ STOMACH_MIN_VOLUME

const float CholeraMdfr::STOMACH_MIN_VOLUME = 200
staticprivate

Definition at line 12 of file Cholera.c.

Referenced by OnTick().

◆ WATER_DRAIN_FROM_VOMIT

const int CholeraMdfr::WATER_DRAIN_FROM_VOMIT = 450
staticprivate

Definition at line 8 of file Cholera.c.

Referenced by OnTick().

◆ WATER_LOSS_CHOLERA

const float CholeraMdfr::WATER_LOSS_CHOLERA = 0.5
staticprivate

Definition at line 10 of file Cholera.c.

Referenced by OnTick().

◆ WATER_LOSS_CHOLERA_MIN

const float CholeraMdfr::WATER_LOSS_CHOLERA_MIN = 0.1
staticprivate

Definition at line 11 of file Cholera.c.

Referenced by OnTick().


The documentation for this class was generated from the following file: