mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Core/Spells): cache reflection target information for reflected thunderstorm direction (#23762)
This commit is contained in:
@@ -643,6 +643,8 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
|
|||||||
gameObjTarget = nullptr;
|
gameObjTarget = nullptr;
|
||||||
destTarget = nullptr;
|
destTarget = nullptr;
|
||||||
damage = 0;
|
damage = 0;
|
||||||
|
m_reflectionTarget = nullptr;
|
||||||
|
m_reflectionTargetGuid.Clear();
|
||||||
effectHandleMode = SPELL_EFFECT_HANDLE_LAUNCH;
|
effectHandleMode = SPELL_EFFECT_HANDLE_LAUNCH;
|
||||||
m_diminishLevel = DIMINISHING_LEVEL_1;
|
m_diminishLevel = DIMINISHING_LEVEL_1;
|
||||||
m_diminishGroup = DIMINISHING_NONE;
|
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
|
//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 canEffectTrigger = !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPPRESS_CASTER_PROCS) && unitTarget->CanProc() && (CanExecuteTriggersOnHit(mask) || missInfo == SPELL_MISS_IMMUNE2);
|
||||||
bool reflectedSpell = missInfo == SPELL_MISS_REFLECT;
|
bool reflectedSpell = missInfo == SPELL_MISS_REFLECT;
|
||||||
|
Unit* reflectionSource = nullptr;
|
||||||
Unit* spellHitTarget = nullptr;
|
Unit* spellHitTarget = nullptr;
|
||||||
|
|
||||||
if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
|
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;
|
spellHitTarget = m_caster;
|
||||||
unitTarget = m_caster;
|
unitTarget = m_caster;
|
||||||
|
reflectionSource = effectUnit;
|
||||||
if (m_caster->IsCreature())
|
if (m_caster->IsCreature())
|
||||||
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
|
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
|
||||||
}
|
}
|
||||||
@@ -2609,7 +2613,24 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
|||||||
|
|
||||||
if (spellHitTarget)
|
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);
|
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_NONE)
|
||||||
{
|
{
|
||||||
if (missInfo2 != SPELL_MISS_MISS)
|
if (missInfo2 != SPELL_MISS_MISS)
|
||||||
|
|||||||
@@ -666,6 +666,9 @@ public:
|
|||||||
WorldLocation* destTarget;
|
WorldLocation* destTarget;
|
||||||
int32 damage;
|
int32 damage;
|
||||||
SpellEffectHandleMode effectHandleMode;
|
SpellEffectHandleMode effectHandleMode;
|
||||||
|
Unit* m_reflectionTarget;
|
||||||
|
ObjectGuid m_reflectionTargetGuid;
|
||||||
|
Position m_reflectionTargetPosition;
|
||||||
// used in effects handlers
|
// used in effects handlers
|
||||||
Aura* m_spellAura;
|
Aura* m_spellAura;
|
||||||
|
|
||||||
|
|||||||
@@ -5013,7 +5013,24 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float x, y;
|
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())
|
if (m_targets.HasDst())
|
||||||
destTarget->GetPosition(x, y);
|
destTarget->GetPosition(x, y);
|
||||||
|
|||||||
Reference in New Issue
Block a user