diff options
author | QAston <none@none> | 2010-01-24 13:08:25 +0100 |
---|---|---|
committer | QAston <none@none> | 2010-01-24 13:08:25 +0100 |
commit | d1a40eb6888c325b3f01ac8a90f1dbac7ed56ea0 (patch) | |
tree | d73e698cb5ce789e70382a150aa57298c8c06b02 /src/game/SpellAuras.h | |
parent | 79accd730ecbf396b856ee42e25f2c23e51dceed (diff) |
*Do not keep area aura targets in combat with aura owner
*Add some safety checks to area aura target map update.
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellAuras.h')
-rw-r--r-- | src/game/SpellAuras.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index dfa5fca6432..7289b5c4d36 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -38,27 +38,26 @@ class DynamicObject; class AuraApplication { - friend AuraApplication * Unit::__ApplyAura(Aura * aura); - friend void Unit::__UnapplyAura(AuraApplicationMap::iterator &i); - friend bool Unit::_ApplyAuraEffect(Aura * aura, uint8 effIndex); + friend void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask); + friend void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode); + friend void Unit::_ApplyAuraEffect(Aura * aura, uint8 effIndex); + friend AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask); private: Unit * const m_target; Aura * const m_base; uint8 m_slot; // Aura slot on unit uint8 m_flags; // Aura info flag + uint8 m_effectsToApply; // Used only at spell hit to determine which effect should be applied AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason bool m_needClientUpdate:1; bool m_isNeedManyNegativeEffects:1; - bool m_canBeRemoved:1; // used only in aura list update of Aura - explicit AuraApplication(Unit * target, Unit * caster, Aura * base); + explicit AuraApplication(Unit * target, Unit * caster, Aura * base, uint8 effMask); void _Remove(); private: bool _CheckPositive(Unit * caster) const; void _HandleEffect(uint8 effIndex, bool apply); public: - bool _CanBeRemoved() const {return m_canBeRemoved;} - void _SetCanBeRemoved(bool val) {m_canBeRemoved = val;} Unit * GetTarget() const { return m_target; } Aura * GetBase() const { return m_base; } @@ -68,6 +67,7 @@ class AuraApplication uint8 GetEffectMask() const { return m_flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); } bool HasEffect(uint8 effect) const { assert(effect < MAX_SPELL_EFFECTS); return m_flags & (1<<effect); } bool IsPositive() const { return m_flags & AFLAG_POSITIVE; } + uint8 GetEffectsToApply() const { return m_effectsToApply; } void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; } AuraRemoveMode GetRemoveMode() const {return m_removeMode;} @@ -106,11 +106,12 @@ class TRINITY_DLL_SPEC Aura void _Remove(AuraRemoveMode removeMode); virtual void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) = 0; - virtual void UpdateTargetMapForEffect(Unit * caster, uint8 effIndex) = 0; - void UpdateTargetMap(Unit * caster); + virtual void FillTargetMap(std::map<Unit *, uint8> & targets, Unit * caster) = 0; + void UpdateTargetMap(Unit * caster, bool apply = true); - void ApplyForTargets() {Unit * caster = GetCaster(); UpdateTargetMap(caster);} - void ApplyEffectForTargets(uint8 effIndex) {Unit * caster = GetCaster(); UpdateTargetMapForEffect(caster, effIndex);} + void _RegisterForTargets() {Unit * caster = GetCaster(); UpdateTargetMap(caster, false);} + void ApplyForTargets() {Unit * caster = GetCaster(); UpdateTargetMap(caster, true);} + void _ApplyEffectForTargets(uint8 effIndex); void UpdateOwner(uint32 diff, WorldObject * owner); void Update(uint32 diff, Unit * caster); @@ -202,7 +203,7 @@ class TRINITY_DLL_SPEC UnitAura : public Aura void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void UpdateTargetMapForEffect(Unit * caster, uint8 effIndex); + void FillTargetMap(std::map<Unit *, uint8> & targets, Unit * caster); // Allow Apply Aura Handler to modify and access m_AuraDRGroup void SetDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; } @@ -220,6 +221,6 @@ class TRINITY_DLL_SPEC DynObjAura : public Aura public: void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void UpdateTargetMapForEffect(Unit * caster, uint8 effIndex); + void FillTargetMap(std::map<Unit *, uint8> & targets, Unit * caster); }; #endif |