aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2011-07-22 21:22:05 +0200
committerShauren <shauren.trinity@gmail.com>2011-07-22 21:22:05 +0200
commit74e2d981ac1af4b0e9101c9e5e8a5bf23fd60566 (patch)
tree7a84fc4ffe636eb031f4498da384f23a441752f2 /src/server/game/Spells/Spell.cpp
parent0a4f18fab380ce210a215374b4df8f241ea50aab (diff)
Core/GameObject: Refactored destructible building handling, properly implemented spell effect repair
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 97dfc8bd188..28849f09386 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1012,20 +1012,34 @@ void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex)
AddUnitTarget(unit, effIndex);
}
-void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
+void Spell::AddGOTarget(GameObject* go, uint32 effIndex)
{
if (m_spellInfo->Effect[effIndex] == 0)
return;
- uint64 targetGUID = pVictim->GetGUID();
+ switch (m_spellInfo->Effect[effIndex])
+ {
+ case SPELL_EFFECT_GAMEOBJECT_DAMAGE:
+ case SPELL_EFFECT_GAMEOBJECT_REPAIR:
+ case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE:
+ if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
+ return;
+ break;
+ default:
+ break;
+ }
+
+ uint64 targetGUID = go->GetGUID();
// Lookup target in already in list
for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
+ {
if (targetGUID == ihit->targetGUID) // Found in list
{
ihit->effectMask |= 1 << effIndex; // Add only effect mask
return;
}
+ }
// This is new target calculate data for him
@@ -1038,10 +1052,11 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
if (m_spellInfo->speed > 0.0f)
{
// calculate spell incoming interval
- float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
- if (dist < 5.0f) dist = 5.0f;
- target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
- if (m_delayMoment == 0 || m_delayMoment>target.timeDelay)
+ float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
+ if (dist < 5.0f)
+ dist = 5.0f;
+ target.timeDelay = uint64(floor(dist / m_spellInfo->speed * 1000.0f));
+ if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
m_delayMoment = target.timeDelay;
}
else
@@ -1053,8 +1068,7 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex)
{
- GameObject* go = m_caster->GetMap()->GetGameObject(goGUID);
- if (go)
+ if (GameObject* go = m_caster->GetMap()->GetGameObject(goGUID))
AddGOTarget(go, effIndex);
}