Core/Spells: Fix a regression of 7f30ac5a95 - spells with TARGET_SELECT_CATEGORY_CHANNEL target type (like mind sear) should be triggered by triggering spell caster
This commit is contained in:
@@ -4981,7 +4981,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
}
|
}
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
|
if ((!target && triggerEntry->NeedsExplicitUnitTarget()) || (target && target != this && !target->isAlive()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
|
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
|
||||||
@@ -7770,7 +7770,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
}
|
}
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
|
if ((!target && triggerEntry->NeedsExplicitUnitTarget()) || (target && target != this && !target->isAlive()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cooldown_spell_id == 0)
|
if (cooldown_spell_id == 0)
|
||||||
@@ -7832,7 +7832,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
|
if ((!target && triggerEntry->NeedsExplicitUnitTarget()) || (target && target != this && !target->isAlive()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
|
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
|
||||||
@@ -7889,7 +7889,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
|
|||||||
}
|
}
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
|
if ((!target && triggerEntry->NeedsExplicitUnitTarget()) || (target && target != this && !target->isAlive()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
|
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
|
||||||
@@ -9079,7 +9079,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
|||||||
target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry && triggerEntry->IsPositive() ? this : victim;
|
target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry && triggerEntry->IsPositive() ? this : victim;
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
|
if ((!target && triggerEntry->NeedsExplicitUnitTarget()) || (target && target != this && !target->isAlive()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (basepoints0)
|
if (basepoints0)
|
||||||
|
|||||||
@@ -5456,7 +5456,7 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
|
|||||||
{
|
{
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
Unit* caster = triggeredSpellInfo->IsRequiringSelectedTarget() ? GetCaster() : target;
|
Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? GetCaster() : target;
|
||||||
|
|
||||||
if (!caster)
|
if (!caster)
|
||||||
return;
|
return;
|
||||||
@@ -5468,13 +5468,13 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint64 casterGUID = triggeredSpellInfo->IsRequiringSelectedTarget() ? GetCasterGUID() : target->GetGUID();
|
uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? GetCasterGUID() : target->GetGUID();
|
||||||
target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
|
target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
|
else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
|
||||||
{
|
{
|
||||||
uint64 casterGUID = triggeredSpellInfo->IsRequiringSelectedTarget() ? GetCasterGUID() : target->GetGUID();
|
uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? GetCasterGUID() : target->GetGUID();
|
||||||
// change the stack amount to be equal to stack amount of our aura
|
// change the stack amount to be equal to stack amount of our aura
|
||||||
if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
|
if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
|
||||||
triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
|
triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
|
||||||
@@ -6118,7 +6118,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
|
|||||||
|
|
||||||
if (triggeredSpellInfo)
|
if (triggeredSpellInfo)
|
||||||
{
|
{
|
||||||
if (Unit* triggerCaster = triggeredSpellInfo->IsRequiringSelectedTarget() ? caster : target)
|
if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target)
|
||||||
{
|
{
|
||||||
triggerCaster->CastSpell(target, triggeredSpellInfo, true, NULL, this);
|
triggerCaster->CastSpell(target, triggeredSpellInfo, true, NULL, this);
|
||||||
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
|
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
|
||||||
@@ -6138,7 +6138,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit*
|
|||||||
uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
|
uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
|
||||||
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
|
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
|
||||||
{
|
{
|
||||||
if (Unit* triggerCaster = triggeredSpellInfo->IsRequiringSelectedTarget() ? caster : target)
|
if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target)
|
||||||
{
|
{
|
||||||
int32 basepoints0 = GetAmount();
|
int32 basepoints0 = GetAmount();
|
||||||
triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints0, 0, 0, true, 0, this);
|
triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints0, 0, 0, true, 0, this);
|
||||||
|
|||||||
@@ -1545,7 +1545,7 @@ void Spell::EffectTriggerSpellWithValue(SpellEffIndex effIndex)
|
|||||||
|
|
||||||
int32 bp = damage;
|
int32 bp = damage;
|
||||||
|
|
||||||
Unit* caster = spellInfo->IsRequiringSelectedTarget() ? m_caster : unitTarget;
|
Unit* caster = spellInfo->NeedsToBeTriggeredByCaster() ? m_caster : unitTarget;
|
||||||
|
|
||||||
caster->CastCustomSpell(unitTarget, triggered_spell_id, &bp, &bp, &bp, true);
|
caster->CastCustomSpell(unitTarget, triggered_spell_id, &bp, &bp, &bp, true);
|
||||||
}
|
}
|
||||||
@@ -1770,7 +1770,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
|
|||||||
|
|
||||||
// Note: not exist spells with weapon req. and IsSpellHaveCasterSourceTargets == true
|
// Note: not exist spells with weapon req. and IsSpellHaveCasterSourceTargets == true
|
||||||
// so this just for speedup places in else
|
// so this just for speedup places in else
|
||||||
Unit* caster = spellInfo->IsRequiringSelectedTarget() ? m_caster : unitTarget;
|
Unit* caster = spellInfo->NeedsToBeTriggeredByCaster() ? m_caster : unitTarget;
|
||||||
|
|
||||||
caster->CastSpell(unitTarget, spellInfo, true, 0, 0, (originalCaster ? originalCaster->GetGUID() : 0));
|
caster->CastSpell(unitTarget, spellInfo, true, 0, 0, (originalCaster ? originalCaster->GetGUID() : 0));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1126,9 +1126,25 @@ bool SpellInfo::IsAOE() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpellInfo::IsRequiringSelectedTarget() const
|
bool SpellInfo::NeedsExplicitUnitTarget() const
|
||||||
{
|
{
|
||||||
return (GetExplicitTargetMask() & TARGET_FLAG_UNIT_MASK) != 0;
|
return GetExplicitTargetMask() & TARGET_FLAG_UNIT_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SpellInfo::NeedsToBeTriggeredByCaster() const
|
||||||
|
{
|
||||||
|
if (NeedsExplicitUnitTarget())
|
||||||
|
return true;
|
||||||
|
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
|
{
|
||||||
|
if (Effects[i].IsEffect())
|
||||||
|
{
|
||||||
|
if (Effects[i].TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CHANNEL
|
||||||
|
|| Effects[i].TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CHANNEL)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpellInfo::IsPassive() const
|
bool SpellInfo::IsPassive() const
|
||||||
|
|||||||
@@ -408,7 +408,8 @@ public:
|
|||||||
bool IsAbilityOfSkillType(uint32 skillType) const;
|
bool IsAbilityOfSkillType(uint32 skillType) const;
|
||||||
|
|
||||||
bool IsAOE() const;
|
bool IsAOE() const;
|
||||||
bool IsRequiringSelectedTarget() const;
|
bool NeedsExplicitUnitTarget() const;
|
||||||
|
bool NeedsToBeTriggeredByCaster() const;
|
||||||
|
|
||||||
bool IsPassive() const;
|
bool IsPassive() const;
|
||||||
bool IsAutocastable() const;
|
bool IsAutocastable() const;
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ public:
|
|||||||
if (!target->HasAura(spellId))
|
if (!target->HasAura(spellId))
|
||||||
{
|
{
|
||||||
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||||
Unit* triggerCaster = triggeredSpellInfo->IsRequiringSelectedTarget() ? caster : target;
|
Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target;
|
||||||
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
|
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user