5 float m_LastTicked = 0;
6 float m_TotalAgentCount;
10 const int STORAGE_VERSION = 100;
12 PluginTransmissionAgents m_PluginTransmissionAgents = PluginTransmissionAgents.Cast(
GetPlugin(PluginTransmissionAgents));
24 int GetStorageVersion()
33 for(
int i = 0; i < m_VirusPool.Count(); i++)
35 Debug.Log(
"Agent: "+ m_VirusPool.GetKey(i).ToString(),
"Agents");
36 Debug.Log(
"Count: "+ m_VirusPool.GetElement(i).ToString(),
"Agents");
42 void ImmuneSystemTick(
float value,
float deltaT)
48 void GrowAgents(
float deltaT)
55 m_TotalAgentCount = 0;
56 for(
int i = 0; i < m_VirusPool.Count(); i++)
58 int agent_id = m_VirusPool.GetKey(i);
59 int max_count = m_PluginTransmissionAgents.GetAgentMaxCount( agent_id );
61 EStatLevels agent_potency = m_PluginTransmissionAgents.GetAgentPotencyEx( agent_id,
m_Player );
65 if( agent_potency <= immunity_level )
67 bool grow_during_antibiotics = m_PluginTransmissionAgents.GrowDuringAntibioticsAttack(agent_id,
m_Player);
68 if (
m_Player.IsAntibioticsActive() && !grow_during_antibiotics)
70 float invasibility = m_PluginTransmissionAgents.GetAgentInvasibilityEx( agent_id,
m_Player );
71 grow_delta = invasibility * deltaT;
75 float dieoff_speed = m_PluginTransmissionAgents.GetAgentDieOffSpeedEx( agent_id,
m_Player );
76 grow_delta = -dieoff_speed * deltaT;
82 float old_count = m_VirusPool.Get( agent_id );
83 float new_count = old_count + grow_delta;
84 new_count =
Math.Clamp(new_count, 0,max_count);
86 m_TotalAgentCount += new_count;
87 SetAgentCount(agent_id, new_count);
95 ctx.Write( m_VirusPool.Count() );
96 for(
int i = 0; i < m_VirusPool.Count();i++)
98 int key = m_VirusPool.GetKey(i);
99 int value = m_VirusPool.GetElement(i);
115 for(
int i = 0; i < count;i++)
129 SetAgentCount( key,value );
134 void DigestAgent(
int agent_id,
float count)
136 AddAgent(agent_id, m_PluginTransmissionAgents.GetAgentDigestibility(agent_id) * count);
139 void AddAgent(
int agent_id,
float count)
141 int max_count = m_PluginTransmissionAgents.GetAgentMaxCount(agent_id);
143 if( !m_VirusPool.Contains(agent_id) && count > 0 )
146 SetAgentCount(agent_id,count);
150 float new_value = m_VirusPool.Get(agent_id) + count;
152 SetAgentCount(agent_id,new_value);
165 void RemoveAgent(
int agent_id)
167 SetAgentCount(agent_id, 0);
170 void RemoveAllAgents()
195 int GetSingleAgentCount(
int agent_id)
197 if( m_VirusPool.Contains(agent_id) )
199 return m_VirusPool.Get( agent_id );
204 float GetTotalAgentCount()
207 for(
int i = 0; i < m_VirusPool.Count(); i++)
209 agent_count += m_VirusPool.GetElement(i);
214 void SpawnAgents(
float deltaT)
216 int count = m_PluginTransmissionAgents.GetAgentList().Count();
217 for(
int i = 0; i < count;i++)
219 AgentBase agent = m_PluginTransmissionAgents.GetAgentList().GetElement(i);
220 int agent_id = agent.GetAgentType();
222 if( GetSingleAgentCount(agent_id)==0 && agent.AutoinfectCheck(deltaT,
m_Player) )
224 AddAgent(agent_id,100);
230 void SetAgentCount(
int agent_id,
float count)
235 m_VirusPool.Set( agent_id, count);
236 m_AgentMask = m_AgentMask | agent_id;
241 m_VirusPool.Remove( agent_id );
242 m_AgentMask = m_AgentMask & ~agent_id;
244 if(
m_Player.m_Agents != m_AgentMask)
251 void AntibioticsAttack(
float attack_value)
253 for(
int i = 0; i < m_VirusPool.Count(); i++)
255 int agent_id = m_VirusPool.GetKey(i);
256 float antibiotics_resistance = 1 - m_PluginTransmissionAgents.GetAgentAntiboticsResistanceEx(agent_id,
m_Player);
257 float delta = attack_value * antibiotics_resistance;
258 float old_count = m_VirusPool.Get( agent_id );
259 float new_count = old_count - delta;
263 SetAgentCount(agent_id, new_count);
272 int max = m_PluginTransmissionAgents.GetAgentMaxCount(
Math.AbsInt(
id));
280 AddAgent(-
id, -grow);
286 int count = m_PluginTransmissionAgents.GetAgentList().Count();
287 for(
int i = 0; i < count;i++)
289 AgentBase agent = m_PluginTransmissionAgents.GetAgentList().GetElement(i);
290 string agent_name = agent.GetName();
291 int agent_id = agent.GetAgentType();
292 int max_agents = m_PluginTransmissionAgents.GetAgentMaxCount(agent_id);
293 string amount = GetSingleAgentCount(agent_id).ToString() +
"/" + max_agents.ToString();
296 object_out.InsertAt(
new Param1<int>(count) ,0);