DayZ 1.24
Loading...
Searching...
No Matches
SalmonellaMdfr Class Reference
Inheritance diagram for SalmonellaMdfr:
[legend]
Collaboration diagram for SalmonellaMdfr:
[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 ()
 

Private Attributes

float m_Time
 
float m_NextEvent
 

Static Private Attributes

static const int AGENT_THRESHOLD_ACTIVATE = 60
 
static const int AGENT_THRESHOLD_DEACTIVATE = 20
 
static const int CHANCE_OF_VOMIT = 10
 
static const int CHANCE_OF_VOMIT_AGENT = 20
 
static const int WATER_DRAIN_FROM_VOMIT = 450
 
static const int ENERGY_DRAIN_FROM_VOMIT = 310
 
static const float STOMACH_MIN_VOLUME = 200
 
static const float EVENT_INTERVAL_MIN = 12
 
static const float EVENT_INTERVAL_MAX = 18
 

Detailed Description

Definition at line 1 of file Salmonella.c.

Member Function Documentation

◆ ActivateCondition()

bool SalmonellaMdfr::ActivateCondition ( PlayerBase player)
inlineprotected

Definition at line 32 of file Salmonella.c.

33 {
34 if (player.GetSingleAgentCount(eAgents.SALMONELLA) >= AGENT_THRESHOLD_ACTIVATE)
35 return true;
36 else
37 return false;
38 }
eAgents
Definition EAgents.c:3
static const int AGENT_THRESHOLD_ACTIVATE
Definition Salmonella.c:3

References AGENT_THRESHOLD_ACTIVATE.

◆ DeactivateCondition()

bool SalmonellaMdfr::DeactivateCondition ( PlayerBase player)
inlineprotected

Definition at line 51 of file Salmonella.c.

52 {
53 if (player.GetSingleAgentCount(eAgents.SALMONELLA) <= AGENT_THRESHOLD_DEACTIVATE)
54 return true;
55 else
56 return false;
57 }
static const int AGENT_THRESHOLD_DEACTIVATE
Definition Salmonella.c:4

References AGENT_THRESHOLD_DEACTIVATE.

◆ GetDebugText()

override string SalmonellaMdfr::GetDebugText ( )
inlineprivate

Definition at line 27 of file Salmonella.c.

28 {
29 return ("Activate threshold: " + AGENT_THRESHOLD_ACTIVATE + "| " + "Deativate threshold: " + AGENT_THRESHOLD_DEACTIVATE);
30 }

References AGENT_THRESHOLD_ACTIVATE, and AGENT_THRESHOLD_DEACTIVATE.

◆ Init()

override void SalmonellaMdfr::Init ( )
inlineprivate

Definition at line 19 of file Salmonella.c.

20 {
22 m_ID = eModifiers.MDF_SALMONELLA;
25 }
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 SalmonellaMdfr::OnActivate ( PlayerBase player)
inlineprotected

Definition at line 40 of file Salmonella.c.

41 {
42 //if( player.m_NotifiersManager ) player.m_NotifiersManager.ActivateByType(eNotifiers.NTF_SICK);
43 player.IncreaseDiseaseCount();
44 }

◆ OnDeactivate()

void SalmonellaMdfr::OnDeactivate ( PlayerBase player)
inlineprotected

Definition at line 46 of file Salmonella.c.

47 {
48 player.DecreaseDiseaseCount();
49 }

◆ OnTick()

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

Definition at line 59 of file Salmonella.c.

60 {
61 float stomach_volume = player.m_PlayerStomach.GetStomachVolume();
63 {
64 int roll = Math.RandomInt(0, 100);
65 int chance_of_vomit = CHANCE_OF_VOMIT + (CHANCE_OF_VOMIT_AGENT * player.GetSingleAgentCountNormalized(eAgents.SALMONELLA));
67 {
68 SymptomBase symptom = player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT);
69
70 if (symptom)
71 {
72 symptom.SetDuration(5);
73
74 // figure something more clever
75 if (m_Player.GetStatWater().Get() > WATER_DRAIN_FROM_VOMIT)
76 m_Player.GetStatWater().Add(-1 * WATER_DRAIN_FROM_VOMIT);
77 if (m_Player.GetStatEnergy().Get() > ENERGY_DRAIN_FROM_VOMIT)
78 m_Player.GetStatEnergy().Add(-1 * ENERGY_DRAIN_FROM_VOMIT);
79 }
80 }
81 }
82
83 m_Time += deltaT;
84
85 if (m_Time >= m_NextEvent)
86 {
87 m_Time = 0;
89 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_PAIN_LIGHT);
90 }
91
92
93 }
DayZPlayer m_Player
Definition Hand_Events.c:42
Definition EnMath.c:7
static const float EVENT_INTERVAL_MIN
Definition Salmonella.c:12
static const int WATER_DRAIN_FROM_VOMIT
Definition Salmonella.c:8
static const int CHANCE_OF_VOMIT
Definition Salmonella.c:6
static const int ENERGY_DRAIN_FROM_VOMIT
Definition Salmonella.c:9
static const float STOMACH_MIN_VOLUME
Definition Salmonella.c:10
float m_NextEvent
Definition Salmonella.c:17
static const float EVENT_INTERVAL_MAX
Definition Salmonella.c:13
static const int CHANCE_OF_VOMIT_AGENT
Definition Salmonella.c:7
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

References CHANCE_OF_VOMIT, CHANCE_OF_VOMIT_AGENT, ENERGY_DRAIN_FROM_VOMIT, EVENT_INTERVAL_MAX, EVENT_INTERVAL_MIN, m_NextEvent, m_Player, m_Time, Math::RandomFloatInclusive(), Math::RandomInt(), STOMACH_MIN_VOLUME, and WATER_DRAIN_FROM_VOMIT.

Member Data Documentation

◆ AGENT_THRESHOLD_ACTIVATE

const int SalmonellaMdfr::AGENT_THRESHOLD_ACTIVATE = 60
staticprivate

Definition at line 3 of file Salmonella.c.

Referenced by ActivateCondition(), and GetDebugText().

◆ AGENT_THRESHOLD_DEACTIVATE

const int SalmonellaMdfr::AGENT_THRESHOLD_DEACTIVATE = 20
staticprivate

Definition at line 4 of file Salmonella.c.

Referenced by DeactivateCondition(), and GetDebugText().

◆ CHANCE_OF_VOMIT

const int SalmonellaMdfr::CHANCE_OF_VOMIT = 10
staticprivate

Definition at line 6 of file Salmonella.c.

Referenced by OnTick().

◆ CHANCE_OF_VOMIT_AGENT

const int SalmonellaMdfr::CHANCE_OF_VOMIT_AGENT = 20
staticprivate

Definition at line 7 of file Salmonella.c.

Referenced by OnTick().

◆ ENERGY_DRAIN_FROM_VOMIT

const int SalmonellaMdfr::ENERGY_DRAIN_FROM_VOMIT = 310
staticprivate

Definition at line 9 of file Salmonella.c.

Referenced by OnTick().

◆ EVENT_INTERVAL_MAX

const float SalmonellaMdfr::EVENT_INTERVAL_MAX = 18
staticprivate

Definition at line 13 of file Salmonella.c.

Referenced by OnTick().

◆ EVENT_INTERVAL_MIN

const float SalmonellaMdfr::EVENT_INTERVAL_MIN = 12
staticprivate

Definition at line 12 of file Salmonella.c.

Referenced by OnTick().

◆ m_NextEvent

float SalmonellaMdfr::m_NextEvent
private

Definition at line 17 of file Salmonella.c.

Referenced by OnTick().

◆ m_Time

float SalmonellaMdfr::m_Time
private

Definition at line 16 of file Salmonella.c.

Referenced by OnTick().

◆ STOMACH_MIN_VOLUME

const float SalmonellaMdfr::STOMACH_MIN_VOLUME = 200
staticprivate

Definition at line 10 of file Salmonella.c.

Referenced by OnTick().

◆ WATER_DRAIN_FROM_VOMIT

const int SalmonellaMdfr::WATER_DRAIN_FROM_VOMIT = 450
staticprivate

Definition at line 8 of file Salmonella.c.

Referenced by OnTick().


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