*Fix dispel chance mod calculation.
*Fix Escape artist-by Lightguard. --HG-- branch : trunk
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
|
||||
+14
-11
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user