Skip to content

Commit

Permalink
Fix custom triggered spells rolling hit chance 2x
Browse files Browse the repository at this point in the history
Fixes execute
  • Loading branch information
killerwife authored and Warlockbugs committed Oct 10, 2016
1 parent 6e327f0 commit e9cfc93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/Spell.cpp
Expand Up @@ -388,6 +388,8 @@ Spell::Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid or

m_needAliveTargetMask = 0;

m_ignoreHitResult = false;

// determine reflection
m_canReflect = false;

Expand Down Expand Up @@ -852,7 +854,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
target.processed = false; // Effects not applied on target

// Calculate hit result
target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
target.missCondition = m_ignoreHitResult ? SPELL_MISS_NONE : m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);

// spell fly from visual cast object
WorldObject* affectiveObject = GetAffectiveCasterObject();
Expand Down
1 change: 1 addition & 0 deletions src/game/Spell.h
Expand Up @@ -440,6 +440,7 @@ class Spell
uint8 m_cast_count;
uint32 m_glyphIndex;
SpellCastTargets m_targets;
bool m_ignoreHitResult;

int32 GetCastTime() const { return m_casttime; }
uint32 GetCastedTime() { return m_timer; }
Expand Down
2 changes: 2 additions & 0 deletions src/game/Unit.cpp
Expand Up @@ -1267,6 +1267,8 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const* spellInfo, int32 cons
if (bp2)
spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2;

spell->m_ignoreHitResult = true;

SpellCastTargets targets;
targets.setUnitTarget(Victim);
spell->m_CastItem = castItem;
Expand Down

2 comments on commit e9cfc93

@boxa
Copy link
Contributor

@boxa boxa commented on e9cfc93 Oct 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@killerwife
bug after this commit:
priest's Mind Flay (spell 15407) trigger spell 58381 (CastCustomSpell) and hit! mage's Ice Block (spell 45438)

SpellHitResult() not called, so immunity not checked here:
target.missCondition = m_ignoreHitResult ? SPELL_MISS_NONE : m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);

may be affected some other spells also, where spell cast through CastCustomSpell

@killerwife
Copy link
Contributor Author

@killerwife killerwife commented on e9cfc93 Oct 27, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.