Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,623 @@
#include "stdafx.h"
#include <Skill/SkillMgr.h>
#include <Creature/AggresiveCreature.h>
#include "Spell.h"
#include "Affected.h"
#include "SpellKind.h"
bool CAffectedSpell::Add(CSpell* pSpell, unsigned short& wError)
{
if (true == RemoveOverlappedSpell(pSpell))
{
switch (pSpell->GetSkillType())
{
case Skill::Type::CHANT:
{
if (m_cChantNum < MAX_CHANT)
{
m_pChant[m_cChantNum] = pSpell;
++m_cChantNum;
return true;
}
} break;
case Skill::Type::ENCHANT:
{
if (Skill::SpellTarget::ENEMY_TARGET_ENCHANT == pSpell->GetSpellTarget())
{
RemoveEnchantBySpellType(Skill::SpellID::Stealth);
}
if (Skill::SpellID::Stealth == pSpell->GetSpellID() &&
true == IsSpellThisTargetType(Skill::SpellTarget::ENEMY_TARGET_ENCHANT))
{
ERRLOG1(g_Log, "CID:0x%08x <20><><EFBFBD><EFBFBD> <20><>ų<EFBFBD><C5B3> Ǯ<><C7AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD> <20>ɷ<EFBFBD><C9B7><EFBFBD> <20>մϴ<D5B4>.", m_pOwner->GetCID());
wError = CSpell::ENCHANT_FAIL_BY_ENEMY_ENCHANT;
return false;
}
if (m_cEnchantNum < MAX_ENCHANT)
{
/*
// edith 2008.10.16 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>.
if(pSpell->GetSpellID() == Skill::SpellID::ExpOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
else if(pSpell->GetSpellID() == Skill::SpellID::LuckyOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
*/
m_pEnchant[m_cEnchantNum] = pSpell;
++m_cEnchantNum;
return true;
}
} break;
}
}
wError = CSpell::ENCHNAT_FAIL_ALREADY_AFFECTED;
return false;
}
bool CAffectedSpell::Remove(CSpell* pSpell)
{
CSpell** ppBegin = NULL;
CSpell** ppPastEnd = NULL;
switch (pSpell->GetSkillType())
{
case Skill::Type::CHANT:
{
for (ppBegin = m_pChant, ppPastEnd = m_pChant + m_cChantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if (pSpell == *ppBegin)
{
std::copy(ppBegin + 1, ppPastEnd, ppBegin);
--m_cChantNum;
m_pChant[m_cChantNum] = 0;
return true;
}
}
} break;
case Skill::Type::ENCHANT:
{
for (ppBegin = m_pEnchant, ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if (pSpell == *ppBegin)
{
// edith 2008.10.16 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>.
if(pSpell->GetSpellType() == Skill::SpellType::PAYBUFF_SPELL)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Remove : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Remove : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
/*
// edith 2008.10.16 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>.
if(pSpell->GetSpellID() == Skill::SpellID::ExpOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Remove <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Remove <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
else if(pSpell->GetSpellID() == Skill::SpellID::LuckyOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Remove <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Remove <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
*/
std::copy(ppBegin + 1, ppPastEnd, ppBegin);
--m_cEnchantNum;
m_pEnchant[m_cEnchantNum] = 0;
return true;
}
}
} break;
}
return false;
}
void CAffectedSpell::ClearChant()
{
CSpell** pprBegin = m_pChant + m_cChantNum - 1;
CSpell** pprPastEnd = m_pChant - 1;
for (;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->RemoveAffected(m_pOwner);
}
}
void CAffectedSpell::ClearEnchant()
{
CSpell** pprBegin = m_pEnchant + m_cEnchantNum - 1;
CSpell** pprPastEnd = m_pEnchant - 1;
for (;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->RemoveAffected(m_pOwner);
}
}
void CAffectedSpell::EnableChant(unsigned long dwOperateFlag)
{
CSpell** pprBegin = m_pChant + m_cChantNum - 1;
CSpell** pprPastEnd = m_pChant - 1;
for (;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->Enable(dwOperateFlag);
}
}
void CAffectedSpell::EnableEnchant(unsigned long dwOperateFlag)
{
CSpell** pprBegin = m_pEnchant + m_cEnchantNum - 1;
CSpell** pprPastEnd = m_pEnchant - 1;
for (;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->Enable(dwOperateFlag);
}
}
void CAffectedSpell::DisableChant(unsigned long dwOperateFlag)
{
CSpell** pprBegin = m_pChant + m_cChantNum - 1;
CSpell** pprPastEnd = m_pChant - 1;
for (;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->Disable(dwOperateFlag);
}
}
void CAffectedSpell::DisableEnchant(unsigned long dwOperateFlag)
{
CSpell** pprBegin = m_pEnchant + m_cEnchantNum - 1;
CSpell** pprPastEnd = m_pEnchant - 1;
for (;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->Disable(dwOperateFlag);
}
}
CSpell* CAffectedSpell::GetEnchant(int Index)
{
if(Index < 0)
return NULL;
if(Index >= MAX_ENCHANT)
return NULL;
return m_pEnchant[Index];
}
CSpell* CAffectedSpell::GetSpell(unsigned short usSpellID)
{
CSpell** ppBegin = NULL;
CSpell** ppPastEnd = NULL;
// æƮ
ppBegin = m_pChant;
ppPastEnd = m_pChant + m_cChantNum;
for (;ppBegin != ppPastEnd; ++ppBegin)
{
if ((*ppBegin)->GetSpellID() == usSpellID && true == (*ppBegin)->IsActivate(m_pOwner))
{
return *ppBegin;
}
}
// <20><>æƮ
ppBegin = m_pEnchant;
ppPastEnd = m_pEnchant + m_cEnchantNum;
for (;ppBegin != ppPastEnd; ++ppBegin)
{
if ((*ppBegin)->GetSpellID() == usSpellID)
{
return *ppBegin;
}
}
return NULL;
}
SPELL CAffectedSpell::GetSpellInfo(BOOL bDead)
{
SPELL spell = SPELL::SPELL();
/*
CSpell** ppBegin = NULL;
CSpell** ppPastEnd = NULL;
// <20><>æƮ
ppBegin = m_pEnchant;
ppPastEnd = m_pEnchant + MAX_ENCHANT;
unsigned char cIndex = 0;
for (;ppBegin != ppPastEnd; ++ppBegin)
{
switch((*ppBegin)->GetSpellType())
{
case Skill::SpellType::BUFF_SPELL:
if(bDead == TRUE)
continue;
// edith 2008.06.03 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
case Skill::SpellType::STATUE_SPELL:
case Skill::SpellType::PAYBUFF_SPELL:
case Skill::SpellType::ETERNAL_SPELL:
spell.Spells[cIndex] = SPELLINSTANCE((*ppBegin)->GetDurationSec(), (*ppBegin)->GetSpellID(), (*ppBegin)->GetSpellLevel(), (*ppBegin)->GetSpellType());
++cIndex;
break;
}
if(cIndex >= SPELL::MAX_SPELL_NUM)
break;
}
*/
unsigned char cIndex = 0;
for (int i = 0; i < MAX_ENCHANT; ++i)
{
if(!m_pEnchant[i])
continue;
switch(m_pEnchant[i]->GetSpellType())
{
case Skill::SpellType::BUFF_SPELL:
if(bDead == TRUE)
break;
// edith 2008.06.03 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
case Skill::SpellType::STATUE_SPELL:
case Skill::SpellType::PAYBUFF_SPELL:
case Skill::SpellType::ETERNAL_SPELL:
spell.Spells[cIndex] = SPELLINSTANCE(m_pEnchant[i]->GetDurationSec(), m_pEnchant[i]->GetSpellID(), m_pEnchant[i]->GetSpellLevel(), m_pEnchant[i]->GetSpellType());
++cIndex;
break;
}
if(cIndex >= SPELL::MAX_SPELL_NUM)
break;
}
return spell;
}
void CAffectedSpell::ApplyPartyChant(CAggresiveCreature* pAffected)
{
unsigned short wError = CSpell::NO_ENCHANT_ERROR;
for (CSpell** ppBegin = m_pChant, **ppPastEnd = m_pChant + m_cChantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if ((*ppBegin)->IsPartySkill())
{
(*ppBegin)->AddAffected(pAffected, wError);
}
}
}
void CAffectedSpell::ApplyEnchant(CAggresiveCreature* pAffected)
{
unsigned short wError = CSpell::NO_ENCHANT_ERROR;
for (CSpell** ppBegin = m_pEnchant, **ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
(*ppBegin)->AddAffected(pAffected, wError);
}
}
bool CAffectedSpell::RemoveOverlappedSpell(CSpell* pSpell)
{
CSkillMgr& SkillMgr = CSkillMgr::GetInstance();
unsigned short usSkill_ID = pSpell->GetSpellID();
CSpell** ppBegin = NULL;
CSpell** ppPastEnd = NULL;
if (Skill::Type::ENCHANT == pSpell->GetSkillType())
{
ppBegin = m_pEnchant;
ppPastEnd = m_pEnchant + m_cEnchantNum;
}
else
{
return true;
}
for (; ppBegin != ppPastEnd; ++ppBegin)
{
CSpell* pOverlappedSpell = (*ppBegin);
if (NULL != pOverlappedSpell)
{
if (usSkill_ID == pOverlappedSpell->GetSpellID())
{
bool bRemoveAffected = false;
// <20><><EFBFBD><20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>. <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
if (pSpell->GetSpellLevel() > pOverlappedSpell->GetSpellLevel())
{
bRemoveAffected = true;
}
else if (pSpell->GetSpellLevel() == pOverlappedSpell->GetSpellLevel())
{
if (pSpell->GetDurationSec() >= pOverlappedSpell->GetDurationSec())
{
bRemoveAffected = true;
}
}
if (true == bRemoveAffected)
{
pOverlappedSpell->ClearAll();
}
else
{
return false;
}
}
}
}
return true;
}
void CAffectedSpell::RemoveChantByCaster(CAggresiveCreature* pCaster)
{
for (CSpell** ppBegin = m_pChant, **ppPastEnd = m_pChant + m_cChantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
CSpell* lpSpell = (*ppBegin);
if (0 != lpSpell && pCaster == lpSpell->GetCaster())
{
lpSpell->RemoveAffected(m_pOwner);
}
}
}
void CAffectedSpell::RemoveEnchantByCaster(CAggresiveCreature* pCaster)
{
for (CSpell** ppBegin = m_pEnchant, **ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
CSpell* lpSpell = (*ppBegin);
if (0 != lpSpell && pCaster == lpSpell->GetCaster())
{
lpSpell->RemoveAffected(m_pOwner);
}
}
}
void CAffectedSpell::RemoveChantBySpellType(unsigned char cSpellType)
{
for (CSpell** ppBegin = m_pChant, **ppPastEnd = m_pChant + m_cChantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
CSpell* lpSpell = (*ppBegin);
if (0 != lpSpell && lpSpell->GetSpellID() == cSpellType)
{
lpSpell->RemoveAffected(m_pOwner);
}
}
}
bool CAffectedSpell::RemoveEnchantBySpellType(unsigned char cSpellType)
{
for (CSpell** ppBegin = m_pEnchant, **ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
CSpell* lpSpell = (*ppBegin);
if (0 != lpSpell && lpSpell->GetSpellID() == cSpellType)
{
lpSpell->RemoveAffected(m_pOwner);
return true;
}
}
return false;
}
bool CAffectedSpell::IsSpellOfEnemyCharacter(void)
{
for (CSpell** ppBegin = m_pEnchant, **ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
CAggresiveCreature* lpCaster = (*ppBegin)->GetCaster();
Creature::CreatureType eCreatureType = Creature::GetCreatureType(lpCaster->GetCID());
if (Creature::CT_MONSTER == eCreatureType ||
Creature::CT_SUMMON == eCreatureType ||
Creature::CT_STRUCT == eCreatureType)
{
continue;
}
if (EnemyCheck::EC_ENEMY == m_pOwner->IsEnemy(lpCaster))
{
return true;
}
}
return false;
}
bool CAffectedSpell::IsSpellThisTargetType(Skill::SpellTarget::Type eTargetType)
{
for (CSpell** ppBegin = m_pEnchant, **ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if ((*ppBegin)->GetSpellTarget() == eTargetType)
{
return true;
}
}
return false;
}
// --------------------------------------------------------------------------------------------------
// CAffectedSpell::Disenchant
//
// <20><><EFBFBD><EFBFBD> : <20>ֹ<EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>), Ÿ<><C5B8>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>), <20>ı<EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>/<2F>ð<EFBFBD>/<2F><><EFBFBD><EFBFBD>), <20>ֹ<EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD> : <20>ı<EFBFBD><C4B1><EFBFBD> <20><>æƮ <20><><EFBFBD><EFBFBD>
// --------------------------------------------------------------------------------------------------
unsigned char CAffectedSpell::Disenchant(Skill::SpellType::Type eSpellType, Skill::SpellTarget::Type eTargetType,
Skill::Disenchant::Type eDisenchantType, unsigned short usSkillLevel, unsigned char cNum)
{
CSpell *pTargetSpell = NULL;
unsigned short usMaxLevel = 0;
unsigned long dwMaxDuration = 0;
unsigned char cResult = 0;
if (Skill::Disenchant::INFINITE_NUM == cNum)
{
cNum = m_cEnchantNum;
}
for (unsigned char nIndex = 0; nIndex < cNum; nIndex++)
{
for (CSpell** ppBegin = m_pEnchant, **ppPastEnd = m_pEnchant + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if (Skill::SpellTarget::ALL_ENCHANT != eTargetType && (*ppBegin)->GetSpellTarget() != eTargetType)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
continue;
}
// <20>׾<EFBFBD><D7BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ִ<EFBFBD> <20><>æƮ<C3A6≯<EFBFBD>
if (Skill::Disenchant::DEAD == eDisenchantType)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BAB8> <20><><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(Skill::SpellType::BUFF_SPELL >= (*ppBegin)->GetSpellType())
{
pTargetSpell = *ppBegin;
break;
}
}
// edith <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ȵȴ<C8B5>.
if((*ppBegin)->GetSpellID() == Skill::SpellID::ExpOrb)
continue;
if((*ppBegin)->GetSpellID() == Skill::SpellID::LuckyOrb)
continue;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BFA1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǹ<EFBFBD> <20>ȵȴ<C8B5>.
if(Skill::SpellType::PAYBUFF_SPELL == (*ppBegin)->GetSpellType())
continue;
if (Skill::SpellType::NONE != eSpellType && (*ppBegin)->GetSpellType() != eSpellType)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
continue;
}
else if (Skill::SpellType::ETERNAL_SPELL != eSpellType &&
Skill::SpellType::ETERNAL_SPELL == (*ppBegin)->GetSpellType())
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <20><><EFBFBD><EFBFBD>
continue;
}
// <20><><EFBFBD><EFBFBD> <20>ı<EFBFBD>
if (Skill::Disenchant::NONE == eDisenchantType)
{
pTargetSpell = *ppBegin;
break;
}
switch (eDisenchantType)
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>͵<EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ı<EFBFBD>
case Skill::Disenchant::LEVEL:
{
if ((*ppBegin)->GetSpellLevel() < usSkillLevel && (*ppBegin)->GetSpellLevel() > usMaxLevel)
{
pTargetSpell = *ppBegin;
usMaxLevel = (*ppBegin)->GetSpellLevel();
}
} break;
// <20><><EFBFBD><EFBFBD> <20><> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ı<EFBFBD>
case Skill::Disenchant::DURATION:
{
if (CSpell::INFINITE_DURATION != (*ppBegin)->GetDurationSec() && (*ppBegin)->GetDurationSec() > dwMaxDuration)
{
pTargetSpell = *ppBegin;
dwMaxDuration = (*ppBegin)->GetDurationSec();
}
} break;
}
}
if (NULL == pTargetSpell)
{
return cResult;
}
pTargetSpell->RemoveAffected(m_pOwner);
pTargetSpell = NULL;
++cResult;
}
return cResult;
}

View File

@@ -0,0 +1,107 @@
#ifndef _CAFFECTED_H_
#define _CAFFECTED_H_
#include "Spell.h"
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class CAggresiveCreature;
class CAffectedSpell
{
public:
CAffectedSpell() : m_cInternalFlag(0), m_cChantNum(0), m_cEnchantNum(0)
{
int i;
for(i = 0; i < MAX_CHANT; ++i)
m_pChant[i] = NULL;
for(i = 0; i < MAX_ENCHANT; ++i)
m_pEnchant[i] = NULL; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ް<EFBFBD> <20>ִ<EFBFBD> Enchant<6E>ֹ<EFBFBD>
}
~CAffectedSpell() { ClearAll(); }
void SetOwner(CAggresiveCreature* pOwner) { m_pOwner = pOwner; }
bool Add(CSpell* pSpell, unsigned short& wError);
bool Remove(CSpell* pSpell);
void ApplyPartyChant(CAggresiveCreature* pAffected);
void ApplyEnchant(CAggresiveCreature* pAffected);
void RemoveChantByCaster(CAggresiveCreature* pCaster);
void RemoveEnchantByCaster(CAggresiveCreature* pCaster);
void RemoveChantBySpellType(unsigned char cSpellType);
bool RemoveEnchantBySpellType(unsigned char cSpellType);
bool IsSpellOfEnemyCharacter(void);
bool IsSpellThisTargetType(Skill::SpellTarget::Type eTargetType);
unsigned char Disenchant(Skill::SpellType::Type eSpellType, Skill::SpellTarget::Type eTargetType,
Skill::Disenchant::Type eDisenchantType, unsigned short usSkillLevel, unsigned char cNum);
void ClearChant();
void ClearEnchant();
void EnableChant(unsigned long dwOperateFlag = 0);
void EnableEnchant(unsigned long dwOperateFlag = 0);
void DisableChant(unsigned long dwOperateFlag = 0);
void DisableEnchant(unsigned long dwOperateFlag = 0);
inline void ClearAll();
inline void EnableAll(unsigned long dwOperateFlag = 0);
inline void DisableAll(unsigned long dwOperateFlag = 0);
CSpell* GetSpell(unsigned short usSpellID);
CSpell* GetEnchant(int Index);
int GetEnchantNum() { return m_cEnchantNum; }
SPELL GetSpellInfo(BOOL bDead = FALSE);
enum
{
MAX_CHANT = 10,
// edith 2008.05.06 <20><>þƮ <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>
MAX_ENCHANT = 30
};
protected:
bool RemoveOverlappedSpell(CSpell* pSpell);
CSpell* m_pChant[MAX_CHANT];
CSpell* m_pEnchant[MAX_ENCHANT]; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ް<EFBFBD> <20>ִ<EFBFBD> Enchant<6E>ֹ<EFBFBD>
CAggresiveCreature* m_pOwner; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ް<EFBFBD> <20>ִ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD>. <20><> <20><>ü<EFBFBD><C3BC> <20><><EFBFBD><EFBFBD>.
unsigned char m_cInternalFlag;
unsigned char m_cChantNum;
unsigned char m_cEnchantNum;
};
inline void CAffectedSpell::ClearAll()
{
ClearChant();
ClearEnchant();
}
inline void CAffectedSpell::EnableAll(unsigned long dwOperateFlag)
{
EnableChant(dwOperateFlag);
EnableEnchant(dwOperateFlag);
}
inline void CAffectedSpell::DisableAll(unsigned long dwOperateFlag)
{
DisableChant(dwOperateFlag);
DisableEnchant(dwOperateFlag);
}
#endif

View File

@@ -0,0 +1,221 @@
#include "stdafx.h"
#include <Skill/SkillMgr.h>
#include <Creature/AggresiveCreature.h>
#include "Spell.h"
#include "Casting.h"
bool CCastingSpell::Add(CSpell* pSpell)
{
CSpell* pRemoveSpell = 0;
CSpell** ppPastEnd = NULL;
switch(pSpell->GetSkillType())
{
case Skill::Type::CHANT:
if(m_cChantNum >= MAX_CHANT_CASTING)
{
pRemoveSpell = m_pChantCasting[0];
// <09><> ó<><C3B3><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><> <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD>.
ppPastEnd = m_pChantCasting + m_cChantNum;
std::copy(m_pChantCasting + 1, ppPastEnd, m_pChantCasting);
--m_cChantNum;
m_pChantCasting[m_cChantNum] = 0;
pRemoveSpell->ClearAll();
}
m_pChantCasting[m_cChantNum] = pSpell;
++m_cChantNum;
return true;
case Skill::Type::ENCHANT:
if(m_cEnchantNum >= MAX_ENCHANT_CASTING)
{
pRemoveSpell = m_pEnchantCasting[0];
// <09><> ó<><C3B3><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><> <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD>.
ppPastEnd = m_pEnchantCasting + m_cEnchantNum;
std::copy(m_pEnchantCasting + 1, ppPastEnd, m_pEnchantCasting);
--m_cEnchantNum;
m_pEnchantCasting[m_cEnchantNum] = 0;
pRemoveSpell->ClearAll();
}
/*
// edith 2008.10.16 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>.
if(pSpell->GetSpellID() == Skill::SpellID::ExpOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
else if(pSpell->GetSpellID() == Skill::SpellID::LuckyOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CAffectedSpell::Add <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
*/
m_pEnchantCasting[m_cEnchantNum] = pSpell;
++m_cEnchantNum;
return true;
};
return false;
}
bool CCastingSpell::Remove(CSpell* pSpell)
{
CSpell** ppBegin = NULL;
CSpell** ppPastEnd = NULL;
switch(pSpell->GetSkillType())
{
case Skill::Type::CHANT:
for(ppBegin = m_pChantCasting, ppPastEnd = m_pChantCasting + m_cChantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if((*ppBegin) == pSpell)
{
std::copy(ppBegin + 1, ppPastEnd, ppBegin);
--m_cChantNum;
m_pChantCasting[m_cChantNum] = 0;
return true;
}
}
break;
case Skill::Type::ENCHANT:
for(ppBegin = m_pEnchantCasting, ppPastEnd = m_pEnchantCasting + m_cEnchantNum;
ppBegin != ppPastEnd; ++ppBegin)
{
if((*ppBegin) == pSpell)
{
/*
// edith 2008.10.16 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>.
if(pSpell->GetSpellID() == Skill::SpellID::ExpOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
else if(pSpell->GetSpellID() == Skill::SpellID::LuckyOrb)
{
unsigned long time = pSpell->GetDurationSec();
if(m_pOwner)
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", m_pOwner->GetUID(), m_pOwner->GetCID(), pSpell->GetSpellType(), time);
else
SERLOG4(g_SkillLog, "UID:%d/CID:0x%08x CCastingSpell::Remove <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : Type:%d : %d Tick<63><6B><EFBFBD><EFBFBD>", 0, 0, pSpell->GetSpellType(), time);
}
*/
std::copy(ppBegin + 1, ppPastEnd, ppBegin);
--m_cEnchantNum;
m_pEnchantCasting[m_cEnchantNum] = 0;
return true;
}
}
break;
};
return false;
}
void CCastingSpell::ClearChant()
{
CSpell** pprBegin = m_pChantCasting + m_cChantNum - 1;
CSpell** pprPastEnd = m_pChantCasting - 1;
for(;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->ClearAll();
}
}
void CCastingSpell::ClearEnchant()
{
CSpell** pprBegin = m_pEnchantCasting + m_cEnchantNum - 1;
CSpell** pprPastEnd = m_pEnchantCasting - 1;
for(;pprBegin != pprPastEnd; --pprBegin)
{
(*pprBegin)->ClearAll();
}
}
CSpell* CCastingSpell::GetSpell(unsigned short usSpellID)
{
CSpell** ppBegin = NULL;
CSpell** ppPastEnd = NULL;
// æƮ
ppBegin = m_pChantCasting;
ppPastEnd = m_pChantCasting + m_cChantNum;
for(;ppBegin != ppPastEnd; ++ppBegin)
{
if((*ppBegin)->GetSpellID() == usSpellID)
{
return *ppBegin;
}
}
// <20><>æƮ
ppBegin = m_pEnchantCasting;
ppPastEnd = m_pEnchantCasting + m_cEnchantNum;
for(;ppBegin != ppPastEnd; ++ppBegin)
{
if((*ppBegin)->GetSpellID() == usSpellID)
{
return *ppBegin;
}
}
return NULL;
}
void CCastingSpell::EnableChant(unsigned long dwOperateFlag)
{
CSpell** ppBegin = m_pChantCasting;
CSpell** ppPastEnd = m_pChantCasting + m_cChantNum;
for(;ppBegin != ppPastEnd; ++ppBegin)
{
(*ppBegin)->Enable(dwOperateFlag);
}
}
void CCastingSpell::DisableChant(unsigned long dwOperateFlag)
{
CSpell** ppBegin = m_pChantCasting;
CSpell** ppPastEnd = m_pChantCasting + m_cChantNum;
for(;ppBegin != ppPastEnd; ++ppBegin)
{
(*ppBegin)->Disable(dwOperateFlag);
}
}

View File

@@ -0,0 +1,54 @@
#ifndef _CCASTING_H_
#define _CCASTING_H_
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class CSpell;
class CAggresiveCreature;
class CCastingSpell
{
public:
CCastingSpell() : m_pOwner(NULL), m_usInternalFlag(0), m_cEnchantNum(0), m_cChantNum(0) { }
~CCastingSpell() { ClearAll(); }
inline void SetOwner(CAggresiveCreature* pOwner) { m_pOwner = pOwner; }
bool Add(CSpell* pSpell);
bool Remove(CSpell* pSpell);
void ClearChant();
void ClearEnchant();
inline void ClearAll();
CSpell* GetSpell(unsigned short usSkill_ID);
void EnableChant(unsigned long dwOperateFlag = 0);
void DisableChant(unsigned long dwOperateFlag = 0);
protected:
enum
{
MAX_ENCHANT_CASTING = 20,
MAX_CHANT_CASTING = 1
};
CSpell* m_pEnchantCasting[MAX_ENCHANT_CASTING]; // ij<><C4B3><EFBFBD><EFBFBD> <20><> <20>ֹ<EFBFBD>
CSpell* m_pChantCasting[MAX_CHANT_CASTING]; // ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD> Chant<6E>ֹ<EFBFBD>.
CAggresiveCreature* m_pOwner;
unsigned short m_usInternalFlag;
unsigned char m_cEnchantNum;
unsigned char m_cChantNum;
};
inline void CCastingSpell::ClearAll()
{
ClearChant();
ClearEnchant();
}
#endif

View File

@@ -0,0 +1,84 @@
#include "stdafx.h"
#include <Community/Party/Party.h>
#include "Spell.h"
#include "GlobalSpellMgr.h"
CGlobalSpellMgr& CGlobalSpellMgr::GetInstance()
{
static CGlobalSpellMgr globalSpellMgr;
return globalSpellMgr;
}
CGlobalSpellMgr::CGlobalSpellMgr()
: m_nSpellNum(0)
{
}
CGlobalSpellMgr::~CGlobalSpellMgr()
{
Clear();
}
void CGlobalSpellMgr::Process()
{
CSpell* pCurrentSpell = m_HeadSpell.m_pNextSpell;
CSpell* pPrevSpell = &m_HeadSpell;
for (;NULL != pCurrentSpell;)
{
// <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޴<EFBFBD> <20>̰<EFBFBD> <20><><EFBFBD>ų<EFBFBD>, operate<74><65> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> delete
// (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޴<EFBFBD> <20>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> operate<74><65> <20>ʿ<EFBFBD> <20><><EFBFBD><EFBFBD>)
if (false == pCurrentSpell->IsValid() || false == pCurrentSpell->Operate())
{
pPrevSpell->m_pNextSpell = pCurrentSpell->m_pNextSpell;
delete pCurrentSpell;
pCurrentSpell = pPrevSpell->m_pNextSpell;
--m_nSpellNum;
}
else
{
pPrevSpell = pCurrentSpell;
pCurrentSpell = pCurrentSpell->m_pNextSpell;
}
}
}
void CGlobalSpellMgr::Add(CSpell* pSpell)
{
if(NULL != pSpell)
{
pSpell->m_pNextSpell = m_HeadSpell.m_pNextSpell;
m_HeadSpell.m_pNextSpell = pSpell;
++m_nSpellNum;
}
}
void CGlobalSpellMgr::Clear()
{
CSpell* pDelSpell = NULL;
CSpell* pPosSpell = m_HeadSpell.m_pNextSpell;
for (;NULL != pPosSpell;)
{
pDelSpell = pPosSpell;
pPosSpell = pPosSpell->m_pNextSpell;
delete pDelSpell;
pDelSpell = NULL;
}
m_nSpellNum = 0;
}

View File

@@ -0,0 +1,26 @@
#ifndef _CGLOBAL_SPELL_MGR_
#define _CGLOBAL_SPELL_MGR_
#include "NullSpell.h"
class CGlobalSpellMgr
{
public:
void Add(CSpell* pSpell); // Spell<6C><6C> <20><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20>߰<EFBFBD><DFB0>Ѵ<EFBFBD>.
void Process(); // <09><><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>. <20>ֹ<EFBFBD> ó<><C3B3> <20><> <20>ʿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
void Clear(); // Spell<6C><6C><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
size_t GetSpellNum() const { return m_nSpellNum; } // <09><><EFBFBD><EFBFBD> <20><><EFBFBD>ϵ<EFBFBD> Spell<6C><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
static CGlobalSpellMgr& GetInstance();
protected:
CGlobalSpellMgr();
~CGlobalSpellMgr();
size_t m_nSpellNum;
CNullSpell m_HeadSpell;
};
#endif

View File

@@ -0,0 +1,21 @@
#ifndef _CNULLSPELL_H_
#define _CNULLSPELL_H_
#include "Spell.h"
class CNullSpell : public CSpell
{
public:
CNullSpell() : CSpell(Spell_Info(Skill::ProtoType(), NULL,
Skill::SpellType::NONE, Skill::SpellID::None, 0, 0), Skill::Type::NONE) { }
virtual ~CNullSpell() { }
protected:
inline virtual bool Activate(CAggresiveCreature* pAffected, unsigned long dwOperateFlag) { return true; }
inline virtual bool Deactivate(CAggresiveCreature* pAffected, unsigned long dwOperateFlag) { return true; }
};
#endif

View File

@@ -0,0 +1,201 @@
#include "stdafx.h"
#include <Creature/AggresiveCreature.h>
#include "Spell.h"
#include "Affected.h"
#include "PartySpellMgr.h"
#include <Utility/Setup/ServerSetup.h>
#include <Community/Party/Party.h>
CPartySpellMgr::CPartySpellMgr()
: m_dwMemberNum(0), m_lpOwnerParty(0)
{
std::fill_n(&m_pPartyMember[0], int(MAX_MEMBER), reinterpret_cast<CAggresiveCreature*>(0));
}
CPartySpellMgr::~CPartySpellMgr()
{
ClearMember();
}
bool CPartySpellMgr::AddMember(CAggresiveCreature* lpNewMember)
{
if (m_dwMemberNum < MAX_MEMBER && NULL != lpNewMember)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD><D6B4><EFBFBD> <20><><EFBFBD>ɴ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>.
CAggresiveCreature** ppBegin = m_pPartyMember;
CAggresiveCreature** ppPastEnd = m_pPartyMember + m_dwMemberNum;
for (;ppBegin != ppPastEnd; ++ppBegin)
{
if(lpNewMember == (*ppBegin))
{
LogChantBug(lpNewMember, m_lpOwnerParty,
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̹<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.", LOG_FFLCHANT);
return false;
}
}
CAffectedSpell& newAffectedInfo = lpNewMember->GetSpellMgr().GetAffectedInfo();
ppBegin = m_pPartyMember;
ppPastEnd = m_pPartyMember + m_dwMemberNum;
for (;ppBegin != ppPastEnd; ++ppBegin)
{
// <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20>ֹ<EFBFBD><D6B9><EFBFBD>, <20><><EFBFBD>ο<EFBFBD> ij<><C4B3><EFBFBD>͸<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD>Ŵ.
CAggresiveCreature* lpOldMember = (*ppBegin);
CAffectedSpell& memberAffectedInfo = lpOldMember->GetSpellMgr().GetAffectedInfo();
memberAffectedInfo.ApplyPartyChant(lpNewMember);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20>ֹ<EFBFBD><D6B9><EFBFBD>, <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>͵<EFBFBD><CDB5><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD>Ŵ.
newAffectedInfo.ApplyPartyChant(lpOldMember);
}
m_pPartyMember[m_dwMemberNum] = lpNewMember;
++m_dwMemberNum;
LogChantBug(lpNewMember, m_lpOwnerParty,
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>", LOG_FFLCHANT);
return true;
}
return false;
}
bool CPartySpellMgr::RemoveMember(CAggresiveCreature* lpRemoveMember)
{
CAggresiveCreature** ppBegin = m_pPartyMember;
CAggresiveCreature** ppPastEnd = m_pPartyMember + m_dwMemberNum;
// <20><><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˻<EFBFBD><CBBB>Ѵ<EFBFBD>.
for (;ppBegin != ppPastEnd; ++ppBegin)
{
if (0 != lpRemoveMember && (*ppBegin) == lpRemoveMember)
{
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
std::copy(ppBegin + 1, ppPastEnd, ppBegin);
--m_dwMemberNum;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ŀ<EFBFBD>, 0<><30><EFBFBD><EFBFBD> ä<><C3A4><EFBFBD><EFBFBD>.
m_pPartyMember[m_dwMemberNum] = 0;
CAffectedSpell& removeAffectedInfo =
lpRemoveMember->GetSpellMgr().GetAffectedInfo();
ppBegin = m_pPartyMember;
ppPastEnd = m_pPartyMember + m_dwMemberNum;
for (; ppBegin != ppPastEnd; ++ppBegin)
{
CAggresiveCreature* lpOldMember = (*ppBegin);
// <09><><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>, <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Caster<65><72> <20>ִ<EFBFBD> Chant<6E><74> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
removeAffectedInfo.RemoveChantByCaster(lpOldMember);
// <09>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Caster<65><72> <20>ִ<EFBFBD> Chant<6E><74> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
CAffectedSpell& memberAffectedInfo =
lpOldMember->GetSpellMgr().GetAffectedInfo();
memberAffectedInfo.RemoveChantByCaster(lpRemoveMember);
}
LogChantBug(lpRemoveMember, m_lpOwnerParty,
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ſ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>", LOG_FFLCHANT);
return true;
}
}
return false;
}
void CPartySpellMgr::ClearMember()
{
CAggresiveCreature** ppExternalBegin = m_pPartyMember;
CAggresiveCreature** ppPastEnd = m_pPartyMember + m_dwMemberNum;
for (; ppExternalBegin != ppPastEnd; ++ppExternalBegin)
{
CAffectedSpell& memberAffectedInfo = (*ppExternalBegin)->GetSpellMgr().GetAffectedInfo();
CAggresiveCreature** ppInternalBegin = m_pPartyMember;
for (; ppInternalBegin != ppPastEnd; ++ppInternalBegin)
{
if (*ppInternalBegin != *ppExternalBegin)
{
memberAffectedInfo.RemoveChantByCaster(*ppInternalBegin);
}
}
}
std::fill_n(&m_pPartyMember[0], int(MAX_MEMBER),
reinterpret_cast<CAggresiveCreature*>(0));
m_dwMemberNum = 0;
LogChantBug(0, m_lpOwnerParty,
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ſ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>", LOG_FFLCHANT);
}
void CPartySpellMgr::AddAffectedToAllMember(CSpell* pSpell, unsigned short wMapIndex)
{
CAggresiveCreature** ppBegin = m_pPartyMember;
CAggresiveCreature** ppPastEnd = m_pPartyMember + m_dwMemberNum;
unsigned short wError = CSpell::NO_ENCHANT_ERROR;
for (;ppBegin != ppPastEnd; ++ppBegin)
{
CAggresiveCreature* lpCreature = (*ppBegin);
if (0 == lpCreature || lpCreature->GetMapIndex() != wMapIndex)
{
// Creature<72><65> NULL<4C>̰ų<CCB0> <20><><EFBFBD><EFBFBD> <20>ٸ<EFBFBD><D9B8><EFBFBD> <20><>ȿ
continue;
}
if (lpCreature->GetEnchantInfo().GetFlag(Skill::SpellID::Hide))
{
// Creature<72><65> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȿ
continue;
}
if (0 == pSpell->GetCaster() ||
EnemyCheck::EC_FRIEND != pSpell->GetCaster()->IsEnemy(lpCreature))
{
// <20><><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20><><EFBFBD>ų<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20>Ʊ<EFBFBD><C6B1><EFBFBD> <20>ƴϸ<C6B4> <20><>ȿ
continue;
}
pSpell->AddAffected(*ppBegin, wError);
}
}
// æƮ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD>´<EFBFBD>. <20><><EFBFBD><EFBFBD> <20>ذ<EFBFBD><D8B0><EFBFBD> <20><><EFBFBD>߿<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
void LogChantBug(CAggresiveCreature* lpCreature, CParty* lpParty,
const char* szMessage, const char* lpRtn, const char* lpFileName, int nLine)
{
if(0 == CServerSetup::GetInstance().GetServerGroup() && 0 != szMessage && 0 != lpParty)
{
if(0 != lpCreature)
{
// <20>׼<EFBFBD><D7BC>̰<EFBFBD>. Creature<72><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>õǾ<C3B5><C7BE><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>´<EFBFBD>.
g_Log.DetailLog(LOG_DETAIL, lpRtn, lpFileName, nLine, "CID:0x%08x(0x%08x)/PID:0x%08x(0x%08x)/ChantBug - %s",
lpCreature->GetCID(), lpCreature, lpParty->GetUID(), lpParty, szMessage);
}
else
{
g_Log.DetailLog(LOG_DETAIL, lpRtn, lpFileName, nLine, "PID:0x%08x(0x%08x)/ChantBug - %s",
lpParty->GetUID(), lpParty, szMessage);
}
}
}

View File

@@ -0,0 +1,42 @@
#ifndef _CPARTY_SPELL_MGR_
#define _CPARTY_SPELL_MGR_
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class CParty;
class CSpell;
class CAggresiveCreature;
#define LOG_FFLCHANT __FUNCTION__, __FILE__, __LINE__
// æƮ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD>´<EFBFBD>. <20><><EFBFBD><EFBFBD> <20>ذ<EFBFBD><D8B0><EFBFBD> <20><><EFBFBD>߿<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
void LogChantBug(CAggresiveCreature* lpCreature, CParty* lpParty,
const char* szMessage, const char* lpRtn, const char* lpFileName, int nLine);
class CPartySpellMgr
{
public:
CPartySpellMgr();
~CPartySpellMgr();
void SetOwner(CParty* lpParty) { m_lpOwnerParty = lpParty; }
bool AddMember(CAggresiveCreature* pNewMember);
bool RemoveMember(CAggresiveCreature* pRemoveMember);
void ClearMember();
void AddAffectedToAllMember(CSpell* pSpell, unsigned short wMapIndex=0);
protected:
enum { MAX_MEMBER = 10 };
CParty* m_lpOwnerParty;
CAggresiveCreature* m_pPartyMember[MAX_MEMBER];
unsigned long m_dwMemberNum;
};
#endif

View File

@@ -0,0 +1,442 @@
#include "stdafx.h"
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketStruct/CharAttackPacket.h>
#include <Map/FieldMap/Cell.h>
#include <Creature/AggresiveCreature.h>
#include <Creature/Monster/Monster.h>
#include "../SkillMgr.h"
#include "SpellMgr.h"
#include "GlobalSpellMgr.h"
#include "Spell.h"
#define IS_SET(dwFlag, dwValue) ((dwValue) == ((dwFlag) & (dwValue)))
#define SEND_SPELL_INFO(dwOperateFlag, lpAffected, cSpellType, nEnchantLevel, dwEnchantTime, bOnOff) \
if(!IS_SET(dwOperateFlag, DO_NOT_SEND)) { SendSpellInfo(lpAffected, cSpellType, nEnchantLevel, dwEnchantTime, bOnOff); }
CSpell::CSpell(Spell_Info& spell_Info, Skill::Type::SkillType eSpellType)
: m_pNextSpell(NULL), m_ProtoType(spell_Info.m_SkillProtoType), m_pCaster(NULL), m_eSkillType(eSpellType),
m_wSpellID(spell_Info.m_wSpellID), m_wSpellLevel(spell_Info.m_wSpellLevel),
m_cSpellType(spell_Info.m_cSpellType), m_dwDurationSec(spell_Info.m_dwDurationSec),
m_dwActivateStatus(0), m_cAffectedNum(0), m_cInternalFlags(0),
m_cSkillLockCount(spell_Info.m_cSkillLockCount), m_cSkillLevel(spell_Info.m_cSkillLevel)
{
SetCaster(spell_Info.m_lpCaster);
}
void CSpell::SetCaster(CAggresiveCreature* pCaster)
{
if (NULL != m_pCaster)
{
// edith 2009.05.15 <20><>ų <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD> <20><><EFBFBD><EFBFBD>
// SERLOG1(g_SkillLog, "CSpell::SetCaster %d", m_pCaster->GetCID());
m_pCaster->GetSpellMgr().GetCastingInfo().Remove(this);
}
m_pCaster = pCaster;
if (NULL != m_pCaster)
{
// edith 2009.05.15 <20><>ų <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD> <20><><EFBFBD><EFBFBD>
// SERLOG1(g_SkillLog, "CSpell::SetCaster %d", m_pCaster->GetCID());
m_pCaster->GetSpellMgr().GetCastingInfo().Add(this);
}
}
// Caster, Affected<65><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
void CSpell::ClearAll(void)
{
if (NULL != m_pCaster)
{
// edith 2009.05.15 <20><>ų <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD> <20><><EFBFBD><EFBFBD>
// SERLOG1(g_SkillLog, "CSpell::ClearAll %d", m_pCaster->GetCID());
m_pCaster->GetSpellMgr().GetCastingInfo().Remove(this);
m_pCaster = NULL;
}
ClearAffected();
}
void CSpell::Destroy(void)
{
if (DESTROYED != (DESTROYED & m_cInternalFlags))
{
ClearAll();
m_cInternalFlags |= DESTROYED;
}
}
bool CSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->GetEnchantInfo().SetFlag(static_cast<unsigned char>(m_wSpellID));
SEND_SPELL_INFO(dwOperateFlag, lpAffected, static_cast<unsigned char>(m_wSpellID), m_wSpellLevel, m_dwDurationSec, true);
return true;
}
bool CSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->GetEnchantInfo().ResetFlag(static_cast<unsigned char>(m_wSpellID));
SEND_SPELL_INFO(dwOperateFlag, lpAffected, static_cast<unsigned char>(m_wSpellID), m_wSpellLevel, 0, false);
return true;
}
// Affected<65><64><EFBFBD><EFBFBD>
bool CSpell::AddAffected(CAggresiveCreature* lpAffected, unsigned short& wError)
{
if (NULL == lpAffected || m_cAffectedNum >= MAX_AFFECTED)
{
return false;
}
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
// <20>̹<EFBFBD> <20>ִ<EFBFBD> ij<><C4B3><EFBFBD>͸<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>.
for (;ppBegin != ppPastEnd; ++ppBegin)
{
if ((*ppBegin) == lpAffected)
{
return false;
}
}
m_pAffected[m_cAffectedNum] = lpAffected;
// edith 2009.05.15 <20><>ų <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD> <20><><EFBFBD><EFBFBD>
// SERLOG1(g_SkillLog, "CSpell::AddAffected %d", lpAffected->GetCID());
// <20><>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
if (true == lpAffected->GetSpellMgr().GetAffectedInfo().Add(this, wError))
{
if (true == IsEnabled())
{
if (m_eSkillType == Skill::Type::CHANT)
{
CheckRange();
}
else
{
if (true == Activate(lpAffected, 0))
{
SetActivate(m_cAffectedNum);
}
}
}
++m_cAffectedNum;
return true;
}
return false;
}
bool CSpell::RemoveAffected(CAggresiveCreature* pRemoved)
{
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (;ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if ((*ppBegin) == pRemoved)
{
// Deactivate & Remove
if (true == IsActivate(cIndex))
{
if (true == Deactivate(pRemoved, 0))
{
SetDeactivate(cIndex);
}
}
// edith 2009.05.15 <20><>ų <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD> <20><><EFBFBD><EFBFBD>
// SERLOG1(g_SkillLog, "CSpell::RemoveAffected %d", pRemoved->GetCID());
if (false == (*ppBegin)->GetSpellMgr().GetAffectedInfo().Remove(this))
{
SPLOG_ERRLEVEL(ERRLOG1(g_Log, "CID:0x%08x <20><>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>! "
"ij<EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD> <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.", (*ppBegin)->GetCID()));
}
std::copy(ppBegin + 1, ppPastEnd, ppBegin);
RemoveIndex(cIndex);
--m_cAffectedNum;
return true;
}
}
return false;
}
void CSpell::ClearAffected(void)
{
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (;ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
// Deactivate & Remove
if (true == IsActivate(cIndex))
{
if (true == Deactivate(*ppBegin, 0))
{
SetDeactivate(cIndex);
}
}
// edith 2009.05.15 <20><>ų <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD> <20><><EFBFBD><EFBFBD>
// SERLOG0(g_SkillLog, "CSpell::ClearAffected");
if (false == (*ppBegin)->GetSpellMgr().GetAffectedInfo().Remove(this))
{
SPLOG_ERRLEVEL(ERRLOG1(g_Log, "CID:0x%08x <20><>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>! "
"ij<EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD> <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.", (*ppBegin)->GetCID()));
}
}
m_cAffectedNum = 0;
}
bool CSpell::Operate(void)
{
if (INFINITE_DURATION != m_dwDurationSec)
{
if (0 == m_dwDurationSec)
{
return false;
}
--m_dwDurationSec;
}
if (m_eSkillType == Skill::Type::CHANT && true == IsEnabled())
{
CheckRange();
}
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (; ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if (true == IsActivate(cIndex))
{
Operate(*ppBegin);
}
}
return true;
}
void CSpell::CheckRange(void)
{
// Caster<65><72> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><ECBFA1> üũ<C3BC>Ѵ<EFBFBD>.
if (NULL != m_pCaster && true == IsEnabled())
{
const Position& CasterPos = m_pCaster->GetCurrentPos();
const float fRange = m_ProtoType.m_fEffectExtent;
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (; ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if (CasterPos.GetDistance((*ppBegin)->GetCurrentPos()) <= fRange)
{
if (false == IsActivate(cIndex))
{
CSpell* pSpell = (*ppBegin)->GetSpellMgr().GetAffectedInfo().GetSpell(m_wSpellID);
if (NULL == pSpell)
{
if (true == Activate(*ppBegin, 0))
{
SetActivate(cIndex);
}
}
else
{
if (pSpell->GetSpellLevel() < m_wSpellLevel)
{
if (true == pSpell->Deactivate(*ppBegin, 0))
{
unsigned char cAffectedIndex = pSpell->GetAffectedIndex(*ppBegin);
if (MAX_AFFECTED != cAffectedIndex)
{
pSpell->SetDeactivate(cAffectedIndex);
}
if (true == Activate(*ppBegin, 0))
{
SetActivate(cIndex);
}
}
}
}
}
}
else
{
if (true == IsActivate(cIndex))
{
if (true == Deactivate(*ppBegin, 0))
{
SetDeactivate(cIndex);
}
}
}
}
}
}
const Skill::SpellTarget::Type CSpell::GetSpellTarget(void)
{
if (Skill::Type::CHANT == m_eSkillType)
{
return Skill::SpellTarget::CHANT;
}
else if (Skill::Type::ENCHANT == m_eSkillType)
{
switch (m_ProtoType.m_eTargetType)
{
case Skill::Target::FRIEND:
case Skill::Target::FRIEND_EXCEPT_SELF:
case Skill::Target::FRIEND_OBJECT:
case Skill::Target::DEAD_FRIEND:
case Skill::Target::PARTY:
return Skill::SpellTarget::FRIEND_TARGET_ENCHANT;
case Skill::Target::MELEE:
case Skill::Target::ENEMY:
case Skill::Target::ENEMY_OBJECT:
case Skill::Target::DEAD_ENEMY:
return Skill::SpellTarget::ENEMY_TARGET_ENCHANT;
}
}
return Skill::SpellTarget::NONE;
}
void CSpell::Enable(unsigned long dwOperateFlag)
{
if (false == IsEnabled())
{
m_cInternalFlags &= ~DISABLED;
if (m_eSkillType == Skill::Type::CHANT)
{
CheckRange();
}
else
{
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (; ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if (false == IsActivate(cIndex))
{
if (true == Activate(*ppBegin, dwOperateFlag))
{
SetActivate(cIndex);
}
}
}
}
}
}
void CSpell::Disable(unsigned long dwOperateFlag)
{
if (true == IsEnabled())
{
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (; ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if (true == IsActivate(cIndex))
{
if (true == Deactivate(*ppBegin, dwOperateFlag))
{
SetDeactivate(cIndex);
}
}
}
m_cInternalFlags |= DISABLED;
}
}
unsigned char CSpell::GetAffectedIndex(CAggresiveCreature* lpAffected)
{
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (; ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if ((*ppBegin) == lpAffected)
{
return cIndex;
}
}
return MAX_AFFECTED;
}
void CSpell::SendSpellInfo(CAggresiveCreature* lpAffected, unsigned char cSpellType,
unsigned short nEnchantLevel, unsigned long dwEnchantTime, bool bOnOff)
{
CCell* pCell = lpAffected->GetCellPos().m_lpCell;
if (pCell != NULL)
{
PktSpInfo pktSpInfo;
memset(&pktSpInfo, 0, sizeof(PktSpInfo));
pktSpInfo.m_dwCharID = lpAffected->GetCID();
pktSpInfo.m_cSpellType = cSpellType;
pktSpInfo.m_nEnchantLevel = nEnchantLevel;
pktSpInfo.m_bOnOff = bOnOff;
pktSpInfo.m_dwEnchantTime = dwEnchantTime;
if (PacketWrap::WrapCrypt(reinterpret_cast<char*>(&pktSpInfo), sizeof(PktSpInfo), CmdCharSpellInfo, 0))
{
pCell->SendNowAllNearCellCharacter(reinterpret_cast<char*>(&pktSpInfo), sizeof(PktSpInfo), CmdCharSpellInfo);
}
}
}

View File

@@ -0,0 +1,239 @@
#ifndef _CSPELL_H_
#define _CSPELL_H_
#include <climits>
#include <Skill/SkillStructure.h>
#include "SpellKind.h"
// <09>α<EFBFBD> <20><><EFBFBD><EFBFBD> : x <--> (void*)0
// MAXLEVEL : <20><><EFBFBD><EFBFBD> <20>α<EFBFBD>
// ERRLEVEL : <20><><EFBFBD><EFBFBD> <20>α<EFBFBD>
// TESTLEVEL : <20>׽<EFBFBD>Ʈ <20>α<EFBFBD>
#define SPLOG_MAXLEVEL(x) (void*)0
#define SPLOG_ERRLEVEL(x) (void*)0
#define SPLOG_TESTLEVEL(x) (void*)0
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class CAggresiveCreature;
class CSpell
{
public:
enum EnchantError
{
NO_ENCHANT_ERROR = 0,
ENCHNAT_FAIL_ALREADY_AFFECTED = 1,
ENCHANT_FAIL_BY_ENEMY_ENCHANT = 2,
ENCHANT_FAIL_BY_RESIST = 3
};
enum Const
{
INFINITE_DURATION = ULONG_MAX,
REALM_TIME = 7200,
REDUCE_MANA_TURN = 5,
MAX_AFFECTED = 10
};
enum OperateFlag
{
DO_NOT_SEND = 1 << 0
};
struct Spell_Info
{
const Skill::ProtoType& m_SkillProtoType;
CAggresiveCreature* m_lpCaster;
unsigned long m_dwDurationSec;
unsigned short m_wSpellID;
unsigned short m_wSpellLevel;
unsigned char m_cSpellType;
unsigned char m_cPadding;
unsigned char m_cSkillLockCount;
unsigned char m_cSkillLevel;
Spell_Info(const Skill::ProtoType& SkillProtoType, CAggresiveCreature* lpCaster,
unsigned char cSpellType, unsigned short wSpellID, unsigned short wSpellLevel, unsigned long dwDurationSec,
unsigned char cSkillLockCount = 0, unsigned char cSkillLevel = 0);
};
virtual ~CSpell() { Destroy(); }
// Caster<65><72><EFBFBD><EFBFBD>
void SetCaster(CAggresiveCreature* pCaster); // Caster<65><72> <20>ٲ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
inline CAggresiveCreature* GetCaster(void) { return m_pCaster; }
// Affected<65><64><EFBFBD><EFBFBD>. <20>ֹ<EFBFBD><D6B9><EFBFBD> Activate, Deactivate<74><65> <20><>ȣ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
bool AddAffected(CAggresiveCreature* lpAffected, unsigned short& wError);
bool RemoveAffected(CAggresiveCreature* pRemoved);
void ClearAffected(void);
// Caster, Affected<65><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
void ClearAll(void);
// <09>Ÿ<EFBFBD><C5B8><EFBFBD> üũ<C3BC>ؼ<EFBFBD> <20>ֹ<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
void CheckRange(void);
// <20><>Ÿ
inline bool IsActivate(CAggresiveCreature* lpAffected);
inline bool IsValid(void) const { return (0 != m_cAffectedNum); }
inline unsigned short GetSpellID(void) const { return m_wSpellID; }
inline unsigned short GetSpellLevel(void) const { return m_wSpellLevel; }
inline unsigned long GetDurationSec(void) const { return m_dwDurationSec; }
inline unsigned char GetSpellType(void) const { return m_cSpellType; }
inline unsigned char GetSkillLockCount(void) const { return m_cSkillLockCount; }
inline unsigned char GetSkillLevel(void) const { return m_cSkillLevel; }
const Skill::SpellTarget::Type GetSpellTarget(void);
inline const Skill::Type::SkillType GetSkillType(void) const { return m_eSkillType; }
inline const bool IsPartySkill(void) const { return m_ProtoType.m_eTargetType == Skill::Target::PARTY; }
inline unsigned short DecreaseSkillLevel(unsigned short usDecreaseAmount);
// <20>ֹ<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѱ<EFBFBD> <20><><EFBFBD><EFBFBD>.
void Enable(unsigned long dwOperateFlag);
void Disable(unsigned long dwOperateFlag);
protected:
// <20><><EFBFBD><EFBFBD> <20>޾ƾ߸<C6BE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>.
CSpell(Spell_Info& spell_Info, Skill::Type::SkillType eSpellType);
bool Operate(void); // <20>ֹ<EFBFBD> <20>ð<EFBFBD> üũ. <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD>.
void Destroy(void); // ClearAll<6C><6C> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϳ<EFBFBD>, <20>Ҹ<EFBFBD><D2B8>ڿ<EFBFBD><DABF><EFBFBD> <20>ѹ<EFBFBD><D1B9><EFBFBD> ȣ<><C8A3><EFBFBD>Ѵ<EFBFBD>.
// <20><><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҹ<EFBFBD><D2B8>ڵ<EFBFBD> <20>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD> <20>Ѵ<EFBFBD>.
// --------------------------------------------------------------------------------------------
// <20><>ų Opeartion <20><><EFBFBD><EFBFBD>. Override <20>ʿ<EFBFBD>.
inline virtual void Operate(CAggresiveCreature* lpAffected) { };
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
// Activate <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
inline bool IsActivate(unsigned char cAffectedIndex);
inline void SetActivate(unsigned char cAffectedIndex);
inline void SetDeactivate(unsigned char cAffectedIndex);
inline void RemoveIndex(unsigned char cAffectedIndex);
unsigned char GetAffectedIndex(CAggresiveCreature* lpAffected);
// Internal <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
inline bool IsEnabled(void);
inline bool SetEnableStatus(bool bStatus);
// --------------------------------------------------------------------------------------------
// Send <20><><EFBFBD><EFBFBD>
void SendSpellInfo(CAggresiveCreature* lpAffected, unsigned char cSpellType,
unsigned short nEnchantLevel, unsigned long dwEnchantTime, bool bOnOff);
enum InternalFlags
{
DISABLED = ( 1 << 0), // <20>ֹ<EFBFBD><D6B9><EFBFBD> Disabled<65>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>θ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8>.
DESTROYED = ( 1 << 1) // <20>ֹ<EFBFBD><D6B9><EFBFBD> Destroy<6F>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>η<EFBFBD> <20><>Ÿ<EFBFBD><C5B8>.
};
CSpell* m_pNextSpell; // <20>ֹ<EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
const Skill::ProtoType& m_ProtoType;
CAggresiveCreature* m_pAffected[MAX_AFFECTED]; // <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ް<EFBFBD> <20>ִ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD>.
CAggresiveCreature* m_pCaster; // <20>ֹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
Skill::Type::SkillType m_eSkillType; // See Namespace Type
unsigned long m_dwActivateStatus; // <20>ֹ<EFBFBD><D6B9><EFBFBD> Activate<74><65><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> Flag.
unsigned short m_wSpellID; // <20>ֹ<EFBFBD> ID
unsigned short m_wSpellLevel; // <20>ֹ<EFBFBD><D6B9><EFBFBD> Level
unsigned long m_dwDurationSec; // <20>ֹ<EFBFBD> <20><><EFBFBD>ӽð<D3BD>
unsigned char m_cSpellType; // <20>ֹ<EFBFBD><D6B9><EFBFBD> Ÿ<><C5B8> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
unsigned char m_cAffectedNum; // <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޴<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
unsigned char m_cInternalFlags; // 8bit Internal<61>÷<EFBFBD><C3B7><EFBFBD>
unsigned char m_cSkillLockCount; // <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><> <20><>ų<EFBFBD><C5B3> <20><>ī<EFBFBD><C4AB>Ʈ
unsigned char m_cSkillLevel; // <20>ֹ<EFBFBD><D6B9><EFBFBD> <20><> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD>
friend class CSpellMgr; // Caster<65><72> Affected<65><64> <20><>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ܺη<DCBA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ű<EFBFBD><C5B0> <20>ʱ<EFBFBD> <20><><EFBFBD><EFBFBD>.
friend class CGlobalSpellMgr; // CGlobalSpellMgr<67><72><EFBFBD><EFBFBD> m_pNextSpell<6C><6C> Protected<65>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD>.
};
inline CSpell::Spell_Info::Spell_Info(const Skill::ProtoType& SkillProtoType, CAggresiveCreature* lpCaster,
unsigned char cSpellType, unsigned short wSpellID, unsigned short wSpellLevel, unsigned long dwDurationSec,
unsigned char cSkillLockCount, unsigned char cSkillLevel)
: m_SkillProtoType(SkillProtoType), m_lpCaster(lpCaster),
m_cSpellType(cSpellType), m_wSpellID(wSpellID), m_wSpellLevel(wSpellLevel), m_dwDurationSec(dwDurationSec),
m_cSkillLockCount(cSkillLockCount), m_cSkillLevel(cSkillLevel)
{
}
inline unsigned short CSpell::DecreaseSkillLevel(unsigned short usDecreaseAmount)
{
if (m_wSpellLevel < usDecreaseAmount)
{
m_wSpellLevel = 0;
return m_wSpellLevel;
}
m_wSpellLevel -= usDecreaseAmount;
return m_wSpellLevel;
}
inline bool CSpell::IsEnabled(void)
{
return (DISABLED != (DISABLED & m_cInternalFlags));
}
inline bool CSpell::IsActivate(CAggresiveCreature* lpAffected)
{
CAggresiveCreature** ppBegin = m_pAffected;
CAggresiveCreature** ppPastEnd = m_pAffected + m_cAffectedNum;
unsigned char cIndex = 0;
for (; ppBegin != ppPastEnd; ++ppBegin, ++cIndex)
{
if (*ppBegin == lpAffected)
{
return IsActivate(cIndex);
}
}
return false;
}
inline bool CSpell::IsActivate(unsigned char cAffectedIndex)
{
const unsigned long dwIndexValue = (1 << cAffectedIndex);
return (dwIndexValue == (m_dwActivateStatus & dwIndexValue));
}
inline void CSpell::SetActivate(unsigned char cAffectedIndex)
{
m_dwActivateStatus |= (1 << cAffectedIndex);
}
inline void CSpell::SetDeactivate(unsigned char cAffectedIndex)
{
m_dwActivateStatus &= ~(1 << cAffectedIndex);
}
inline void CSpell::RemoveIndex(unsigned char cAffectedIndex)
{
m_dwActivateStatus =
(((ULONG_MAX << (cAffectedIndex + 1)) & m_dwActivateStatus) >> 1) | // <20>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ʈ<EFBFBD><C6AE>(31~nIndex)
(((1 << cAffectedIndex) - 1) & m_dwActivateStatus); // <20>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ʈ<EFBFBD><C6AE>(nIndex~0)
}
#endif

View File

@@ -0,0 +1,145 @@
#ifndef _SPELL_KIND_H_
#define _SPELL_KIND_H_
namespace Skill
{
namespace SpellID
{
enum Type
{
None = 0,
BattleSong = 1,
MaintenanceChant = 2,
AccelerationChant = 3,
LifeAura = 4,
SpeedBuff = 5,
Regeneration = 6,
Slow = 7,
ArmorBroken = 8,
Blaze = 9,
Charging = 10,
Stealth = 11,
ManaShell = 12,
Encourage = 13,
EnchantWeapon = 14,
BrightArmor = 15,
HardenSkin = 16,
Flexibility = 17,
Guard = 18,
Hold = 19,
Stun = 20,
Frozen = 21,
Poisoned = 22,
LowerStrength = 23,
Invincible = 24,
Hide = 25,
StoneForm = 26,
CounterAttack = 27,
Envenom = 28,
BombSet = 29,
Fired = 30,
CurseOfBlind = 31,
DeCoolDown = 32,
ExpOrb = 33,
LuckyOrb = 34,
DemagePotion = 35,
ArmorPotion = 36,
HitRatePotion = 37,
EvadePotion = 38,
MaxHPPotion = 39,
MaxMPPotion = 40,
HPRegenPotion = 41,
MPRegenPotion = 42,
CriticalPotion = 43,
BlockPotion = 44,
SpeedPotion = 45,
DeCoolDownPotion = 46,
MagicPowerPotion = 47,
MagicResistPotion = 48,
PowerStatue = 49,
IntStatue = 50,
ExpStatue = 51,
WealthStatue = 52,
RealmHP = 53,
RealmMP = 54,
Concentration = 55,
StealHand = 56, // <20><20>߰<EFBFBD><DFB0><EFBFBD>ų
MichaelBless = 57,
TasteWine = 58,
WifeCracker = 59,
KarterantWorldBuff = 60,
MerkadiaWorldBuff = 61,
KarterantWorldDeBuff= 62,
MerkadiaWorldDeBuff = 63,
HundredLevel = 64,
Drunk = 65,
CD_8D12 = 66,
CD_8D14 = 67,
CD_8D16 = 68,
CD_99A1 = 69,
CD_99A2 = 70,
CD_99A3 = 71,
MAX_SPELL_TYPE = 72
};
}
namespace SpellTarget
{
enum Type
{
NONE = 0,
CHANT = 1,
FRIEND_TARGET_ENCHANT = 2,
ENEMY_TARGET_ENCHANT = 3,
ALL_ENCHANT = 4
};
};
namespace Disenchant
{
enum Type
{
NONE = 0,
LEVEL = 1,
DURATION = 2,
DEAD = 3
};
enum Const
{
INFINITE_NUM = UCHAR_MAX
};
};
namespace SpellType
{
enum Type
{
NONE = 0,
MAGICAL_SPELL = 1, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֹ<EFBFBD>
PHYSICAL_SPELL = 2, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֹ<EFBFBD> (ex - <20><>)
WORLDWEAPON_SPELL = 3, // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>æƮ
REALM_SPELL = 4, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȿ<><C8BF> <20><>þƮ.
BUFF_SPELL = 5, // DB<44><42> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>þƮ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>)
PAYBUFF_SPELL = 6, // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̰<EFBFBD> <20>׾ <20><><EFBFBD><EFBFBD><EFBFBD>ȵȴ<C8B5>.
STATUE_SPELL = 7, // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȿ<><C8BF> <20><>þƮ
ETERNAL_SPELL = 8, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20>ϴ<EFBFBD> <20><>æƮ (ex - 100<30><30> <20><><EFBFBD><EFBFBD>Ʈ)
};
};
};
#endif

View File

@@ -0,0 +1,117 @@
#include "stdafx.h"
#include "SpellUtil.h"
#include "Spell.h"
#include "SpellTable.h"
#include "SpellMgr.h"
#include <Skill/SkillTable.h>
using namespace Skill;
#define ADD_SPELL(SpellName) \
CAddSpell<##SpellName>(CSpell::Spell_Info(CProcessTable::ProcessInfo::m_NullProtoType, NULL, spell.Spells[cIndex].cSpellType, \
spell.Spells[cIndex].wSpellID, spell.Spells[cIndex].wEnchantLevel, spell.Spells[cIndex].dwDurationSec))(m_pOwner);
#define ADD_SPELLNEW(SpellName, SpellType) \
CAddSpell<##SpellName>(CSpell::Spell_Info(CProcessTable::ProcessInfo::m_NullProtoType, NULL, SpellType, \
spell.Spells[cIndex].wSpellID, spell.Spells[cIndex].wEnchantLevel, spell.Spells[cIndex].dwDurationSec))(m_pOwner);
CSpellMgr::CSpellMgr()
: m_pOwner(NULL)
{
}
CSpellMgr::~CSpellMgr()
{
}
void CSpellMgr::SetSpell(const SPELL spell)
{
int iCount = 0;
for (unsigned char cIndex = 0; cIndex < SPELL::MAX_SPELL_NUM; ++cIndex)
{
switch(spell.Spells[cIndex].wSpellID)
{
case Skill::SpellID::CD_8D12:
case Skill::SpellID::CD_8D14:
case Skill::SpellID::CD_8D16:
case Skill::SpellID::CD_99A1:
case Skill::SpellID::CD_99A2:
case Skill::SpellID::CD_99A3:
case Skill::SpellID::DemagePotion:
case Skill::SpellID::ArmorPotion:
case Skill::SpellID::HitRatePotion:
case Skill::SpellID::EvadePotion:
case Skill::SpellID::MaxHPPotion:
case Skill::SpellID::MaxMPPotion:
case Skill::SpellID::HPRegenPotion:
case Skill::SpellID::MPRegenPotion:
case Skill::SpellID::CriticalPotion:
case Skill::SpellID::BlockPotion:
case Skill::SpellID::SpeedPotion:
case Skill::SpellID::DeCoolDownPotion:
case Skill::SpellID::MagicPowerPotion:
case Skill::SpellID::MagicResistPotion:
ADD_SPELL(CBuffPotionSpell);
iCount++;
break;
case Skill::SpellID::ExpOrb :
ADD_SPELL(CExpOrbSpell);
// ADD_SPELLNEW(CExpOrbSpell, Skill::SpellType::PAYBUFF_SPELL);
// ADD_SPELL(CBuffPotionSpell);
iCount++;
break;
case Skill::SpellID::LuckyOrb :
ADD_SPELL(CLuckyOrbSpell);
// ADD_SPELLNEW(CLuckyOrbSpell, Skill::SpellType::PAYBUFF_SPELL);
// ADD_SPELL(CBuffPotionSpell);
iCount++;
break;
case Skill::SpellID::MichaelBless :
ADD_SPELL(CMichaelBlessSpell);
// ADD_SPELLNEW(CLuckyOrbSpell, Skill::SpellType::PAYBUFF_SPELL);
// ADD_SPELL(CBuffPotionSpell);
iCount++;
break;
case Skill::SpellID::PowerStatue :
ADD_SPELLNEW(CPowerStatueSpell, Skill::SpellType::STATUE_SPELL);
iCount++;
break;
case Skill::SpellID::IntStatue :
ADD_SPELLNEW(CIntStatueSpell, Skill::SpellType::STATUE_SPELL);
iCount++;
break;
case Skill::SpellID::ExpStatue :
ADD_SPELLNEW(CExpStatueSpell, Skill::SpellType::STATUE_SPELL);
iCount++;
break;
case Skill::SpellID::WealthStatue :
ADD_SPELLNEW(CWealthStatueSpell, Skill::SpellType::STATUE_SPELL);
iCount++;
break;
}
}
return;
// edith 100<30><30> <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD>Ʈ
/*
for (unsigned char cIndex = 0; cIndex < SPELL::MAX_SPELL_NUM; ++cIndex)
{
switch(spell.Spells[cIndex].wSpellID)
{
case Skill::SpellID::HundredLevel: ADD_SPELL(CHundredLevelSpell); break;
}
}
*/
}

View File

@@ -0,0 +1,44 @@
#ifndef _CSPELL_MGR_H_
#define _CSPELL_MGR_H_
#include "Casting.h"
#include "Affected.h"
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class CSpell;
class CAggresiveCreature;
class CSpellMgr
{
public:
CSpellMgr();
~CSpellMgr();
inline void SetOwner(CAggresiveCreature* pOwner); // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ݵ<EFBFBD><DDB5><EFBFBD> ȣ<><C8A3><EFBFBD><EFBFBD> <20><> <20><>.
inline CAggresiveCreature* GetOwner() { return m_pOwner; }
inline CCastingSpell& GetCastingInfo() { return m_CastingInfo; }
inline CAffectedSpell& GetAffectedInfo() { return m_AffectedInfo; }
void SetSpell(const SPELL spell);
protected:
CAggresiveCreature* m_pOwner; // <09><><EFBFBD><EFBFBD> <20>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD> Creature.(<28>ٲ<EFBFBD><D9B2><EFBFBD> <20><><EFBFBD><EFBFBD>)
CCastingSpell m_CastingInfo;
CAffectedSpell m_AffectedInfo;
friend class CSpell; // Caster<65><72> Affected<65><64> <20><>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ܺη<DCBA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ű<EFBFBD><C5B0> <20>ʱ<EFBFBD> <20><><EFBFBD><EFBFBD>.
};
inline void CSpellMgr::SetOwner(CAggresiveCreature* pOwner)
{
m_pOwner = pOwner;
m_CastingInfo.SetOwner(pOwner);
m_AffectedInfo.SetOwner(pOwner);
}
#endif

View File

@@ -0,0 +1,921 @@
#include "stdafx.h"
#include <Utility/Math/Math.h>
#include <Map/FieldMap/Cell.h>
#include <Skill/SkillMgr.h>
#include <Creature/AggresiveCreature.h>
#include <Creature/Character/Character.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharAttackPacket.h>
#include <Network/ClientSocket/ClientConstants.h>
#include <Network/Dispatch/GameClient/GameClientDispatch.h>
#include <Network/Dispatch/GameClient/SendCharAttack.h>
#include "SpellTable.h"
#include "SpellMgr.h"
#include "GlobalSpellMgr.h"
//-------------------------------------------------------------------------------------------------
// Chant Spell
void CChantSpell::Operate(CAggresiveCreature* lpAffected)
{
if (lpAffected == m_pCaster)
{
m_cOperateTurn++;
if (m_cOperateTurn == UCHAR_MAX)
{
m_cOperateTurn = 0;
}
if (0 == (m_cOperateTurn % CSpell::REDUCE_MANA_TURN))
{
CreatureStatus& affectedStatus = lpAffected->GetStatus();
CCastingSpell& affectedCastingInfo = lpAffected->GetSpellMgr().GetCastingInfo();
if (m_nConsumeMPAmount > affectedStatus.m_nNowMP)
{
affectedStatus.m_nNowMP = 0;
affectedCastingInfo.DisableChant();
}
else
{
affectedStatus.m_nNowMP -= m_nConsumeMPAmount;
affectedCastingInfo.EnableChant();
}
}
}
}
//-------------------------------------------------------------------------------------------------
// BattleSong Spell
bool CBattleSongSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CBattleSongSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// CStealHandSpell Spell
bool CStealHandSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CStealHandSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// MaintenanceChant Spell
void CMaintenanceChantSpell::Operate(CAggresiveCreature* lpAffected)
{
if (0 == m_cOperateTurn % 2)
{
lpAffected->RegenHPAndMP(m_wSpellLevel, 0, false);
}
CChantSpell::Operate(lpAffected);
}
bool CMaintenanceChantSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CMaintenanceChantSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// AccelerationChant Spell
void CAccelerationChantSpell::Operate(CAggresiveCreature* lpAffected)
{
if (0 == m_cOperateTurn % 2)
{
lpAffected->RegenHPAndMP(0, m_wSpellLevel, false);
}
CChantSpell::Operate(lpAffected);
}
bool CAccelerationChantSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CAccelerationChantSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// LifeAura Spell
void CLifeAuraSpell::Operate(CAggresiveCreature* lpAffected)
{
if (0 == m_cOperateTurn % 2)
{
lpAffected->RegenHPAndMP(m_wSpellLevel * 2, m_wSpellLevel * 2, false);
}
CChantSpell::Operate(lpAffected);
}
//-------------------------------------------------------------------------------------------------
// SpeedBuff Spell
bool CSpeedBuffChantSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CSpeedBuffChantSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Regeneration Spell
void CRegenerationSpell::Operate(CAggresiveCreature* lpAffected)
{
if (0 == m_dwDurationSec % 2)
{
lpAffected->RegenHPAndMP(m_wSpellLevel * 2, 0, false);
}
}
//-------------------------------------------------------------------------------------------------
// CBuffPotionSpell Spell
bool CBuffPotionSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CBuffPotionSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Blaze Spell
bool CBlazeSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CBlazeSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Charging Spell
bool CChargingSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CChargingSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Encourage Spell
bool CEncourageSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CEncourageSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// EnchantWeapon Spell
bool CEnchantWeaponSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CEnchantWeaponSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// BrightArmor Spell
bool CBrightArmorSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CBrightArmorSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// HardenSkin Spell
bool CHardenSkinSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CHardenSkinSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Guard Spell
bool CGuardSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CGuardSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// CMichaelBlessSpell Spell
bool CMichaelBlessSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CMichaelBlessSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// CExpOrbSpell Spell
bool CExpOrbSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CExpOrbSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// CLuckyOrbSpell Spell
bool CLuckyOrbSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CLuckyOrbSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Chocolate Spell
bool CChocolateSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CChocolateSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// CTasteWineSpell Spell
bool CTasteWineSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CTasteWineSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// ArmorBroken Spell
bool CArmorBrokenSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CArmorBrokenSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Stun Spell
bool CStunSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->GetSpellMgr().GetCastingInfo().ClearChant();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Poisoned Spell
void CPoisonedSpell::Operate(CAggresiveCreature* lpAffected)
{
const short wDamage = static_cast<short>( (float)(m_wSpellLevel) * 1.0f );
const short wThreatAmount = (lpAffected->GetStatus().m_nNowHP < wDamage) ?
lpAffected->GetStatus().m_nNowHP : wDamage;
lpAffected->GetThreat().AddToThreatList(m_pCaster, wThreatAmount);
lpAffected->GetStatus().m_nNowHP = (lpAffected->GetStatus().m_nNowHP > wDamage) ?
lpAffected->GetStatus().m_nNowHP - wDamage : 0;
if (0 == lpAffected->GetStatus().m_nNowHP)
{
lpAffected->Dead(m_pCaster);
lpAffected->GetThreat().ClearAll();
}
DefenserNode node;
node.m_wDamage = wDamage;
node.m_dwCharID = lpAffected->GetCID();
node.m_sCurrHP = lpAffected->GetStatus().m_nNowHP;
node.m_sCurrMP = lpAffected->GetStatus().m_nNowMP;
node.m_wMaxHP = lpAffected->GetStatus().m_StatusInfo.m_nMaxHP;
node.m_wMaxMP = lpAffected->GetStatus().m_StatusInfo.m_nMaxMP;
node.m_wMPHeal = 0;
node.m_cJudge = ClientConstants::Judge_Poisoned;
AtType attackType;
attackType.m_wType = AtType::RIGHT_MELEE;
CCell* lpCell = lpAffected->GetCellPos().m_lpCell;
if (NULL != lpCell)
{
lpCell->SendAttackInfo(m_pCaster->GetCID(), attackType, 1, &node);
}
if (Creature::CT_PC == Creature::GetCreatureType(lpAffected->GetCID()))
{
AtType attackType;
attackType.m_wType = AtType::RIGHT_MELEE;
CCharacter* pAffectedCharacter = (CCharacter *)lpAffected;
CGameClientDispatch* pCharacterDispatcher = pAffectedCharacter->GetDispatcher();
if (NULL != pCharacterDispatcher)
{
GameClientSendPacket::SendCharAttacked(pCharacterDispatcher->GetSendStream(), m_pCaster, pAffectedCharacter,
attackType, 0, wDamage, ClientConstants::Judge_Poisoned, 0, PktBase::NO_SERVER_ERR);
}
}
}
bool CPoisonedSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CPoisonedSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// LowerStrength Spell
bool CLowerStrengthSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CLowerStrengthSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// StoneForm Spell
bool CStoneFormSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->GetSpellMgr().GetCastingInfo().ClearChant();
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CStoneFormSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// BombSet Spell
void CBombSetSpell::Operate(CAggresiveCreature* lpAffected)
{
if (0 == m_dwDurationSec)
{
AtType attackType;
attackType.m_wType = 0x8708; // <20><><EFBFBD><EFBFBD> <20><>ų
attackType.m_cSkillLockCount = m_wSpellLevel / 6;
attackType.m_cSkillLevel = m_wSpellLevel % 6;
unsigned char cDefenceJudge[AtNode::MAX_DEFENDER_NUM] = { 0, };
m_pCaster->MultiAttack(attackType, 1, &lpAffected, cDefenceJudge,
lpAffected->GetCurrentPos(), 0, 12, Math::Const::PI * 2, Skill::Target::ENEMY);
}
}
//-------------------------------------------------------------------------------------------------
// Fired Spell
void CFiredSpell::Operate(CAggresiveCreature* lpAffected)
{
const short wDamage = static_cast<short>( (float)(m_wSpellLevel) * 1.5f );
const short wThreatAmount = (lpAffected->GetStatus().m_nNowHP < wDamage) ?
lpAffected->GetStatus().m_nNowHP : wDamage;
lpAffected->GetThreat().AddToThreatList(m_pCaster, wThreatAmount);
lpAffected->GetStatus().m_nNowHP = (lpAffected->GetStatus().m_nNowHP > wDamage) ?
lpAffected->GetStatus().m_nNowHP - wDamage : 0;
if (0 == lpAffected->GetStatus().m_nNowHP)
{
lpAffected->Dead(m_pCaster);
lpAffected->GetThreat().ClearAll();
}
DefenserNode node;
node.m_wDamage = wDamage;
node.m_dwCharID = lpAffected->GetCID();
node.m_sCurrHP = lpAffected->GetStatus().m_nNowHP;
node.m_sCurrMP = lpAffected->GetStatus().m_nNowMP;
node.m_wMaxHP = lpAffected->GetStatus().m_StatusInfo.m_nMaxHP;
node.m_wMaxMP = lpAffected->GetStatus().m_StatusInfo.m_nMaxMP;
node.m_wMPHeal = 0;
node.m_cJudge = ClientConstants::Judge_Fired;
AtType attackType;
attackType.m_wType = AtType::RIGHT_MELEE;
CCell* lpCell = lpAffected->GetCellPos().m_lpCell;
if (NULL != lpCell)
{
lpCell->SendAttackInfo(m_pCaster->GetCID(), attackType, 1, &node);
}
if (Creature::CT_PC == Creature::GetCreatureType(lpAffected->GetCID()))
{
AtType attackType;
attackType.m_wType = AtType::RIGHT_MELEE;
CCharacter* pAffectedCharacter = (CCharacter *)lpAffected;
CGameClientDispatch* pCharacterDispatcher = pAffectedCharacter->GetDispatcher();
if (NULL != pCharacterDispatcher)
{
GameClientSendPacket::SendCharAttacked(pCharacterDispatcher->GetSendStream(), m_pCaster, pAffectedCharacter,
attackType, 0, wDamage, ClientConstants::Judge_Fired, 0, PktBase::NO_SERVER_ERR);
}
}
}
bool CFiredSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CFiredSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// CurseOfBlind Spell
bool CCurseOfBlindSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CCurseOfBlindSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// KarterantWorldBuff Spell
bool CKarterantWorldBuffSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CKarterantWorldBuffSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// MerkadiaWorldBuff Spell
bool CMerkadiaWorldBuffSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CMerkadiaWorldBuffSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// KarterantWorldDeBuff Spell
bool CKarterantWorldDeBuffSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CKarterantWorldDeBuffSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// MerkadiaWorldDeBuff Spell
bool CMerkadiaWorldDeBuffSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CMerkadiaWorldDeBuffSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// PowerStatue Spell
bool CPowerStatueSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CPowerStatueSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// IntStatue Spell
bool CIntStatueSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CIntStatueSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// ExpStatue Spell
bool CExpStatueSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CExpStatueSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// WealthStatue Spell
bool CWealthStatueSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CWealthStatueSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// RealmHP Spell
bool CRealmHPSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CRealmHPSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// RealmMP Spell
bool CRealmMPSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CRealmMPSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Hundred Spell
bool CHundredLevelSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CHundredLevelSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}
//-------------------------------------------------------------------------------------------------
// Hundred Spell
bool CDeCoolDownSpell::Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), m_wSpellLevel);
lpAffected->CalculateEnchantStatus();
return CSpell::Activate(lpAffected, dwOperateFlag);
}
bool CDeCoolDownSpell::Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag)
{
lpAffected->SetEnchantLevel(static_cast<Skill::SpellID::Type>(m_wSpellID), 0);
lpAffected->CalculateEnchantStatus();
return CSpell::Deactivate(lpAffected, dwOperateFlag);
}

View File

@@ -0,0 +1,722 @@
#ifndef _SPELLTABLE_H_
#define _SPELLTABLE_H_
#include "Spell.h"
//-------------------------------------------------------------------------------------------------
// Chant Table
class CChantSpell : public CSpell
{
protected:
CChantSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CSpell(spell_Info, Skill::Type::CHANT), m_cOperateTurn(0), m_nConsumeMPAmount(nConsumeMPAmount) { }
virtual void Operate(CAggresiveCreature* lpAffected);
char m_cOperateTurn;
short m_nConsumeMPAmount;
};
class CBattleSongSpell : public CChantSpell
{
public:
CBattleSongSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CChantSpell(spell_Info, nConsumeMPAmount) { }
virtual ~CBattleSongSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CStealHandSpell : public CChantSpell
{
public:
CStealHandSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CChantSpell(spell_Info, nConsumeMPAmount) { }
virtual ~CStealHandSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CMaintenanceChantSpell : public CChantSpell
{
public:
CMaintenanceChantSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CChantSpell(spell_Info, nConsumeMPAmount) { }
virtual ~CMaintenanceChantSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CAccelerationChantSpell : public CChantSpell
{
public:
CAccelerationChantSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CChantSpell(spell_Info, nConsumeMPAmount) { }
virtual ~CAccelerationChantSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CLifeAuraSpell : public CChantSpell
{
public:
CLifeAuraSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CChantSpell(spell_Info, nConsumeMPAmount) { }
virtual ~CLifeAuraSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
};
class CSpeedBuffChantSpell : public CChantSpell
{
public:
CSpeedBuffChantSpell(Spell_Info& spell_Info, short nConsumeMPAmount)
: CChantSpell(spell_Info, nConsumeMPAmount) { }
virtual ~CSpeedBuffChantSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
//-------------------------------------------------------------------------------------------------
// Friend Target Enchant Table
class CMichaelBlessSpell : public CSpell
{
public:
CMichaelBlessSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CMichaelBlessSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CExpOrbSpell : public CSpell
{
public:
CExpOrbSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CExpOrbSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CRegenerationSpell : public CSpell
{
public:
CRegenerationSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CRegenerationSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
};
class CBuffPotionSpell : public CSpell
{
public:
CBuffPotionSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CBuffPotionSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CBlazeSpell : public CSpell
{
public:
CBlazeSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CBlazeSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CChargingSpell : public CSpell
{
public:
CChargingSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CChargingSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CStealthSpell : public CSpell
{
public:
CStealthSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CStealthSpell() { Destroy(); }
};
class CManaShellSpell : public CSpell
{
public:
CManaShellSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CManaShellSpell() { Destroy(); }
};
class CEncourageSpell : public CSpell
{
public:
CEncourageSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CEncourageSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CEnchantWeaponSpell : public CSpell
{
public:
CEnchantWeaponSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CEnchantWeaponSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CBrightArmorSpell : public CSpell
{
public:
CBrightArmorSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CBrightArmorSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CHardenSkinSpell : public CSpell
{
public:
CHardenSkinSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CHardenSkinSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CFlexibilitySpell : public CSpell
{
public:
CFlexibilitySpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CFlexibilitySpell() { Destroy(); }
};
class CGuardSpell : public CSpell
{
public:
CGuardSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT), m_nOriginalBlocking(0) { }
virtual ~CGuardSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
short m_nOriginalBlocking;
};
class CLuckyOrbSpell : public CSpell
{
public:
CLuckyOrbSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CLuckyOrbSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CChocolateSpell : public CSpell
{
public:
CChocolateSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CChocolateSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CTasteWineSpell : public CSpell
{
public:
CTasteWineSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CTasteWineSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CWifeCrackerSpell : public CSpell
{
public:
CWifeCrackerSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CWifeCrackerSpell() { Destroy(); }
};
//-------------------------------------------------------------------------------------------------
// Enemy Target Enchant Table
class CSlowSpell : public CSpell
{
public:
CSlowSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CSlowSpell() { Destroy(); }
};
class CArmorBrokenSpell : public CSpell
{
public:
CArmorBrokenSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CArmorBrokenSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CHoldSpell : public CSpell
{
public:
CHoldSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CHoldSpell() { Destroy(); }
};
class CStunSpell : public CSpell
{
public:
CStunSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CStunSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CFrozenSpell : public CSpell
{
public:
CFrozenSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CFrozenSpell() { Destroy(); }
};
class CPoisonedSpell : public CSpell
{
public:
CPoisonedSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CPoisonedSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CLowerStrengthSpell : public CSpell
{
public:
CLowerStrengthSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CLowerStrengthSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CStoneFormSpell : public CSpell
{
public:
CStoneFormSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CStoneFormSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CCounterAttackSpell : public CSpell
{
public:
CCounterAttackSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CCounterAttackSpell() { Destroy(); }
};
class CEnvenomSpell : public CSpell
{
public:
CEnvenomSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CEnvenomSpell() { Destroy(); }
};
class CBombSetSpell : public CSpell
{
public:
CBombSetSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CBombSetSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
};
class CFiredSpell : public CSpell
{
public:
CFiredSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CFiredSpell() { Destroy(); }
protected:
virtual void Operate(CAggresiveCreature* lpAffected);
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CCurseOfBlindSpell : public CSpell
{
public:
CCurseOfBlindSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CCurseOfBlindSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
//-------------------------------------------------------------------------------------------------
// Speacial Enchant Table
class CInvincibleSpell : public CSpell
{
public:
CInvincibleSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CInvincibleSpell() { Destroy(); }
};
class CKarterantWorldBuffSpell : public CSpell
{
public:
CKarterantWorldBuffSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CKarterantWorldBuffSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CMerkadiaWorldBuffSpell : public CSpell
{
public:
CMerkadiaWorldBuffSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CMerkadiaWorldBuffSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CKarterantWorldDeBuffSpell : public CSpell
{
public:
CKarterantWorldDeBuffSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CKarterantWorldDeBuffSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CMerkadiaWorldDeBuffSpell : public CSpell
{
public:
CMerkadiaWorldDeBuffSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CMerkadiaWorldDeBuffSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
//-------------------------------------------------------------------------------------------------
// Statue
class CPowerStatueSpell : public CSpell // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
{
public:
CPowerStatueSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CPowerStatueSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CIntStatueSpell : public CSpell // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
{
public:
CIntStatueSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CIntStatueSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CExpStatueSpell : public CSpell // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
{
public:
CExpStatueSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CExpStatueSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CWealthStatueSpell : public CSpell // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
{
public:
CWealthStatueSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CWealthStatueSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
//-------------------------------------------------------------------------------------------------
// Realm
class CRealmHPSpell : public CSpell // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ.
{
public:
CRealmHPSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CRealmHPSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CRealmMPSpell : public CSpell // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ.
{
public:
CRealmMPSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CRealmMPSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CHundredLevelSpell : public CSpell // 100<30><30> <20><><EFBFBD><EFBFBD>Ʈ
{
public:
CHundredLevelSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CHundredLevelSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
class CDeCoolDownSpell : public CSpell // <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD>
{
public:
CDeCoolDownSpell(Spell_Info& spell_Info)
: CSpell(spell_Info, Skill::Type::ENCHANT) { }
virtual ~CDeCoolDownSpell() { Destroy(); }
protected:
virtual bool Activate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
virtual bool Deactivate(CAggresiveCreature* lpAffected, unsigned long dwOperateFlag);
};
#endif

View File

@@ -0,0 +1,78 @@
#ifndef _SPELL_UTIL_H_
#define _SPELL_UTIL_H_
#include <Skill/Spell/Spell.h>
#include <Creature/Monster/MonsterMgr.h>
#include <Creature/Siege/SiegeConstants.h>
namespace Skill
{
template<typename Spell_t>
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)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> æƮ/<2F><>æƮ <20><><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7>װ<EFBFBD> <20>ִ<EFBFBD> <20><EFBFBD><E0BCAE> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
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;
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> æƮ, <20><>æƮ<C3A6><C6AE> <20>ɸ<EFBFBD><C9B8><EFBFBD> <20>ʴ´<CAB4>.
else if (Creature::CT_STRUCT == eCreatureType)
{
return CSpell::ENCHANT_FAIL_BY_RESIST;
}
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> æƮ, <20><>æƮ<C3A6><C6AE> <20>ɸ<EFBFBD><C9B8><EFBFBD> <20>ʴ´<CAB4>.
else if (Creature::CT_SIEGE_OBJECT == eCreatureType)
{
// <20><> <20><>¡<EFBFBD><C2A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> æƮ<C3A6><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> æƮ, <20><>æƮ<C3A6><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
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