diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-05-02 20:06:00 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-05-02 20:06:00 +0200 |
commit | c77017edcf07959957a0072a493a214371d2724c (patch) | |
tree | a6b3e87f1bda0c46ca49a795c90a626579ed588b | |
parent | 2ff29ce1e8242958f9f4c89e351d27d32063c678 (diff) |
Core/Spells: Implemented SPELL_ATTR5_ALWAYS_LINE_OF_SIGHT and SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT
-rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 4 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 23796cfdc75..ea1e11fb744 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -614,8 +614,8 @@ enum SpellAttr5 : uint32 SPELL_ATTR5_NOT_ON_TRIVIAL = 0x00400000, /*NYI*/ // TITLE Not On Trivial SPELL_ATTR5_NO_PARTIAL_RESISTS = 0x00800000, /*NYI*/ // TITLE No Partial Resists SPELL_ATTR5_IGNORE_CASTER_REQUIREMENTS = 0x01000000, /*NYI*/ // TITLE Ignore Caster Requirements - SPELL_ATTR5_ALWAYS_LINE_OF_SIGHT = 0x02000000, /*NYI*/ // TITLE Always Line of Sight - SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT = 0x04000000, /*WRONG IMPL*/ // TITLE Always AOE Line of Sight DESCRIPTION Requires line of sight between caster and target in addition to between dest and target + SPELL_ATTR5_ALWAYS_LINE_OF_SIGHT = 0x02000000, // TITLE Always Line of Sight + SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT = 0x04000000, // TITLE Always AOE Line of Sight DESCRIPTION Requires line of sight between caster and target in addition to between dest and target SPELL_ATTR5_NO_CASTER_AURA_ICON = 0x08000000, // TITLE No Caster Aura Icon (client only) SPELL_ATTR5_NO_TARGET_AURA_ICON = 0x10000000, // TITLE No Target Aura Icon (client only) SPELL_ATTR5_AURA_UNIQUE_PER_CASTER = 0x20000000, /*NYI*/ // TITLE Aura Unique Per Caster diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index df1a5e3489b..d2022454a8f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5677,7 +5677,7 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 if (DynamicObject* dynObj = m_caster->ToUnit()->GetDynObject(m_triggeredByAuraSpell->Id)) losTarget = dynObj; - if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !m_spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !target->IsWithinLOSInMap(losTarget, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) + if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !target->IsWithinLOSInMap(losTarget, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) return SPELL_FAILED_LINE_OF_SIGHT; } } @@ -5689,7 +5689,7 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 float x, y, z; m_targets.GetDstPos()->GetPosition(x, y, z); - if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !m_spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOS(x, y, z, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) + if (!m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, nullptr, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOS(x, y, z, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) return SPELL_FAILED_LINE_OF_SIGHT; } @@ -7856,7 +7856,7 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEf return true; // if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour - if (IsTriggered() && m_triggeredByAuraSpell && (m_triggeredByAuraSpell->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) || DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_triggeredByAuraSpell->Id, nullptr, SPELL_DISABLE_LOS))) + if (!m_spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_LINE_OF_SIGHT) && IsTriggered() && m_triggeredByAuraSpell && (m_triggeredByAuraSpell->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) || DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_triggeredByAuraSpell->Id, nullptr, SPELL_DISABLE_LOS))) return true; /// @todo shit below shouldn't be here, but it's temporary @@ -7890,9 +7890,7 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEf } default: { - if (losPosition) - return target->IsWithinLOS(losPosition->GetPositionX(), losPosition->GetPositionY(), losPosition->GetPositionZ(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2); - else + if (!losPosition || m_spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT)) { // Get GO cast coordinates if original caster -> GO WorldObject* caster = nullptr; @@ -7903,6 +7901,10 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEf if (target != m_caster && !target->IsWithinLOSInMap(caster, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) return false; } + + if (losPosition) + if (!target->IsWithinLOS(losPosition->GetPositionX(), losPosition->GetPositionY(), losPosition->GetPositionZ(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)) + return false; } } |