/* ====================================================================================== * ÆÄ ÀÏ : SkillManager.h , SkillManager.cpp * ¸ñ Àû : ½ºÅ³ °ü¸® * ÀÛ ¼º ÀÚ : À̹ý¼® * ÀÛ ¼º ÀÏ : 2007³â 07¿ù 06ÀÏ * * Ãß°¡³»¿ë : * Ãß°¡³¯Â¥ ÀÛ¾÷ÀÚ Ãß°¡³»¿ë * * ÁÖÀÇ»çÇ× : skillobject´Â dummy »ý¼º -> server·Î ºÎÅÍ ÀÎÁõÈÄ -> managed·Î º¯°æ influenceobject´Â ¼­¹ö·Î ºÎÅÍ ¹ÞÀº Á¤º¸·Î¸¸ »ý¼ºµÈ´Ù. * ======================================================================================*/ #pragma once #include "IndexGenerator.h" #include "SkillObject.h" class cSkillExecuter; class cDamagePrintManager; struct sHaveSkill; struct sKeepSkill { unsigned char mStep; unsigned long mCastingTime; unsigned long mRestTime; /// ½ºÅ³ ½ºÅ©¸³Æ®¿¡¼­ °¡Á®¿À´Â ÃÑ´ë±â½Ã°£ unsigned long mTotalTime; /// unsigned long mStartTime; }; class cSkillManager { public: static cSkillManager* mpSkillManager; public: cSkillManager(); ~cSkillManager(); bool Init(); void Open(); void Close(); void Process( unsigned long deltaTime, unsigned long accumTime ); cSkillObject* AllocSkillObject(); void FreeSkillObject( cSkillObject* ptr ); cInfluenceObject* AllocInfluenceObject(); void FreeInfluenceObject(cInfluenceObject* ptr); cApplyObject* AllocApplyObject(); void FreeApplyObject(cApplyObject* ptr); unsigned long CreateHeroSkillObject( unsigned long skillIdx, float speedFactor = 1.0f ); void DeleteSkillObject( cSkillObject* p ); void DeleteAll(); cInfluenceObject* CreateInfluenceObject( unsigned long uIdx, unsigned long infIdx ); void DeleteInfluenceObject( cInfluenceObject* p ); void DeleteInfluenceObject( unsigned long uniqueIdx ); void UpdateInfluenceObject(); void DamageInfluenceObject(); cInfluenceObject* GetInfluenceObject( unsigned long uniqueIdx ); cApplyObject* CreateApplyObject( unsigned char weaponType, eAPPLYDRAMA_TYPE type ); cApplyObject* CreateApplyObject( unsigned long influenceIdx ); void DeleteApplyObject( cApplyObject* p ); bool IsUsedKeepSkill( unsigned long skillIdx ); bool IsUsedMonsterSkill( unsigned long skillIdx ); void StartCoolTime( unsigned long skillIdx, unsigned long restTime = ULONG_MAX, float speedFactor = 1.0f ); /// 071024 PKH ½ºÅ×ÀÌÅͽº °è»ê±â¿¡¼­ »ç¿ë tPointerHashMap* GetInfluenceMap() { return &mInfluenceMap; } tPointerHashMap* GetKeepSkillMap() { return &mKeepSkillMap; } unsigned long GetDummySkillCount() { return mDummySkillMap.GetSize(); } unsigned long GetSkillCount() { return mSkillObjectMap.GetSize(); } unsigned long GetInfluenceCount() { return mInfluenceMap.GetSize(); } unsigned long GetApplyCount() { return mApplyObjectMap.GetSize(); } protected: void DeleteProcess(); protected: /// memory tPool mSkillObjectPool; tPool mInfluenceObjectPool; tPool mApplyObjectPool; ////////////////////////////////////////////////////////////////////////// // skill process typedef tPointerHashMap cSkillObjectMap; typedef tArray cDeleteArray; /// ¼­¹ö·Î ºÎÅÍ °ËÁõÀ» ¹Þ±â Àü ó¸®¿ë °´Ã¼ (HERO¿ë) cSkillObjectMap mDummySkillMap; cIndexGenerator mDummyIndexGen; cIndexGenerator mApplyIndexGen; /// °ü¸® °´Ã¼ key = server create index cSkillObjectMap mSkillObjectMap; cSkillObjectMap mInfluenceMap; cSkillObjectMap mApplyObjectMap; /// »èÁ¦¿ë °´Ã¼ cDeleteArray mDeleteSkillArray; cDeleteArray mDeleteInfluenceArray; cDeleteArray mDeleteApplyObjectArray; ////////////////////////////////////////////////////////////////////////// typedef cSkillObjectMap cSkillMap; cSkillMap mKeepSkillMap; /// ½ºÅ³ ½ÇÇàÀÚ cSkillExecuter* mpSkillExecuter; /// µ¥¹ÌÁö Ãâ·ÂÀÚ cDamagePrintManager* mpDamagePrintManager; }; #define SKILLMAN cSkillManager::mpSkillManager inline cSkillObject* cSkillManager::AllocSkillObject() { return mSkillObjectPool.Alloc(); } inline void cSkillManager::FreeSkillObject(cSkillObject* ptr) { mSkillObjectPool.Free(ptr); } inline cInfluenceObject* cSkillManager::AllocInfluenceObject() { return mInfluenceObjectPool.Alloc(); } inline void cSkillManager::FreeInfluenceObject(cInfluenceObject* ptr) { mInfluenceObjectPool.Free(ptr); } inline cApplyObject* cSkillManager::AllocApplyObject() { return mApplyObjectPool.Alloc(); } inline void cSkillManager::FreeApplyObject(cApplyObject* ptr) { mApplyObjectPool.Free(ptr); } inline void cSkillManager::DeleteSkillObject( cSkillObject* p ) { if( p ) { if( p->IsRemoved() == false ) { p->Removed(); mDeleteSkillArray.PushBack( p ); } } } inline void cSkillManager::DeleteApplyObject( cApplyObject* p ) { if( p ) { if( p->IsRemoved() == false ) { p->Removed(); mDeleteApplyObjectArray.PushBack( p ); } } } inline cInfluenceObject* cSkillManager::GetInfluenceObject( unsigned long uniqueIdx ) { return (cInfluenceObject*) mInfluenceMap.GetAt( uniqueIdx ); }