MObjectCharacter.h
00001 #ifndef MOBJECTCHARACTER_H 00002 #define MOBJECTCHARACTER_H 00003 00004 #include "MCharacterDesc.h" 00005 #include "MObject.h" 00006 #include "MObjectItem.h" 00007 #include "MFormulaTable.h" 00008 00009 #include <list> 00010 #include <map> 00011 #include <algorithm> 00012 using namespace std; 00013 00014 00015 class MAction; 00016 class MActionPipe; 00017 class MActParam; 00018 00019 00020 00021 00023 class MObjectCharacter : public MObject{ 00024 protected: 00025 char m_szName[32]; 00026 MCharacterRace m_nRace; 00027 MCharacterClass m_nClass; 00028 MCharacterType m_nType; 00029 int m_nLevel; 00030 unsigned long int m_nEXP; 00031 int m_nMaxHP; 00032 int m_nMaxEN; 00033 float m_fHP; 00034 float m_fEN; 00035 MCharacterBasicAttr m_BasicAttr; 00036 MCharacterMoveMode m_nMoveMode; 00037 MCharacterMode m_nMode; 00038 MCharacterState m_nState; 00039 MCharacterAbility m_AbilityFlags; 00040 MCharacterRepeatInfo m_RepeatInfo; 00041 00042 MObjectItem* m_pEquipmentItems[MES_END]; 00043 MObjectItemMap m_HasItems; 00044 00045 list<MActionPipe*> m_ActionPipeList; 00046 list<MAction*> m_ActionList; 00047 MActParam* m_pActParam; 00048 00049 int m_nLastHPRegenTime; 00050 int m_nLastENRegenTime; 00051 int m_nDiedTime; 00052 int m_nLastCacheTime; 00053 00054 int CalcMaxHP(); 00055 int CalcMaxEN(); 00056 00057 void RegenHP(unsigned long int nTime); 00058 void RegenEN(unsigned long int nTime); 00059 public: 00060 MObjectCharacter(MUID& uid, MMap* pMap, rvector& Pos); 00061 virtual ~MObjectCharacter(void); 00062 00064 virtual void Tick(unsigned long int nTime); 00065 void LoadInitialData(); 00066 00067 // Item 관련 00068 int ObtainItem(MObjectItem* pObjectItem); 00069 void ClearItems(); 00070 bool EquipItem(MObjectItem* pObjectItem, MEquipmentSlot TargetSlot); 00071 bool EquipItem(MUID& ItemUID, MEquipmentSlot TargetSlot); 00072 MObjectItem* FindItem(MUID& uidItem); 00073 void ClearEquipmentItem(); 00074 00075 // property 00076 int GetHP() { return (int)m_fHP; } 00077 int GetEN() { return (int)m_fEN; } 00078 int GetSTR() { return m_BasicAttr.nSTR; } 00079 int GetCON() { return m_BasicAttr.nCON; } 00080 int GetDEX() { return m_BasicAttr.nDEX; } 00081 int GetAGI() { return m_BasicAttr.nAGI; } 00082 int GetINT() { return m_BasicAttr.nINT; } 00083 int GetCHA() { return m_BasicAttr.nCHA; } 00084 float UpdateHP(float fVal); 00085 float UpdateEN(float fVal); 00086 const MCharacterBasicAttr* GetBasicAttr() { return &m_BasicAttr; } 00087 MCharacterType GetType() { return m_nType; } 00088 MCharacterMoveMode GetMoveMode() { return m_nMoveMode; } 00089 void SetMoveMode(MCharacterMoveMode nMode); 00090 MCharacterMode GetMode() { return m_nMode; } 00091 void SetMode(MCharacterMode nMode); 00092 MCharacterState GetState() { return m_nState; } 00093 void SetState(MCharacterState nState); 00094 00095 MObjectItem* GetEquipmentItem(MEquipmentSlot nSlot) { return m_pEquipmentItems[nSlot]; } 00096 void Resurrect(); 00097 virtual bool CheckDestroy(int nTime); 00098 void CacheUpdate(unsigned long int nTime); 00099 00100 00101 // Action 관련 00102 void AddAction(MAction* pAction); 00103 void DelAction(int nActID); 00104 MAction* FindAction(int nActID); 00105 void AddActionPipe(MActionPipe* pActionPipe); 00106 void DelActionPipe(int nActPipeID); 00107 MActionPipe* FindActionPipe(int nActPipeID); 00108 int GetActionCount() { return (int)m_ActionList.size(); } 00109 list<MAction*>::iterator GetActionBeginItor() { return m_ActionList.begin(); } 00110 list<MAction*>::iterator GetActionEndItor() { return m_ActionList.end(); } 00111 void UpdateActParam(MActParam* pActParam); 00112 MActParam* GetActParam() { return m_pActParam; } 00113 void UnloadActions(); 00114 bool InvokeActionPipe(int nPipeID, int nTime, MActParam* pActParam); 00115 00116 bool Attack(MObjectCharacter* pTarget); 00117 void StopAttack(); 00118 bool Skill(int nSkillID, MObjectCharacter* pTarget); 00119 bool Warning(MObjectCharacter* pAttacker); 00120 bool Damage(int nDamage, const MUID& uidAttacker); 00121 00122 void RouteRepeatInfo(int nTime); 00123 00124 DECLARE_RTTI() 00125 }; 00126 00127 00128 struct MBLOB_BASICINFO_UPDATE { 00129 MUID uid; 00130 float fHP; 00131 float fEN; 00132 }; 00133 00134 00135 #endif
MAIET entertainment