#ifndef _SPELL_UTIL_H_ #define _SPELL_UTIL_H_ #include #include #include namespace Skill { template class CAddSpell { public: CAddSpell(const CSpell::Spell_Info& Spell_Info) : m_Spell_Info(Spell_Info) { } unsigned short operator() (CAggresiveCreature* lpCharacter) { unsigned short wError = CSpell::NO_ENCHANT_ERROR; if (NULL != lpCharacter) { // ¸ó½ºÅÍÁß Ã¦Æ®/ÀÎæƮ ¹«½Ã Ç÷¡±×°¡ ÀÖ´Â ³à¼®Àº ½ºÆç ¹«½Ã Creature::CreatureType eCreatureType = Creature::GetCreatureType(lpCharacter->GetCID()); if (Creature::CT_MONSTER == eCreatureType || Creature::CT_SUMMON == eCreatureType) { const CMonsterMgr::MonsterProtoType* lpProtoType = CMonsterMgr::GetInstance().GetMonsterProtoType(lpCharacter->GetCID() & Creature::MONSTER_KIND_BIT); if (lpProtoType && lpProtoType->m_MonsterInfo.m_bIgnoreEnchant) { return wError; } } // ¼®»óÀº ¸ðµç æƮ, ÀÎæƮ¿¡ °É¸®Áö ¾Ê´Â´Ù. else if (Creature::CT_STRUCT == eCreatureType) { return CSpell::ENCHANT_FAIL_BY_RESIST; } // °ø¼º ¿ÀºêÁ§Æ®´Â ¸ðµç æƮ, ÀÎæƮ¿¡ °É¸®Áö ¾Ê´Â´Ù. else if (Creature::CT_SIEGE_OBJECT == eCreatureType) { // ¼º »ó¡¹°ÀÏ °æ¿ì ¹«Àû »óÅÂÀÇ Ã¦Æ®¸¸ Çã¿ëÇÑ´Ù. ³ª¸ÓÁö ¿ÀºêÁ§Æ®³ª æƮ, ÀÎæƮ´Â Çã¿ëÇÏÁö ¾Ê´Â´Ù. if (!(Siege::EMBLEM == lpCharacter->GetObjectType() && Skill::SpellID::Invincible == m_Spell_Info.m_wSpellID)) { return CSpell::ENCHANT_FAIL_BY_RESIST; } } CSpell* lpSpell = new Spell_t(m_Spell_Info); if (NULL != lpSpell) { if (true == lpSpell->AddAffected(lpCharacter, wError)) { CGlobalSpellMgr::GetInstance().Add(lpSpell); return wError; } delete lpSpell; } } return wError; } private: CSpell::Spell_Info m_Spell_Info; }; } #endif