mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/Spells: Remove spell range increase when caster or target move backwards
(cherry picked from commit f19e1a2716)
This commit is contained in:
@@ -7169,6 +7169,13 @@ SpellCastResult Spell::CheckRange(bool strict) const
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
bool Spell::CanIncreaseRangeByMovement(Unit const* unit)
|
||||
{
|
||||
// forward running only
|
||||
return unit->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT | MOVEMENTFLAG_FALLING)
|
||||
&& !unit->IsWalking();
|
||||
}
|
||||
|
||||
std::pair<float, float> Spell::GetMinMaxRange(bool strict) const
|
||||
{
|
||||
float rangeMod = 0.0f;
|
||||
@@ -7210,7 +7217,7 @@ std::pair<float, float> Spell::GetMinMaxRange(bool strict) const
|
||||
}
|
||||
}
|
||||
|
||||
if (target && unitCaster && unitCaster->isMoving() && target->isMoving() && !unitCaster->IsWalking() && !target->IsWalking() &&
|
||||
if (target && unitCaster && CanIncreaseRangeByMovement(target) && CanIncreaseRangeByMovement(unitCaster) &&
|
||||
((m_spellInfo->RangeEntry->Flags & SPELL_RANGE_MELEE) || target->GetTypeId() == TYPEID_PLAYER))
|
||||
rangeMod += 8.0f / 3.0f;
|
||||
}
|
||||
|
||||
@@ -678,6 +678,8 @@ class TC_GAME_API Spell
|
||||
bool IsWithinLOS(WorldObject const* source, Position const& target, VMAP::ModelIgnoreFlags ignoreFlags) const;
|
||||
void MovePosition(Position& pos, WorldObject const* from, float dist, float angle) const;
|
||||
|
||||
static bool CanIncreaseRangeByMovement(Unit const* unit);
|
||||
|
||||
protected:
|
||||
bool HasGlobalCooldown() const;
|
||||
void TriggerGlobalCooldown();
|
||||
|
||||
@@ -663,7 +663,7 @@ float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, SpellTarget
|
||||
|
||||
if (caster)
|
||||
{
|
||||
if (Unit* casterUnit = caster->ToUnit())
|
||||
if (Unit const* casterUnit = caster->ToUnit())
|
||||
radius += entry->RadiusPerLevel * casterUnit->GetLevel();
|
||||
|
||||
radius = std::min(radius, entry->RadiusMax);
|
||||
@@ -672,7 +672,7 @@ float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, SpellTarget
|
||||
modOwner->ApplySpellMod(_spellInfo, SpellModOp::Radius, radius, spell);
|
||||
|
||||
if (!_spellInfo->HasAttribute(SPELL_ATTR9_NO_MOVEMENT_RADIUS_BONUS))
|
||||
if (Unit* casterUnit = caster->ToUnit(); casterUnit && casterUnit->isMoving() && !casterUnit->IsWalking())
|
||||
if (Unit const* casterUnit = caster->ToUnit(); casterUnit && Spell::CanIncreaseRangeByMovement(casterUnit))
|
||||
radius += 2.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user