diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SpellAuras.cpp | 26 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 13 | ||||
-rw-r--r-- | src/game/Unit.cpp | 12 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
4 files changed, 26 insertions, 27 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index cc2d817dee3..b17aa9ad946 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -343,7 +343,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &AuraEffect::HandleUnused, //288 not used by any spells (3.09) except 1 test spell. }; -Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem, Unit * formalCaster) : +Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem, Unit * source) : m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target), m_timeCla(1000), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false), m_isRemoved(false) @@ -411,9 +411,9 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura if (m_auraFlags & (uint8(1) << i)) { if (currentBasePoints) - m_partAuras[i] = CreateAuraEffect(this, i, currentBasePoints + i, caster, NULL, formalCaster); + m_partAuras[i] = CreateAuraEffect(this, i, currentBasePoints + i, caster, NULL, source); else - m_partAuras[i] = CreateAuraEffect(this, i, NULL, caster, NULL, formalCaster); + m_partAuras[i] = CreateAuraEffect(this, i, NULL, caster, NULL, source); // correct flags if aura couldn't be created if (!m_partAuras[i]) m_auraFlags &= uint8(~(1<< i)); @@ -511,14 +511,14 @@ m_target(parentAura->GetTarget()), m_tickNumber(0) m_periodicTimer += m_amplitude; } -AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster, Item * castItem, Unit * formalCaster) +AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster, Item * castItem, Unit * source) : AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem) { m_removeTime = FRIENDLY_AA_REMOVE_TIME; m_isAreaAura = true; - Unit* caster_ptr = formalCaster ? formalCaster : caster ? caster : m_target; - m_formalCasterGUID = caster_ptr->GetGUID(); + Unit* caster_ptr = source ? source : caster ? caster : m_target; + m_sourceGUID = caster_ptr->GetGUID(); if (m_spellProto->Effect[effIndex] == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY) m_radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[m_effIndex])); @@ -577,11 +577,11 @@ PersistentAreaAuraEffect::~PersistentAreaAuraEffect() { } -AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit* formalCaster) +AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit* source) { assert (parentAura); if (IsAreaAuraEffect(parentAura->GetSpellProto()->Effect[effIndex])) - return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, formalCaster); + return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, source); else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AURA) return new AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem); else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA) @@ -600,14 +600,14 @@ Unit* Aura::GetCaster() const return unit && unit->IsInWorld() ? unit : NULL; } -Unit* AreaAuraEffect::GetFormalCaster() const +Unit* AreaAuraEffect::GetSource() const { - if(m_formalCasterGUID==m_target->GetGUID()) + if(m_sourceGUID==m_target->GetGUID()) return m_target; //return ObjectAccessor::GetUnit(*m_target,m_caster_guid); //must return caster even if it's in another grid/map - Unit *unit = ObjectAccessor::GetObjectInWorld(m_formalCasterGUID, (Unit*)NULL); + Unit *unit = ObjectAccessor::GetObjectInWorld(m_sourceGUID, (Unit*)NULL); return unit && unit->IsInWorld() ? unit : NULL; } @@ -682,7 +682,7 @@ void AuraEffect::Update(uint32 diff) void AreaAuraEffect::Update(uint32 diff) { // update for the caster of the aura - if(m_formalCasterGUID == m_target->GetGUID()) + if(m_sourceGUID == m_target->GetGUID()) { Unit* caster = m_target; Unit * originalCaster = GetCaster(); @@ -773,7 +773,7 @@ void AreaAuraEffect::Update(uint32 diff) return; // Caster may be deleted due to update - Unit* caster = GetFormalCaster(); + Unit* caster = GetSource(); // remove aura if out-of-range from caster (after teleport for example) // or caster is isolated or caster no longer has the aura diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index a391f65407d..f936b4e4174 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -54,7 +54,7 @@ class TRINITY_DLL_SPEC Aura friend void Player::SendAurasForTarget(Unit *target); public: virtual ~Aura(); - Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL, Unit * formalCaster=NULL); + Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL, Unit * source=NULL); SpellEntry const* GetSpellProto() const { return m_spellProto; } uint32 GetId() const{ return m_spellProto->Id; } @@ -171,7 +171,7 @@ class TRINITY_DLL_SPEC Aura class TRINITY_DLL_SPEC AuraEffect { public: - friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit * formalCaster); + friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit * source); friend void Aura::SetStackAmount(uint8 stackAmount, bool applied); //aura handlers void HandleNULL(bool, bool, bool) @@ -394,16 +394,15 @@ class TRINITY_DLL_SPEC AuraEffect class TRINITY_DLL_SPEC AreaAuraEffect : public AuraEffect { public: - AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster=NULL, Item * castItem=NULL, Unit * formalCaster=NULL); + AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster=NULL, Item * castItem=NULL, Unit * source=NULL); ~AreaAuraEffect(); - Unit* GetFormalCaster() const; - uint64 const& GetFormalCasterGUID() const { return m_formalCasterGUID; } + Unit* GetSource() const; void Update(uint32 diff); private: float m_radius; int32 m_removeTime; AreaAuraType m_areaAuraType; - uint64 m_formalCasterGUID; // used for check range + uint64 m_sourceGUID; // used for check range }; class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect @@ -413,5 +412,5 @@ class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect ~PersistentAreaAuraEffect(); void Update(uint32 diff); }; -AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem = NULL, Unit * formalCaster=NULL); +AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem = NULL, Unit * source=NULL); #endif diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a583964560e..7c04f8e9c70 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8499,7 +8499,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo) Unit::AuraEffectList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET); for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) - if(Unit* magnet = (*itr)->IsAreaAura() ? ((AreaAuraEffect*)(*itr))->GetFormalCaster():(*itr)->GetCaster() ) + if(Unit* magnet = (*itr)->IsAreaAura() ? ((AreaAuraEffect*)(*itr))->GetSource():(*itr)->GetCaster() ) if(magnet->isAlive()) { return magnet; @@ -8510,7 +8510,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo) { AuraEffectList const& hitTriggerAuras = victim->GetAurasByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER); for(AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i) - if(Unit* magnet = (*i)->IsAreaAura() ? ((AreaAuraEffect*)(*i))->GetFormalCaster():(*i)->GetCaster() ) + if(Unit* magnet = (*i)->IsAreaAura() ? ((AreaAuraEffect*)(*i))->GetSource():(*i)->GetCaster() ) if(magnet->isAlive() && magnet->IsWithinLOSInMap(this)) if(roll_chance_i((*i)->GetAmount())) { @@ -13766,7 +13766,7 @@ void Unit::AddAura(uint32 spellId, Unit* target) target->AddAura(Aur); } -Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints, Unit * formalCaster) +Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints, Unit * source) { // can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect //assert (!IsPassiveSpell(spellInfo)); @@ -13777,7 +13777,7 @@ Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* c if (aur) { - AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, basePoints, caster,NULL, formalCaster); + AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, basePoints, caster,NULL, source); if (aurEffect && !aur->SetPartAura(aurEffect, effIndex)) delete aurEffect; } @@ -13787,10 +13787,10 @@ Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* c { int32 amount[3]; amount[effIndex] = *basePoints; - aur = new Aura(spellInfo, 1<<effIndex, amount, this ,caster, NULL,formalCaster); + aur = new Aura(spellInfo, 1<<effIndex, amount, this ,caster, NULL,source); } else - aur = new Aura(spellInfo, 1<<effIndex, NULL, this ,caster, NULL,formalCaster); + aur = new Aura(spellInfo, 1<<effIndex, NULL, this ,caster, NULL,source); if(!AddAura(aur)) return NULL; diff --git a/src/game/Unit.h b/src/game/Unit.h index 35f4ef1763b..f5502e130e0 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1190,7 +1190,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void AddAura(uint32 spellId, Unit *target); void HandleAuraEffect(AuraEffect * aureff, bool apply); - Aura *AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints=NULL, Unit * formalCaster=NULL); + Aura *AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints=NULL, Unit * source=NULL); bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const; |