Skip to content

Commit

Permalink
Spell: Implement m_effectSkipMask
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 21, 2023
1 parent 1194c3f commit aee6207
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ void SpellLog::SendToSet()

Spell::Spell(WorldObject* caster, SpellEntry const* info, uint32 triggeredFlags, ObjectGuid originalCasterGUID, SpellEntry const* triggeredBy) :
m_partialApplicationMask(0), m_spellScript(SpellScriptMgr::GetSpellScript(info->Id)), m_auraScript(SpellScriptMgr::GetAuraScript(info->Id)),
m_effectSkipMask(0),
m_spellLog(this), m_param1(0), m_param2(0), m_trueCaster(caster)
{
MANGOS_ASSERT(caster != nullptr && info != nullptr);
Expand Down Expand Up @@ -5043,7 +5044,7 @@ SpellCastResult Spell::CheckCast(bool strict)

uint32 availableEffectMask = 0;
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
if (m_spellInfo->Effect[i])
if (m_spellInfo->Effect[i] && (m_effectSkipMask & (1 << i)) == 0)
availableEffectMask |= (1 << i);

auto partialApplication = [&](uint32 i) -> SpellCastResult
Expand All @@ -5057,8 +5058,13 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_CAST_OK;
};

m_partialApplicationMask |= m_effectSkipMask;

for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if ((m_effectSkipMask & (1 << i)) != 0)
continue;

// for effects of spells that have only one target
switch (m_spellInfo->Effect[i])
{
Expand Down
6 changes: 6 additions & 0 deletions src/game/Spells/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,8 @@ class Spell
uint32 GetDamage() { return damage; }
void SetDamage(uint32 newDamage) { damage = newDamage; }
SpellSchoolMask GetSchoolMask() { return m_spellSchoolMask; }
// OnInit use only
void SetEffectSkipMask(uint32 mask) { m_effectSkipMask = mask; }
// OnHit use only
uint32 GetTotalTargetDamage() { return m_damage; }
void SetTotalTargetValueModifier(float modifier);
Expand All @@ -749,6 +751,9 @@ class Spell
WorldObject* GetTrueCaster() const { return m_trueCaster; }
Unit* GetAffectiveCasterOrOwner() const;

// custom Spell Cast Results
void SetParam1(uint32 param1) { m_param1 = param1; }
void SetParam2(uint32 param2) { m_param2 = param2; }
// overrides
void SetOverridenSpeed(float newSpeed);
void SetIgnoreRoot(bool state) { m_ignoreRoot = state; }
Expand Down Expand Up @@ -890,6 +895,7 @@ class Spell
SpellScript* m_spellScript;
AuraScript* m_auraScript; // needed for some checks for value calculation
int32 m_effectTriggerChance[MAX_EFFECT_INDEX]; // used by effects to roll if they should go off
uint32 m_effectSkipMask;

uint32 m_spellState;
uint32 m_timer;
Expand Down

0 comments on commit aee6207

Please sign in to comment.