diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 22 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 1 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 5 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fb59366ac19..9a4b7a347c8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3460,7 +3460,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo ASSERT(!aurApp->GetEffectMask()); // Remove totem at next update if totem loses its aura - if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()&& ToTotem()->GetSummonerGUID() == aura->GetCasterGUID()) + if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()) { if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE) ToTotem()->setDeathState(JUST_DIED); @@ -9584,6 +9584,15 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth) return gain; } +bool Unit::IsMagnet() const +{ + // Grounding Totem + if (GetUInt32Value(UNIT_CREATED_BY_SPELL) == 8177) /// @todo: find a more generic solution + return true; + + return false; +} + Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) { // Patch 1.2 notes: Spell Reflection no longer reflects abilities @@ -9599,7 +9608,16 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) && _IsValidAttackTarget(magnet, spellInfo)) { /// @todo handle this charge drop by proc in cast phase on explicit target - (*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE); + if (victim && spellInfo->Speed > 0.0f) + { + // Set up missile speed based delay + uint32 delay = uint32(std::floor(std::max<float>(victim->GetDistance(this), 5.0f) / spellInfo->Speed * 1000.0f)); + // Schedule charge drop + (*itr)->GetBase()->DropChargeDelayed(delay,AURA_REMOVE_BY_EXPIRE); + } + else + (*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE); + return magnet; } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 63a984f1247..a1959a4d514 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1971,6 +1971,7 @@ class Unit : public WorldObject uint32 BuildAuraStateUpdateForTarget(Unit* target) const; bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const; void UnsummonAllTotems(); + bool IsMagnet() const; Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo); Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 5ef6acbcce1..2462c6a9ac4 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1738,6 +1738,11 @@ bool SpellInfo::CheckTargetCreatureType(Unit const* target) const else return true; } + + // if target is magnet (i.e Grounding Totem) the check is skipped + if (target->IsMagnet()) + return true; + uint32 creatureType = target->GetCreatureTypeMask(); return !TargetCreatureType || !creatureType || (creatureType & TargetCreatureType); } |