aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Utilities/Util.cpp5
-rw-r--r--src/common/Utilities/Util.h1
-rw-r--r--src/server/game/Spells/Spell.cpp8
-rw-r--r--src/server/game/Spells/SpellInfo.cpp2
-rw-r--r--src/server/game/Spells/SpellInfo.h2
-rw-r--r--src/server/game/Spells/SpellMgr.cpp8
6 files changed, 20 insertions, 6 deletions
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp
index 315f8290c84..6b0f164c528 100644
--- a/src/common/Utilities/Util.cpp
+++ b/src/common/Utilities/Util.cpp
@@ -573,3 +573,8 @@ bool StringToBool(std::string const& str)
std::transform(str.begin(), str.end(), lowerStr.begin(), [](char c) { return char(::tolower(c)); });
return lowerStr == "1" || lowerStr == "true" || lowerStr == "yes";
}
+
+float DegToRad(float degrees)
+{
+ return degrees * (2.f * float(M_PI) / 360.f);
+}
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index cd17946a40b..eac0611f913 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -302,6 +302,7 @@ TC_COMMON_API std::string ByteArrayToHexStr(uint8 const* bytes, uint32 length, b
TC_COMMON_API void HexStrToByteArray(std::string const& str, uint8* out, bool reverse = false);
TC_COMMON_API bool StringToBool(std::string const& str);
+TC_COMMON_API float DegToRad(float degrees);
template<class Container>
std::string StringJoin(Container const& c, std::string delimiter)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 8686c53b156..37cc368c4d8 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1159,13 +1159,13 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
SpellEffectInfo const* effect = GetEffect(effIndex);
if (!effect)
return;
+
ConditionContainer* condList = effect->ImplicitTargetConditions;
- float coneAngle = float(M_PI) / 2;
float radius = effect->CalcRadius(m_caster) * m_spellValue->RadiusMod;
if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList))
{
- Trinity::WorldObjectSpellConeTargetCheck check(coneAngle, radius, m_caster, m_spellInfo, selectionType, condList);
+ Trinity::WorldObjectSpellConeTargetCheck check(DegToRad(m_spellInfo->ConeAngle), radius, m_caster, m_spellInfo, selectionType, condList);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> searcher(m_caster, targets, check, containerTypeMask);
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> >(searcher, containerTypeMask, m_caster, m_caster, radius);
@@ -7724,7 +7724,9 @@ bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target)
else
{
if (!_caster->IsWithinBoundaryRadius(target->ToUnit()))
- if (!_caster->isInFront(target, _coneAngle))
+ // ConeAngle > 0 -> select targets in front
+ // ConeAngle < 0 -> select targets in back
+ if (_caster->HasInArc(_coneAngle, target) != G3D::fuzzyGe(_coneAngle, 0.f))
return false;
}
return WorldObjectSpellAreaTargetCheck::operator ()(target);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index c99c74278e6..eef7465872f 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1132,6 +1132,8 @@ SpellInfo::SpellInfo(SpellInfoLoadHelper const& data, SpellEffectEntryMap const&
// SpellTargetRestrictionsEntry
SpellTargetRestrictionsEntry const* _target = data.TargetRestrictions;
+ ConeAngle = _target ? _target->ConeAngle : 0.f;
+ Width = _target ? _target->Width : 0.f;
Targets = _target ? _target->Targets : 0;
TargetCreatureType = _target ? _target->TargetCreatureType : 0;
MaxAffectedTargets = _target ? _target->MaxAffectedTargets : 0;
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 818b7d5e901..3404099e6f2 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -395,6 +395,8 @@ public:
uint32 IconFileDataId;
uint32 ActiveIconFileDataId;
LocalizedString const* SpellName;
+ float ConeAngle;
+ float Width;
uint32 MaxTargetLevel;
uint32 MaxAffectedTargets;
uint32 SpellFamilyName;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index f59fba52187..e75582b81cb 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -30,6 +30,7 @@
#include "SharedDefines.h"
#include "SpellAuraDefines.h"
#include "SpellInfo.h"
+#include <G3D/g3dmath.h>
PetFamilySpellsStore sPetFamilySpellsStore;
@@ -2887,9 +2888,6 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
if (!spellInfo->_IsPositiveEffect(EFFECT_2, false))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF2;
- if (spellInfo->GetSpellVisual() == 3879)
- spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_BACK;
-
if (talentSpells.count(spellInfo->Id))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_IS_TALENT;
@@ -3857,6 +3855,10 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Speed = SPEED_CHARGE;
break;
}
+
+ if (effect->TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE || effect->TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE)
+ if (G3D::fuzzyEq(spellInfo->ConeAngle, 0.f))
+ spellInfo->ConeAngle = 90.f;
}
if (spellInfo->ActiveIconFileDataId == 135754) // flight