agentbase.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. class AgentBase : MessageReceiverBase
  2. {
  3. float m_Type = 0;
  4. float m_Invasibility; //how fast the agent grows when potent enough to grow
  5. float m_TransferabilityIn; //to the player
  6. float m_TransferabilityOut; //from the player
  7. float m_Digestibility = 0.1; //multiplier for agents digested in the player stomach from an infected item(agents_transfered = digested_amount(in grams or mls) * m_Digestibility)
  8. int m_MaxCount = 1;
  9. int m_AutoinfectCount = 1; //! number of agents injected during the autoinfection
  10. float m_AutoinfectProbability = CalculateAutoinfectProbability(0); // [0..1], 0 = zero chance, 1 = 100% chance of getting this agent once per hour
  11. float m_TransferabilityAirOut; // transferibility airborne out
  12. float m_AntibioticsResistance = 1; //[0..1], 0 means antibiotics have full effect, 1 means no effect
  13. EStatLevels m_Potency = EStatLevels.MEDIUM; //grow when player's immune system is at this level or lower
  14. float m_DieOffSpeed = 1; //how fast the agent dies off when not potent enough to grow(per sec)
  15. void AgentBase()
  16. {
  17. Init();
  18. }
  19. void Init();
  20. int GetAgentType()
  21. {
  22. return m_Type;
  23. }
  24. float GetDieOffSpeedEx(PlayerBase player)
  25. {
  26. return GetDieOffSpeed();
  27. }
  28. EStatLevels GetPotencyEx(PlayerBase player)
  29. {
  30. return GetPotency();
  31. }
  32. float GetInvasibilityEx(PlayerBase player)
  33. {
  34. return GetInvasibility();
  35. }
  36. float GetDigestibilityEx(PlayerBase player)
  37. {
  38. return GetDigestibility();
  39. }
  40. EStatLevels GetPotency()
  41. {
  42. return m_Potency;
  43. }
  44. float GetDieOffSpeed()
  45. {
  46. return m_DieOffSpeed;
  47. }
  48. float GetAntiboticsResistance()
  49. {
  50. return m_AntibioticsResistance;
  51. }
  52. float GetAntibioticsResistanceEx(PlayerBase player)
  53. {
  54. return GetAntiboticsResistance();
  55. }
  56. float GetInvasibility()
  57. {
  58. return m_Invasibility;
  59. }
  60. //! should this agent grow based on invasibility even during usage of specific medical drugs attack
  61. bool GrowDuringMedicalDrugsAttack(EMedicalDrugsType drugType, PlayerBase player)
  62. {
  63. return true;
  64. }
  65. float GetDigestibility()
  66. {
  67. return m_Digestibility;
  68. }
  69. float CalculateAutoinfectProbability(float userprob)
  70. {
  71. return ( 1 - Math.Pow( 1 - userprob, ( 1 / 1200 ) ) );
  72. }
  73. bool AutoinfectCheck(float deltaT, PlayerBase player)
  74. {
  75. if (m_AutoinfectProbability == 0.0)
  76. return false;
  77. float diceThrow = Math.RandomFloat01();
  78. if (diceThrow < m_AutoinfectProbability)
  79. return CanAutoinfectPlayer(player);
  80. return false;
  81. }
  82. bool CanAutoinfectPlayer(PlayerBase player)
  83. {
  84. return false;
  85. }
  86. float GetTransferabilityIn()
  87. {
  88. return m_TransferabilityIn;
  89. }
  90. float GetTransferabilityOut()
  91. {
  92. return m_TransferabilityOut;
  93. }
  94. float GetTransferabilityAirOut()
  95. {
  96. return m_TransferabilityAirOut;
  97. }
  98. int GetMaxCount()
  99. {
  100. return m_MaxCount;
  101. }
  102. int GetAutoinfectCount()
  103. {
  104. return m_AutoinfectCount;
  105. }
  106. string GetName()
  107. {
  108. return ClassName();
  109. }
  110. //! DEPRECATED
  111. //!
  112. //! should this agent grow based on invasibility even during antibiotics attack
  113. bool GrowDuringAntibioticsAttack(PlayerBase player)
  114. {
  115. return true;
  116. }
  117. }