diff options
author | QAston <qaston@gmail.com> | 2012-03-03 00:19:00 +0100 |
---|---|---|
committer | QAston <qaston@gmail.com> | 2012-03-03 00:19:48 +0100 |
commit | a08fe16d6967798b3dcb92ef03399b34c29e2597 (patch) | |
tree | 3b86880c1893e5f17655ab2dba6644b44e43f368 /src/server/game/Spells/Spell.h | |
parent | b0985b4d5f98186a28b82fb9d92380de1fadafd1 (diff) |
Core/Spells: Allow spell effects to have multiple destinations. Spells like: 49814, 10869 and similar are now properly selecting destination targets.
Diffstat (limited to 'src/server/game/Spells/Spell.h')
-rwxr-xr-x | src/server/game/Spells/Spell.h | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 971bc1989ab..f897092e519 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -79,6 +79,18 @@ enum SpellRangeFlag SPELL_RANGE_RANGED = 2, //hunter range and ranged weapon }; +struct SpellDestination +{ + SpellDestination(); + SpellDestination(float x, float y, float z, float orientation = 0.0f, uint32 mapId = MAPID_INVALID); + SpellDestination(Position const& pos); + SpellDestination(WorldObject const& wObj); + + WorldLocation _position; + uint64 _transportGUID; + Position _transportOffset; +}; + class SpellCastTargets { public: @@ -115,14 +127,16 @@ class SpellCastTargets void SetTradeItemTarget(Player* caster); void UpdateTradeSlotItem(); - Position const* GetSrc() const; + SpellDestination const* GetSrc() const; + Position const* GetSrcPos() const; void SetSrc(float x, float y, float z); void SetSrc(Position const& pos); void SetSrc(WorldObject const& wObj); void ModSrc(Position const& pos); void RemoveSrc(); - WorldLocation const* GetDst() const; + SpellDestination const* GetDst() const; + WorldLocation const* GetDstPos() const; void SetDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID); void SetDst(Position const& pos); void SetDst(WorldObject const& wObj); @@ -139,7 +153,7 @@ class SpellCastTargets float GetSpeed() const { return m_speed; } void SetSpeed(float speed) { m_speed = speed; } - float GetDist2d() const { return m_srcPos.GetExactDist2d(&m_dstPos); } + float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); } float GetSpeedXY() const { return m_speed * cos(m_elevation); } float GetSpeedZ() const { return m_speed * sin(m_elevation); } @@ -158,13 +172,8 @@ class SpellCastTargets uint64 m_itemTargetGUID; uint32 m_itemTargetEntry; - uint64 m_srcTransGUID; - Position m_srcTransOffset; - Position m_srcPos; - - uint64 m_dstTransGUID; - Position m_dstTransOffset; - WorldLocation m_dstPos; + SpellDestination m_src; + SpellDestination m_dst; float m_elevation, m_speed; std::string m_strTarget; @@ -197,11 +206,6 @@ enum SpellEffectHandleMode SPELL_EFFECT_HANDLE_HIT_TARGET, }; -namespace Trinity -{ - struct SpellNotifierCreatureAndPlayer; -} - class Spell { friend void Unit::SetCurrentCastedSpell(Spell* pSpell); @@ -529,6 +533,7 @@ class Spell Unit* unitTarget; Item* itemTarget; GameObject* gameObjTarget; + WorldLocation* destTarget; int32 damage; SpellEffectHandleMode effectHandleMode; // used in effects handlers @@ -589,10 +594,13 @@ class Spell }; std::list<ItemTargetInfo> m_UniqueItemInfo; + SpellDestination m_destTargets[MAX_SPELL_EFFECTS]; + void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true); void AddGOTarget(GameObject* target, uint32 effectMask); - void AddGOTarget(uint64 goGUID, uint32 effectMask); void AddItemTarget(Item* item, uint32 effectMask); + void AddDestTarget(SpellDestination const& dest, uint32 effIndex); + void DoAllEffectOnTarget(TargetInfo* target); SpellMissInfo DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura); void DoTriggersOnSpellHit(Unit* unit, uint8 effMask); @@ -631,7 +639,6 @@ class Spell HitTriggerSpells m_hitTriggerSpells; // effect helpers - void GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0); void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons); void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz); |