/TGame/TCommon/Gene/Status/GEDOT.h

http://awoe.googlecode.com/ · C Header · 87 lines · 40 code · 18 blank · 29 comment · 0 complexity · 1c5c208784a8f9dbdcadfc012c4c43de MD5 · raw file

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // GEDOT.h
  3. // 2010?1?20?
  4. // Copyright ?2007, 2010, 8DWorld, Inc. All rights reserved.
  5. //
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////////////////////////
  8. #ifndef GEDOT_H
  9. #define GEDOT_H
  10. #include "GEStatus.h"
  11. #include "Combat/CombatSysIf.h"
  12. /**
  13. * GEDOT provide ability to maintain a durable state.
  14. * when attached it call a state responser : state enter,
  15. * when detached it call a state responser : state exit,
  16. *
  17. */
  18. class TCOM_API GEDOT : public GEStatus
  19. {
  20. public:
  21. enum
  22. {
  23. ArgIdx_IntervalTime = GEStatus::ArgIdx_StateID + 1,
  24. ArgIdx_FullBaseDamage,
  25. };
  26. GEDOT();
  27. //
  28. // Fire when the gene is attached on a unit. just like unit enter the state.
  29. //
  30. virtual bool onAttach();
  31. //
  32. // Periodically update gene logic, normally a gene will be detach when run out of its time to live.
  33. //
  34. virtual bool onUpdate(int nElapse);
  35. protected:
  36. //
  37. // Update Full Damage of current DOT base on static data and other modifiers
  38. //
  39. virtual bool CalculateDamage(int& nD);
  40. int m_nDamageRemain;
  41. int m_nDamagePerTime; // damage per time
  42. int m_nTimeInterval;
  43. int m_nTimeNextDamage;
  44. };
  45. class TCOM_API GEDOT_Element : public GEDOT
  46. {
  47. public:
  48. enum
  49. {
  50. ArgIdx_DamageRatio_OnElement = ArgIdx_FullBaseDamage + 1
  51. };
  52. GEDOT_Element(short nElemID = Combat::CBP_Fire);
  53. //
  54. // Fire just after the gene is created, just override this function to have
  55. // you specific gene initialize logic.
  56. //
  57. virtual bool onInit(IGeneCreateData& createData);
  58. //
  59. // Fire when the gene is attached on a unit. just like unit enter the state.
  60. //
  61. virtual bool onAttach();
  62. protected:
  63. virtual bool CalculateDamage(int& nD);
  64. int m_nTheCaster; // the one who cast DOT on me
  65. short m_nTheElementValue;
  66. short m_nDamageRatioOnElement;
  67. short m_nWhichElement;
  68. };
  69. #endif // GEDOT_H