aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/SpellAuras.cpp15
-rw-r--r--src/game/SpellAuras.h2
-rw-r--r--src/game/SpellEffects.cpp25
-rw-r--r--src/game/Unit.cpp22
-rw-r--r--src/game/Unit.h1
5 files changed, 54 insertions, 11 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index e0e9befbb77..219fa7dcb47 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -5066,6 +5066,21 @@ void Aura::HandleShapeshiftBoosts(bool apply)
m_target->SetHealth(uint32(ceil((double)m_target->GetMaxHealth() * healthPercentage)));*/
}
+bool Aura::GetDispelChance(Spell* spell)
+{
+ // we assume that aura dispel chance is 100% on start
+ // need formula for level difference based chance
+ int32 miss_chance = 100;
+ // Apply dispel mod from aura caster
+ if (Unit *caster = GetCaster())
+ {
+ if ( Player* modOwner = caster->GetSpellModOwner() )
+ modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, spell);
+ }
+ // Try dispel
+ return roll_chance_i(miss_chance);
+}
+
void Aura::HandleAuraEmpathy(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_UNIT)
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 602772f3491..14a473ec2f2 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -312,6 +312,8 @@ class TRINITY_DLL_SPEC Aura
void HandleAuraAllowOnlyAbility(bool apply, bool Real);
void HandleShapeshiftBoosts(bool apply);
+ bool GetDispelChance(Spell* spell);
+
// Allow Apply Aura Handler to modify and access m_AuraDRGroup
void setDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; }
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index fa33d76571f..967b3407326 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3434,18 +3434,10 @@ void Spell::EffectDispel(uint32 i)
SpellEntry const* spellInfo = aur->GetSpellProto();
// Base dispel chance
// TODO: possible chance depend from spell level??
- int32 miss_chance = 0;
- // Apply dispel mod from aura caster
- if (Unit *caster = aur->GetCaster())
- {
- if ( Player* modOwner = caster->GetSpellModOwner() )
- modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, this);
- }
- // Try dispel
- if (roll_chance_i(miss_chance))
- fail_list.push_back(aur->GetId());
- else
+ if (aur->GetDispelChance(this))
success_list.push_back(std::pair<uint32,uint64>(aur->GetId(),aur->GetCasterGUID()));
+ else
+ fail_list.push_back(aur->GetId());
// Remove buff from list for prevent doubles
for (std::vector<Aura *>::iterator j = dispel_list.begin(); j != dispel_list.end(); )
{
@@ -4774,6 +4766,15 @@ void Spell::EffectScriptEffect(uint32 effIndex)
unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE);
break;
}
+ // Escape artist
+ case 20589:
+ {
+ if(!unitTarget)
+ return;
+ // It is said that removing effects by script should include dispel resist mods
+ unitTarget->RemoveSpellsCausingAuraWithDispel(SPELL_AURA_MOD_ROOT, this);
+ unitTarget->RemoveSpellsCausingAuraWithDispel(SPELL_AURA_MOD_DECREASE_SPEED, this);
+ }
// Mirren's Drinking Hat
case 29830:
{
@@ -6205,6 +6206,8 @@ void Spell::EffectDispelMechanic(uint32 i)
next = iter;
++next;
SpellEntry const *spell = sSpellStore.LookupEntry(iter->second->GetSpellProto()->Id);
+ if (!iter->second->GetDispelChance(this))
+ continue;
if(spell->Mechanic == mechanic || spell->EffectMechanic[iter->second->GetEffIndex()] == mechanic)
{
unitTarget->RemoveAurasDueToSpell(spell->Id);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index bbb7ffb9fb4..d0bd170b931 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -476,6 +476,28 @@ void Unit::RemoveSpellsCausingAura(AuraType auraType)
}
}
+void Unit::RemoveSpellsCausingAuraWithDispel(AuraType auraType, Spell * spell)
+{
+ if (auraType >= TOTAL_AURAS) return;
+ AuraList::iterator iter, next;
+ for (iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next)
+ {
+ next = iter;
+ ++next;
+
+ if (*iter)
+ {
+ if (!(*iter)->GetDispelChance(spell))
+ continue;
+ RemoveAurasDueToSpell((*iter)->GetId());
+ if (!m_modAuras[auraType].empty())
+ next = m_modAuras[auraType].begin();
+ else
+ return;
+ }
+ }
+}
+
void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
{
if(!(m_interruptMask & flag))
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 7bc2f5b53b3..449df62109e 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1234,6 +1234,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveNotOwnSingleTargetAuras();
void RemoveSpellsCausingAura(AuraType auraType);
+ void RemoveSpellsCausingAuraWithDispel(AuraType auraType, Spell * spell);
void RemoveRankAurasDueToSpell(uint32 spellId);
bool RemoveNoStackAurasDueToAura(Aura *Aur);
void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0);