mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
fix(Core/Spell): Improvements to path generation for Charge mechanic (#11534)
It has its flaws but it can be improved and it's actually a lot better than what we currently have.
This commit is contained in:
committed by
GitHub
parent
ad8f8ee5a5
commit
59e45c251e
@@ -4870,10 +4870,12 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
|
||||
targetGUID = unitTarget->GetGUID();
|
||||
}
|
||||
|
||||
if (m_pathFinder)
|
||||
float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
|
||||
// Spell is not using explicit target - no generated path
|
||||
if (!m_preGeneratedPath)
|
||||
{
|
||||
m_caster->GetMotionMaster()->MoveCharge(m_pathFinder->GetEndPosition().x, m_pathFinder->GetEndPosition().y, m_pathFinder->GetEndPosition().z,
|
||||
42.0f, EVENT_CHARGE, &m_pathFinder->GetPath(), false, 0.f, targetGUID);
|
||||
Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetCombatReach(), unitTarget->GetRelativeAngle(m_caster));
|
||||
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed);
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -4882,10 +4884,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster));
|
||||
|
||||
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ + Z_OFFSET_FIND_HEIGHT, SPEED_CHARGE, EVENT_CHARGE,
|
||||
nullptr, false, 0.f, targetGUID);
|
||||
m_caster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed);
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user