fix(Core/Spells): cache reflection target information for reflected thunderstorm direction (#23762)
This commit is contained in:
parent
01ebb1f193
commit
a0f8f34ded
3 changed files with 42 additions and 1 deletions
|
|
@ -643,6 +643,8 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
|
|||
gameObjTarget = nullptr;
|
||||
destTarget = nullptr;
|
||||
damage = 0;
|
||||
m_reflectionTarget = nullptr;
|
||||
m_reflectionTargetGuid.Clear();
|
||||
effectHandleMode = SPELL_EFFECT_HANDLE_LAUNCH;
|
||||
m_diminishLevel = DIMINISHING_LEVEL_1;
|
||||
m_diminishGroup = DIMINISHING_NONE;
|
||||
|
|
@ -2591,6 +2593,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
|||
//Spells with this flag cannot trigger if effect is casted on self
|
||||
bool canEffectTrigger = !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPPRESS_CASTER_PROCS) && unitTarget->CanProc() && (CanExecuteTriggersOnHit(mask) || missInfo == SPELL_MISS_IMMUNE2);
|
||||
bool reflectedSpell = missInfo == SPELL_MISS_REFLECT;
|
||||
Unit* reflectionSource = nullptr;
|
||||
Unit* spellHitTarget = nullptr;
|
||||
|
||||
if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
|
||||
|
|
@ -2602,6 +2605,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
|||
{
|
||||
spellHitTarget = m_caster;
|
||||
unitTarget = m_caster;
|
||||
reflectionSource = effectUnit;
|
||||
if (m_caster->IsCreature())
|
||||
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
|
||||
}
|
||||
|
|
@ -2609,7 +2613,24 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
|||
|
||||
if (spellHitTarget)
|
||||
{
|
||||
if (reflectionSource)
|
||||
{
|
||||
m_reflectionTarget = reflectionSource;
|
||||
m_reflectionTargetGuid = reflectionSource->GetGUID();
|
||||
m_reflectionTargetPosition.Relocate(reflectionSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reflectionTarget = nullptr;
|
||||
m_reflectionTargetGuid.Clear();
|
||||
m_reflectionTargetPosition = Position();
|
||||
}
|
||||
|
||||
SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura);
|
||||
|
||||
m_reflectionTarget = nullptr;
|
||||
m_reflectionTargetGuid.Clear();
|
||||
m_reflectionTargetPosition = Position();
|
||||
if (missInfo2 != SPELL_MISS_NONE)
|
||||
{
|
||||
if (missInfo2 != SPELL_MISS_MISS)
|
||||
|
|
|
|||
|
|
@ -666,6 +666,9 @@ public:
|
|||
WorldLocation* destTarget;
|
||||
int32 damage;
|
||||
SpellEffectHandleMode effectHandleMode;
|
||||
Unit* m_reflectionTarget;
|
||||
ObjectGuid m_reflectionTargetGuid;
|
||||
Position m_reflectionTargetPosition;
|
||||
// used in effects handlers
|
||||
Aura* m_spellAura;
|
||||
|
||||
|
|
|
|||
|
|
@ -5013,7 +5013,24 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
|
|||
return;
|
||||
|
||||
float x, y;
|
||||
if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST)
|
||||
Unit* reflectionSource = m_reflectionTarget;
|
||||
|
||||
if (!reflectionSource && !m_reflectionTargetGuid.IsEmpty())
|
||||
{
|
||||
if (Unit* resolvedSource = ObjectAccessor::GetUnit(*m_caster, m_reflectionTargetGuid))
|
||||
reflectionSource = resolvedSource;
|
||||
}
|
||||
|
||||
if (reflectionSource)
|
||||
{
|
||||
reflectionSource->GetPosition(x, y);
|
||||
}
|
||||
else if (!m_reflectionTargetGuid.IsEmpty())
|
||||
{
|
||||
x = m_reflectionTargetPosition.GetPositionX();
|
||||
y = m_reflectionTargetPosition.GetPositionY();
|
||||
}
|
||||
else if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST)
|
||||
{
|
||||
if (m_targets.HasDst())
|
||||
destTarget->GetPosition(x, y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue