mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Core/Spell: Proper SPELL_EFFECT_PULL_TOWARDS_DEST implementation for players
* Core/Spell: SPELL_EFFECT_PULL_TOWARDS correction
This commit is contained in:
@@ -213,7 +213,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
||||
&Spell::EffectTriggerSpell, //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
|
||||
&Spell::EffectApplyAreaAura, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER
|
||||
&Spell::EffectKnockBack, //144 SPELL_EFFECT_KNOCK_BACK_DEST
|
||||
&Spell::EffectPullTowards, //145 SPELL_EFFECT_PULL_TOWARDS_DEST Black Hole Effect
|
||||
&Spell::EffectPullTowardsDest, //145 SPELL_EFFECT_PULL_TOWARDS_DEST Black Hole Effect
|
||||
&Spell::EffectActivateRune, //146 SPELL_EFFECT_ACTIVATE_RUNE
|
||||
&Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
|
||||
&Spell::EffectTriggerMissileSpell, //148 SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE
|
||||
@@ -4553,22 +4553,40 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
Position pos;
|
||||
if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_PULL_TOWARDS_DEST)
|
||||
Position pos = m_caster->GetFirstCollisionPosition(m_caster->GetCombatReach(), m_caster->GetRelativeAngle(unitTarget));
|
||||
|
||||
// This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance.
|
||||
float distXY = unitTarget->GetExactDist(pos);
|
||||
float distZ = pos.GetPositionZ() - unitTarget->GetPositionZ();
|
||||
float speedXY = m_spellInfo->Effects[effIndex].MiscValue ? m_spellInfo->Effects[effIndex].MiscValue / 10.0f : 30.0f;
|
||||
float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY);
|
||||
|
||||
unitTarget->JumpTo(speedXY, speedZ, true, pos);
|
||||
}
|
||||
|
||||
void Spell::EffectPullTowardsDest(SpellEffIndex effIndex)
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
if (!m_targets.HasDst())
|
||||
{
|
||||
if (m_targets.HasDst())
|
||||
pos.Relocate(*destTarget);
|
||||
else
|
||||
return;
|
||||
}
|
||||
else //if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_PULL_TOWARDS)
|
||||
{
|
||||
pos.Relocate(m_caster);
|
||||
TC_LOG_ERROR("spells", "Spell %u with SPELL_EFFECT_PULL_TOWARDS_DEST has no dest target", m_spellInfo->Id);
|
||||
return;
|
||||
}
|
||||
|
||||
float speedXY, speedZ;
|
||||
CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(pos), speedXY, speedZ);
|
||||
unitTarget->GetMotionMaster()->MoveJump(pos, speedXY, speedZ);
|
||||
Position const* pos = m_targets.GetDstPos();
|
||||
// This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance
|
||||
float distXY = unitTarget->GetExactDist(pos);
|
||||
float distZ = pos->GetPositionZ() - unitTarget->GetPositionZ();
|
||||
|
||||
float speedXY = m_spellInfo->Effects[effIndex].MiscValue / 10.0f;
|
||||
float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY);
|
||||
|
||||
unitTarget->JumpTo(speedXY, speedZ, true, *pos);
|
||||
}
|
||||
|
||||
void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
|
||||
|
||||
Reference in New Issue
Block a user