diff options
| author | QAston <none@none> | 2010-10-04 20:32:10 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2010-10-04 20:32:10 +0200 |
| commit | abe769a310c7af0cf09dbaf72009f3a1c1b1b817 (patch) | |
| tree | 9c5210807724621c35b5d0322397bc922d538290 | |
| parent | 69057dcaeb27daaa7bb1ecb06c22103b0a168e28 (diff) | |
Core/ScriptSystem: Extend SpellScript API by spell focus targets accessors.
--HG--
branch : trunk
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 17 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.h | 15 |
3 files changed, 30 insertions, 4 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 548a3220c97..3494789fa03 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2024,7 +2024,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) m_caster->CastSpell(m_caster, 36895, true); break; case 4: - // Transform + // Transform { if (m_caster->ToPlayer()->GetTeam() == ALLIANCE) m_caster->CastSpell(m_caster, 36897, true); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 94adbeb5f2b..269ec503c3a 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -210,13 +210,28 @@ SpellEntry const * SpellScript::GetSpellInfo() return m_spell->GetSpellInfo(); } -WorldLocation * SpellScript::GetDest() +WorldLocation * SpellScript::GetTargetDest() { if (m_spell->m_targets.HasDst()) return &m_spell->m_targets.m_dstPos; return NULL; } +Unit * SpellScript::GetTargetUnit() +{ + return m_spell->m_targets.getUnitTarget(); +} + +GameObject * SpellScript::GetTargetGObj() +{ + return m_spell->m_targets.getGOTarget(); +} + +Item * SpellScript::GetTargetItem() +{ + return m_spell->m_targets.getItemTarget(); +} + Unit * SpellScript::GetHitUnit() { if (!IsInHitPhase()) diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index c33c2471a45..768a35c82f9 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -192,8 +192,19 @@ class SpellScript : public _SpellScript SpellEntry const * GetSpellInfo(); // methods useable after spell targets are set - // returns: destination of the spell if exists, otherwise NULL - WorldLocation * GetDest(); + // accessors to the "focus" targets of the spell + // note: do not confuse these with spell hit targets + // returns: WorldLocation which was selected as a spell destination or NULL + WorldLocation * GetTargetDest(); + + // returns: Unit which was selected as a spell target or NULL + Unit * GetTargetUnit(); + + // returns: GameObject which was selected as a spell target or NULL + GameObject * GetTargetGObj(); + + // returns: Item which was selected as a spell target or NULL + Item * GetTargetItem(); // methods useable only during spell hit on target phase: |
