mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Implemented ConeAngle from DB2
This commit is contained in:
2
sql/updates/world/master/2017_07_18_00_world.sql
Normal file
2
sql/updates/world/master/2017_07_18_00_world.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
UPDATE `spell_custom_attr` SET `attributes`=`attributes` & ~(2|4);
|
||||
DELETE FROM `spell_custom_attr` WHERE `attributes`=0;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -395,6 +395,8 @@ public:
|
||||
uint32 IconFileDataId;
|
||||
uint32 ActiveIconFileDataId;
|
||||
LocalizedString const* SpellName;
|
||||
float ConeAngle;
|
||||
float Width;
|
||||
uint32 MaxTargetLevel;
|
||||
uint32 MaxAffectedTargets;
|
||||
uint32 SpellFamilyName;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user