mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
Core/Spells: Triggered spells should not cause players to stand up (#8986)
- Closes #8764
This commit is contained in:
@@ -2849,7 +2849,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// xinef: triggered spells should not prolong combat
|
// xinef: triggered spells should not prolong combat
|
||||||
if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPRESS_TARGET_PROCS) && !m_triggeredByAuraSpell.spellInfo)
|
if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPRESS_TARGET_PROCS) && !m_triggeredByAuraSpell)
|
||||||
{
|
{
|
||||||
m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit);
|
m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit);
|
||||||
unit->getHostileRefMgr().threatAssist(m_caster, 0.0f);
|
unit->getHostileRefMgr().threatAssist(m_caster, 0.0f);
|
||||||
@@ -2884,7 +2884,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
|||||||
unit->IncrDiminishing(m_diminishGroup);
|
unit->IncrDiminishing(m_diminishGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell.spellInfo && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))
|
if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))
|
||||||
{
|
{
|
||||||
unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
||||||
}
|
}
|
||||||
@@ -2983,7 +2983,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// xinef: apply relic cooldown, imo best place to add this
|
// xinef: apply relic cooldown, imo best place to add this
|
||||||
if (m_CastItem && m_CastItem->GetTemplate()->InventoryType == INVTYPE_RELIC && m_triggeredByAuraSpell.spellInfo)
|
if (m_CastItem && m_CastItem->GetTemplate()->InventoryType == INVTYPE_RELIC && m_triggeredByAuraSpell)
|
||||||
m_caster->AddSpellCooldown(SPELL_RELIC_COOLDOWN, m_CastItem->GetEntry(), duration);
|
m_caster->AddSpellCooldown(SPELL_RELIC_COOLDOWN, m_CastItem->GetEntry(), duration);
|
||||||
|
|
||||||
m_spellAura->SetTriggeredByAuraSpellInfo(m_triggeredByAuraSpell.spellInfo);
|
m_spellAura->SetTriggeredByAuraSpellInfo(m_triggeredByAuraSpell.spellInfo);
|
||||||
@@ -3417,7 +3417,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
|
|||||||
|
|
||||||
LOG_DEBUG("spells.aura", "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask());
|
LOG_DEBUG("spells.aura", "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask());
|
||||||
|
|
||||||
if (!(m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) && !(m_spellInfo->Attributes & SPELL_ATTR0_ALLOW_WHILE_SITTING) && m_caster->IsSitState())
|
if (!(m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) && !(m_spellInfo->Attributes & SPELL_ATTR0_ALLOW_WHILE_SITTING) && !m_triggeredByAuraSpell && m_caster->IsSitState())
|
||||||
{
|
{
|
||||||
m_caster->SetStandState(UNIT_STAND_STATE_STAND);
|
m_caster->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
}
|
}
|
||||||
@@ -4179,7 +4179,7 @@ void Spell::finish(bool ok)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// potions disabled by client, send event "not in combat" if need
|
// potions disabled by client, send event "not in combat" if need
|
||||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_triggeredByAuraSpell.spellInfo)
|
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_triggeredByAuraSpell)
|
||||||
m_caster->ToPlayer()->UpdatePotionCooldown(this);
|
m_caster->ToPlayer()->UpdatePotionCooldown(this);
|
||||||
|
|
||||||
// Take mods after trigger spell (needed for 14177 to affect 48664)
|
// Take mods after trigger spell (needed for 14177 to affect 48664)
|
||||||
@@ -4358,7 +4358,7 @@ void Spell::SendSpellStart()
|
|||||||
|
|
||||||
uint32 castFlags = CAST_FLAG_HAS_TRAJECTORY;
|
uint32 castFlags = CAST_FLAG_HAS_TRAJECTORY;
|
||||||
|
|
||||||
if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell.spellInfo) && !m_cast_count && !m_spellInfo->IsChanneled())
|
if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) && !m_cast_count && !m_spellInfo->IsChanneled())
|
||||||
castFlags |= CAST_FLAG_PENDING;
|
castFlags |= CAST_FLAG_PENDING;
|
||||||
|
|
||||||
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||||
@@ -4414,7 +4414,7 @@ void Spell::SendSpellGo()
|
|||||||
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
|
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
|
||||||
|
|
||||||
// triggered spells with spell visual != 0
|
// triggered spells with spell visual != 0
|
||||||
if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell.spellInfo) && !m_cast_count && !m_spellInfo->IsChanneled())
|
if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) && !m_cast_count && !m_spellInfo->IsChanneled())
|
||||||
castFlags |= CAST_FLAG_PENDING;
|
castFlags |= CAST_FLAG_PENDING;
|
||||||
|
|
||||||
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||||
@@ -4897,7 +4897,7 @@ void Spell::TakeCastItem()
|
|||||||
|
|
||||||
void Spell::TakePower()
|
void Spell::TakePower()
|
||||||
{
|
{
|
||||||
if (m_CastItem || m_triggeredByAuraSpell.spellInfo)
|
if (m_CastItem || m_triggeredByAuraSpell)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Don't take power if the spell is cast while .cheat power is enabled.
|
//Don't take power if the spell is cast while .cheat power is enabled.
|
||||||
@@ -5231,7 +5231,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT
|
|||||||
SpellCastResult Spell::CheckCast(bool strict)
|
SpellCastResult Spell::CheckCast(bool strict)
|
||||||
{
|
{
|
||||||
// check death state
|
// check death state
|
||||||
if (!m_caster->IsAlive() && !m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !(m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_CAST_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell.spellInfo)))
|
if (!m_caster->IsAlive() && !m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !(m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_CAST_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell)))
|
||||||
return SPELL_FAILED_CASTER_DEAD;
|
return SPELL_FAILED_CASTER_DEAD;
|
||||||
|
|
||||||
// Spectator check
|
// Spectator check
|
||||||
@@ -5257,7 +5257,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
|
|
||||||
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
|
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
|
||||||
{
|
{
|
||||||
if (m_triggeredByAuraSpell.spellInfo)
|
if (m_triggeredByAuraSpell)
|
||||||
return SPELL_FAILED_DONT_REPORT;
|
return SPELL_FAILED_DONT_REPORT;
|
||||||
else
|
else
|
||||||
return SPELL_FAILED_NOT_READY;
|
return SPELL_FAILED_NOT_READY;
|
||||||
@@ -5453,7 +5453,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
{
|
{
|
||||||
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
|
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
|
||||||
// Xinef: do not check explicit target for triggered spell casted on self with targetflag enemy
|
// Xinef: do not check explicit target for triggered spell casted on self with targetflag enemy
|
||||||
if (!m_triggeredByAuraSpell.spellInfo || m_targets.GetUnitTarget() != m_caster || !(m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT_ENEMY))
|
if (!m_triggeredByAuraSpell || m_targets.GetUnitTarget() != m_caster || !(m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT_ENEMY))
|
||||||
{
|
{
|
||||||
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget((m_originalCaster && m_caster->GetEntry() != WORLD_TRIGGER) ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
|
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget((m_originalCaster && m_caster->GetEntry() != WORLD_TRIGGER) ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
|
||||||
if (castResult != SPELL_CAST_OK)
|
if (castResult != SPELL_CAST_OK)
|
||||||
@@ -5573,7 +5573,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection)
|
// xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection)
|
||||||
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS) || (m_spellInfo->PreventionType > SPELL_PREVENTION_TYPE_NONE && m_triggeredByAuraSpell.spellInfo && m_triggeredByAuraSpell.spellInfo->IsPositive()))
|
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS) || (m_spellInfo->PreventionType > SPELL_PREVENTION_TYPE_NONE && m_triggeredByAuraSpell && m_triggeredByAuraSpell.spellInfo->IsPositive()))
|
||||||
{
|
{
|
||||||
castResult = CheckCasterAuras(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS);
|
castResult = CheckCasterAuras(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS);
|
||||||
if (castResult != SPELL_CAST_OK)
|
if (castResult != SPELL_CAST_OK)
|
||||||
@@ -6284,7 +6284,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
return SPELL_FAILED_NO_COMBO_POINTS;
|
return SPELL_FAILED_NO_COMBO_POINTS;
|
||||||
|
|
||||||
// xinef: check relic cooldown
|
// xinef: check relic cooldown
|
||||||
if (m_CastItem && m_CastItem->GetTemplate()->InventoryType == INVTYPE_RELIC && m_triggeredByAuraSpell.spellInfo)
|
if (m_CastItem && m_CastItem->GetTemplate()->InventoryType == INVTYPE_RELIC && m_triggeredByAuraSpell)
|
||||||
if (m_caster->HasSpellCooldown(SPELL_RELIC_COOLDOWN) && !m_caster->HasSpellItemCooldown(SPELL_RELIC_COOLDOWN, m_CastItem->GetEntry()))
|
if (m_caster->HasSpellCooldown(SPELL_RELIC_COOLDOWN) && !m_caster->HasSpellItemCooldown(SPELL_RELIC_COOLDOWN, m_CastItem->GetEntry()))
|
||||||
return SPELL_FAILED_NOT_READY;
|
return SPELL_FAILED_NOT_READY;
|
||||||
|
|
||||||
@@ -7423,7 +7423,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour
|
// if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour
|
||||||
if (IsTriggered() && m_triggeredByAuraSpell.spellInfo && (m_triggeredByAuraSpell.spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) ||
|
if (IsTriggered() && m_triggeredByAuraSpell && (m_triggeredByAuraSpell.spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) ||
|
||||||
DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_triggeredByAuraSpell.spellInfo->Id, nullptr, SPELL_DISABLE_LOS)))
|
DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_triggeredByAuraSpell.spellInfo->Id, nullptr, SPELL_DISABLE_LOS)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -7542,8 +7542,8 @@ bool Spell::IsAutoActionResetSpell() const
|
|||||||
bool Spell::IsNeedSendToClient(bool go) const
|
bool Spell::IsNeedSendToClient(bool go) const
|
||||||
{
|
{
|
||||||
return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || m_spellInfo->IsChanneled() ||
|
return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || m_spellInfo->IsChanneled() ||
|
||||||
m_spellInfo->Speed > 0.0f || (!m_triggeredByAuraSpell.spellInfo && !IsTriggered()) ||
|
m_spellInfo->Speed > 0.0f || (!m_triggeredByAuraSpell && !IsTriggered()) ||
|
||||||
(go && m_triggeredByAuraSpell.spellInfo && m_triggeredByAuraSpell.spellInfo->IsChanneled());
|
(go && m_triggeredByAuraSpell && m_triggeredByAuraSpell.spellInfo->IsChanneled());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Spell::HaveTargetsForEffect(uint8 effect) const
|
bool Spell::HaveTargetsForEffect(uint8 effect) const
|
||||||
|
|||||||
@@ -272,6 +272,9 @@ struct TriggeredByAuraSpellData
|
|||||||
|
|
||||||
void Init(AuraEffect const* aurEff);
|
void Init(AuraEffect const* aurEff);
|
||||||
|
|
||||||
|
operator bool() const { return spellInfo != nullptr; }
|
||||||
|
bool operator!() const { return !(bool(*this)); }
|
||||||
|
|
||||||
SpellInfo const* spellInfo;
|
SpellInfo const* spellInfo;
|
||||||
int8 effectIndex;
|
int8 effectIndex;
|
||||||
uint32 tickNumber;
|
uint32 tickNumber;
|
||||||
|
|||||||
Reference in New Issue
Block a user