3 static const int AGENT_THRESHOLD_ACTIVATE = 250;
4 static const int AGENT_THRESHOLD_DEACTIVATE = 50;
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;
12 static const float STOMACH_MIN_VOLUME = 200;
22 override string GetDebugText()
24 return (
"Activate threshold: "+AGENT_THRESHOLD_ACTIVATE +
"| " +
"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
27 override protected bool ActivateCondition(
PlayerBase player)
29 if(player.GetSingleAgentCount(
eAgents.CHOLERA) >= AGENT_THRESHOLD_ACTIVATE)
39 override protected void OnActivate(
PlayerBase player)
41 player.IncreaseDiseaseCount();
44 override protected void OnDeactivate(
PlayerBase player)
46 player.DecreaseDiseaseCount();
49 override protected bool DeactivateCondition(
PlayerBase player)
51 if(player.GetSingleAgentCount(
eAgents.CHOLERA) <= AGENT_THRESHOLD_DEACTIVATE)
61 override protected void OnTick(
PlayerBase player,
float deltaT)
63 float water_loss = ( deltaT * ( WATER_LOSS_CHOLERA *
Math.Max( WATER_LOSS_CHOLERA_MIN, player.GetSingleAgentCountNormalized(
eAgents.CHOLERA ) ) ) );
65 player.GetStatWater().Add( -water_loss );
67 float stomach_volume = player.m_PlayerStomach.GetStomachVolume();
68 if( stomach_volume >= STOMACH_MIN_VOLUME )
70 int roll =
Math.RandomInt( 0, 100 );
71 if( roll < ( CHANCE_OF_VOMIT + ( CHANCE_OF_VOMIT_AGENT * player.GetSingleAgentCountNormalized(
eAgents.CHOLERA ) ) ) )
73 SymptomBase symptom = player.GetSymptomManager().QueueUpPrimarySymptom( SymptomIDs.SYMPTOM_VOMIT );
76 symptom.SetDuration(
Math.RandomIntInclusive( 4,8 ) );
78 if (
m_Player.GetStatWater().Get() > (WATER_DRAIN_FROM_VOMIT))
79 m_Player.GetStatWater().Add(-1 * WATER_DRAIN_FROM_VOMIT);
80 if (
m_Player.GetStatEnergy().Get() > (ENERGY_DRAIN_FROM_VOMIT))
81 m_Player.GetStatEnergy().Add(-1 * ENERGY_DRAIN_FROM_VOMIT);