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 9, 2023
1 parent d2988ed commit 8671cec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,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_spellEvent(nullptr), m_spellLog(this), m_param1(0), m_param2(0), m_trueCaster(caster)
{
MANGOS_ASSERT(caster != nullptr && info != nullptr);
Expand Down Expand Up @@ -6069,7 +6070,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 @@ -6083,8 +6084,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
5 changes: 4 additions & 1 deletion src/game/Spells/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,8 @@ class Spell
void SetDamage(uint32 newDamage) { damage = newDamage; }
SpellSchoolMask GetSchoolMask() { return m_spellSchoolMask; }
void SetGuaranteedCrit() { m_guaranteedCrit = true; }
// OnInit use only
void SetEffectSkipMask(uint32 mask) { m_effectSkipMask = mask; }
// OnHit use only
uint32 GetTotalTargetDamage() { return m_damage; }
uint32 GetTotalTargetAbsorb() { return m_absorb; }
Expand Down Expand Up @@ -891,7 +893,7 @@ class Spell
WorldObject* GetTrueCaster() const { return m_trueCaster; }
Unit* GetAffectiveCasterOrOwner() const;

//Custom Spell Cast Results
// custom Spell Cast Results
void SetParam1(uint32 param1) { m_param1 = param1; }
void SetParam2(uint32 param2) { m_param2 = param2; }

Expand Down Expand Up @@ -1052,6 +1054,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 8671cec

Please sign in to comment.