agentbase.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. EStatLevels GetPotency()
  37. {
  38. return m_Potency;
  39. }
  40. float GetDieOffSpeed()
  41. {
  42. return m_DieOffSpeed;
  43. }
  44. float GetAntiboticsResistance()
  45. {
  46. return m_AntibioticsResistance;
  47. }
  48. float GetAntibioticsResistanceEx(PlayerBase player)
  49. {
  50. return GetAntiboticsResistance();
  51. }
  52. float GetInvasibility()
  53. {
  54. return m_Invasibility;
  55. }
  56. //! should this agent grow based on invasibility even during usage of specific medical drugs attack
  57. bool GrowDuringMedicalDrugsAttack(EMedicalDrugsType drugType, PlayerBase player)
  58. {
  59. return true;
  60. }
  61. float GetDigestibility()
  62. {
  63. return m_Digestibility;
  64. }
  65. float CalculateAutoinfectProbability(float userprob)
  66. {
  67. return ( 1 - Math.Pow( 1 - userprob, ( 1 / 1200 ) ) );
  68. }
  69. bool AutoinfectCheck(float deltaT, PlayerBase player)
  70. {
  71. if (m_AutoinfectProbability == 0.0)
  72. return false;
  73. float diceThrow = Math.RandomFloat01();
  74. if (diceThrow < m_AutoinfectProbability)
  75. return CanAutoinfectPlayer(player);
  76. return false;
  77. }
  78. bool CanAutoinfectPlayer(PlayerBase player)
  79. {
  80. return false;
  81. }
  82. float GetTransferabilityIn()
  83. {
  84. return m_TransferabilityIn;
  85. }
  86. float GetTransferabilityOut()
  87. {
  88. return m_TransferabilityOut;
  89. }
  90. float GetTransferabilityAirOut()
  91. {
  92. return m_TransferabilityAirOut;
  93. }
  94. int GetMaxCount()
  95. {
  96. return m_MaxCount;
  97. }
  98. int GetAutoinfectCount()
  99. {
  100. return m_AutoinfectCount;
  101. }
  102. string GetName()
  103. {
  104. return ClassName();
  105. }
  106. //! DEPRECATED
  107. //!
  108. //! should this agent grow based on invasibility even during antibiotics attack
  109. bool GrowDuringAntibioticsAttack(PlayerBase player)
  110. {
  111. return true;
  112. }
  113. }