From a2bc0ae02827bfc9ca6310022f532497ec2fdeab Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 13 Jun 2022 06:03:06 +0200 Subject: [PATCH] =?UTF-8?q?fix(Core/Objects):=20Include=20combat=20reach?= =?UTF-8?q?=20instead=20of=20object=20size=20in=20LoS=E2=80=A6=20(#12013)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... calculations. Fixed LoS calculations for dynamic objects. Modified combat reach of Deep Pool Threshfin. Fixes #11886 --- .../pending_db_world/rev_1654964701013345100.sql | 2 ++ src/server/game/Entities/Object/Object.cpp | 2 +- src/server/game/Spells/Auras/SpellAuras.cpp | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1654964701013345100.sql diff --git a/data/sql/updates/pending_db_world/rev_1654964701013345100.sql b/data/sql/updates/pending_db_world/rev_1654964701013345100.sql new file mode 100644 index 000000000..17dd3f7d9 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1654964701013345100.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_model_info` SET `CombatReach`=1.5 WHERE `DisplayID`=2836; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 023632c0f..f894f9355 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1234,7 +1234,7 @@ Position WorldObject::GetHitSpherePointFor(Position const& dest) const { G3D::Vector3 vThis(GetPositionX(), GetPositionY(), GetPositionZ() + GetCollisionHeight()); G3D::Vector3 vObj(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ()); - G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(this), GetObjectSize()); + G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(this), GetCombatReach()); return Position(contactPoint.x, contactPoint.y, contactPoint.z, GetAngle(contactPoint.x, contactPoint.y)); } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index d962deb72..e24899bf2 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2842,9 +2842,10 @@ void DynObjAura::FillTargetMap(std::map& targets, Unit* /*caster*/ { if (!HasEffect(effIndex)) continue; + + SpellInfo const* spellInfo = GetSpellInfo(); UnitList targetList; - if (GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_ALLY - || GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_UNIT_DEST_AREA_ALLY) + if (spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_ALLY || spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_UNIT_DEST_AREA_ALLY) { Acore::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius); Acore::UnitListSearcher searcher(GetDynobjOwner(), targetList, u_check); @@ -2852,7 +2853,7 @@ void DynObjAura::FillTargetMap(std::map& targets, Unit* /*caster*/ } // pussywizard: TARGET_DEST_DYNOBJ_NONE is supposed to search for both friendly and unfriendly targets, so for any unit // what about EffectImplicitTargetA? - else if (GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_NONE) + else if (spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_NONE) { Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius); Acore::UnitListSearcher searcher(GetDynobjOwner(), targetList, u_check); @@ -2867,12 +2868,11 @@ void DynObjAura::FillTargetMap(std::map& targets, Unit* /*caster*/ for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) { - // xinef: check z level and los dependence Unit* target = *itr; - float zLevel = GetDynobjOwner()->GetPositionZ(); - if (target->GetPositionZ() + 3.0f < zLevel || target->GetPositionZ() - 5.0f > zLevel) - if (!target->IsWithinLOSInMap(GetDynobjOwner())) - continue; + if (!spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) && !target->IsWithinLOSInMap(GetDynobjOwner())) + { + continue; + } std::map::iterator existing = targets.find(*itr); if (existing != targets.end())