diff options
author | megamage <none@none> | 2009-03-14 21:30:03 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-14 21:30:03 -0600 |
commit | 4cb8ff7f26d1e26e0840153d8f4fddbb616346a5 (patch) | |
tree | 1ccba27515039078fa4c80555fb9896d7a986dee | |
parent | 66cb0cc56aafc5f6bd2d326f6f6df12220610dfd (diff) |
*Fix the case that trap spell is casted on target self.
--HG--
branch : trunk
-rw-r--r-- | src/game/GameObject.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 583bcab36c4..95a83ce6819 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1364,8 +1364,28 @@ void GameObject::Use(Unit* user) spell->prepare(&targets); } -void GameObject::CastSpell(Unit* target, uint32 spell) +void GameObject::CastSpell(Unit* target, uint32 spellId) { + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); + if(!spellInfo) + return; + + bool self = false; + for(int i = 0; i < 3; ++i) + { + if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER) + { + self = true; + break; + } + } + + if(self) + { + target->CastSpell(target, spellInfo, true); + return; + } + //summon world trigger Creature *trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, 1); if(!trigger) return; @@ -1374,12 +1394,12 @@ void GameObject::CastSpell(Unit* target, uint32 spell) if(Unit *owner = GetOwner()) { trigger->setFaction(owner->getFaction()); - trigger->CastSpell(target, spell, true, 0, 0, owner->GetGUID()); + trigger->CastSpell(target, spellInfo, true, 0, 0, owner->GetGUID()); } else { trigger->setFaction(14); - trigger->CastSpell(target, spell, true, 0, 0, target->GetGUID()); + trigger->CastSpell(target, spellInfo, true, 0, 0, target->GetGUID()); } //trigger->setDeathState(JUST_DIED); //trigger->RemoveCorpse(); |