mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Spells: Include more than first 2 spell effects when determining if a spell is negative
This commit is contained in:
@@ -1567,21 +1567,12 @@ bool SpellInfo::CanBeUsedInCombat() const
|
||||
|
||||
bool SpellInfo::IsPositive() const
|
||||
{
|
||||
return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE);
|
||||
return NegativeEffects.none();
|
||||
}
|
||||
|
||||
bool SpellInfo::IsPositiveEffect(uint8 effIndex) const
|
||||
{
|
||||
switch (effIndex)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE_EFF0);
|
||||
case 1:
|
||||
return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE_EFF1);
|
||||
case 2:
|
||||
return !HasAttribute(SPELL_ATTR0_CU_NEGATIVE_EFF2);
|
||||
}
|
||||
return !NegativeEffects.test(effIndex);
|
||||
}
|
||||
|
||||
bool SpellInfo::IsChanneled() const
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "Util.h"
|
||||
#include "Object.h"
|
||||
#include "SpellAuraDefines.h"
|
||||
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include <bitset>
|
||||
|
||||
class Unit;
|
||||
class Player;
|
||||
@@ -193,9 +193,9 @@ enum SpellCustomAttributes
|
||||
SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
|
||||
SPELL_ATTR0_CU_CHARGE = 0x00000200,
|
||||
SPELL_ATTR0_CU_PICKPOCKET = 0x00000400,
|
||||
SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00001000,
|
||||
SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00002000,
|
||||
SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00004000,
|
||||
SPELL_ATTR0_CU_DEPRECATED_NEGATIVE_EFF0 = 0x00001000, // DO NOT REUSE
|
||||
SPELL_ATTR0_CU_DEPRECATED_NEGATIVE_EFF1 = 0x00002000, // DO NOT REUSE
|
||||
SPELL_ATTR0_CU_DEPRECATED_NEGATIVE_EFF2 = 0x00004000, // DO NOT REUSE
|
||||
SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00008000,
|
||||
SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000,
|
||||
SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000,
|
||||
@@ -205,8 +205,6 @@ enum SpellCustomAttributes
|
||||
SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC = 0x00200000,
|
||||
SPELL_ATTR0_CU_LIQUID_AURA = 0x00400000,
|
||||
SPELL_ATTR0_CU_IS_TALENT = 0x00800000,
|
||||
|
||||
SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2
|
||||
};
|
||||
|
||||
enum SpellInterruptFlags : uint32
|
||||
@@ -459,6 +457,7 @@ class TC_GAME_API SpellInfo
|
||||
uint32 AttributesEx12;
|
||||
uint32 AttributesEx13;
|
||||
uint32 AttributesCu;
|
||||
std::bitset<MAX_SPELL_EFFECTS> NegativeEffects;
|
||||
uint64 Stances;
|
||||
uint64 StancesNot;
|
||||
uint32 Targets;
|
||||
|
||||
@@ -2735,6 +2735,9 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!spellInfoMutable->_IsPositiveEffect(effect->EffectIndex, false))
|
||||
spellInfoMutable->NegativeEffects[effect->EffectIndex] = true;
|
||||
}
|
||||
|
||||
// spells ignoring hit result should not be binary
|
||||
@@ -2820,15 +2823,6 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
|
||||
spellInfoMutable->AttributesCu |= SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC;
|
||||
}
|
||||
|
||||
if (!spellInfoMutable->_IsPositiveEffect(EFFECT_0, false))
|
||||
spellInfoMutable->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0;
|
||||
|
||||
if (!spellInfoMutable->_IsPositiveEffect(EFFECT_1, false))
|
||||
spellInfoMutable->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF1;
|
||||
|
||||
if (!spellInfoMutable->_IsPositiveEffect(EFFECT_2, false))
|
||||
spellInfoMutable->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF2;
|
||||
|
||||
if (talentSpells.count(spellInfoMutable->Id))
|
||||
spellInfoMutable->AttributesCu |= SPELL_ATTR0_CU_IS_TALENT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user