PageRenderTime 19ms CodeModel.GetById 5ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

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