mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Dispell code cleanup - GetDispelChance now really returns dispel chance and not resist chance.
--HG-- branch : trunk
This commit is contained in:
@@ -3876,7 +3876,7 @@ void Spell::EffectDispel(uint32 i)
|
||||
|
||||
bool success = false;
|
||||
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
|
||||
if (GetDispelChance(itr->first->GetCaster(), unitTarget, itr->first->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success) > 99)
|
||||
if (!GetDispelChance(itr->first->GetCaster(), unitTarget, itr->first->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success))
|
||||
{
|
||||
dispel_list.erase(itr);
|
||||
continue;
|
||||
@@ -7217,7 +7217,7 @@ void Spell::EffectDispelMechanic(uint32 i)
|
||||
continue;
|
||||
bool success = false;
|
||||
GetDispelChance(aura->GetCaster(), unitTarget, aura->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success);
|
||||
if((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1<<(mechanic))) && success)
|
||||
if ((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1 << mechanic)) && success)
|
||||
dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID()));
|
||||
}
|
||||
|
||||
@@ -7608,7 +7608,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
|
||||
|
||||
bool success = false;
|
||||
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
|
||||
if (GetDispelChance(itr->first->GetCaster(), unitTarget, itr->first->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success) > 99)
|
||||
if (!GetDispelChance(itr->first->GetCaster(), unitTarget, itr->first->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success))
|
||||
{
|
||||
steal_list.erase(itr);
|
||||
continue;
|
||||
|
||||
@@ -290,7 +290,7 @@ int32 GetSpellMaxDuration(SpellEntry const *spellInfo)
|
||||
return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]);
|
||||
}
|
||||
|
||||
int32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offensive, bool *result)
|
||||
uint32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offensive, bool *result)
|
||||
{
|
||||
// we assume that aura dispel chance is 100% on start
|
||||
// need formula for level difference based chance
|
||||
@@ -310,7 +310,9 @@ int32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offen
|
||||
if (result)
|
||||
*result = !roll_chance_i(resist_chance);
|
||||
|
||||
return resist_chance;
|
||||
resist_chance = resist_chance < 0 ? 0 : resist_chance;
|
||||
resist_chance = resist_chance > 100 ? 100 : resist_chance;
|
||||
return 100 - resist_chance;
|
||||
}
|
||||
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell * spell)
|
||||
|
||||
@@ -192,7 +192,7 @@ AuraState GetSpellAuraState(SpellEntry const * spellInfo);
|
||||
inline float GetSpellRadiusForHostile(SpellRadiusEntry const *radius) { return (radius ? radius->radiusHostile : 0); }
|
||||
inline float GetSpellRadiusForFriend(SpellRadiusEntry const *radius) { return (radius ? radius->radiusFriend : 0); }
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell * spell = NULL);
|
||||
int32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offensive, bool *result);
|
||||
uint32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offensive, bool *result);
|
||||
inline float GetSpellMinRangeForHostile(SpellRangeEntry const *range) { return (range ? range->minRangeHostile : 0); }
|
||||
inline float GetSpellMaxRangeForHostile(SpellRangeEntry const *range) { return (range ? range->maxRangeHostile : 0); }
|
||||
inline float GetSpellMinRangeForFriend(SpellRangeEntry const *range) { return (range ? range->minRangeFriend : 0); }
|
||||
|
||||
Reference in New Issue
Block a user