Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
braindisease.c
Go to the documentation of this file.
2{
3 static const int AGENT_THRESHOLD_ACTIVATE = 2000;
4 static const int AGENT_THRESHOLD_DEACTIVATE = 0;
5 const int SHAKE_INTERVAL_MIN = 1;
6 const int SHAKE_INTERVAL_MAX = 4;
7
8 float m_Time;
10
19
20 override string GetDebugText()
21 {
22 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
23 }
24
25 override protected bool ActivateCondition(PlayerBase player)
26 {
27 return (player.GetSingleAgentCount(eAgents.BRAIN) >= AGENT_THRESHOLD_ACTIVATE);
28 }
29
30 override protected void OnActivate(PlayerBase player)
31 {
32 player.IncreaseDiseaseCount();
33 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_LAUGHTER);
34 }
35
36 override protected void OnDeactivate(PlayerBase player)
37 {
38 player.DecreaseDiseaseCount();
39 }
40
41 override protected bool DeactivateCondition(PlayerBase player)
42 {
43 return (player.GetSingleAgentCount(eAgents.BRAIN) <= AGENT_THRESHOLD_DEACTIVATE);
44 }
45
46 override protected void OnTick(PlayerBase player, float deltaT)
47 {
48 m_Time += deltaT;
49 float brainAgents = player.GetSingleAgentCountNormalized(eAgents.BRAIN) / 8.0;
50 float chanceOfLaughter = Math.RandomFloat01();
51
52 if (chanceOfLaughter < brainAgents)
53 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_LAUGHTER);
54
55 if (m_Time >= m_ShakeTime)
56 {
57 DayZPlayerSyncJunctures.SendKuruRequest(player, brainAgents);
59 }
60
61 }
62}
static const int AGENT_THRESHOLD_ACTIVATE
Definition braindisease.c:3
const int SHAKE_INTERVAL_MIN
Definition braindisease.c:5
bool ActivateCondition(PlayerBase player)
override string GetDebugText()
const int SHAKE_INTERVAL_MAX
Definition braindisease.c:6
override void Init()
bool DeactivateCondition(PlayerBase player)
static const int AGENT_THRESHOLD_DEACTIVATE
Definition braindisease.c:4
void OnTick(PlayerBase player, float deltaT)
void OnActivate(PlayerBase player)
void OnDeactivate(PlayerBase player)
static void SendKuruRequest(DayZPlayer pPlayer, float amount)
Definition enmath.c:7
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:51
eModifiers
Definition emodifiers.c:2
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition enmath.c:126
bool m_TrackActivatedTime
overall time this modifier was active
bool m_AnalyticsStatsEnabled
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
enum eModifierSyncIDs DEFAULT_TICK_TIME_ACTIVE