diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 60c2b6e8f0f..94736e31f12 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -448,19 +448,6 @@ bool Unit::HasAuraType(AuraType auraType) const return (!m_modAuras[auraType].empty()); } -/* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */ -void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage) -{ - if(!HasAuraType(auraType)) - return; - - // The chance to dispell an aura depends on the damage taken with respect to the casters level. - uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50; - float chance = float(damage) / max_dmg * 100.0f; - if (roll_chance_f(chance)) - RemoveSpellsCausingAura(auraType); -} - uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss) { if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) @@ -485,9 +472,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - if(pVictim != this) - RemoveSpellsCausingAura(SPELL_AURA_MOD_INVISIBILITY); - if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) pVictim->SetStandState(PLAYER_STATE_NONE); } @@ -505,11 +489,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa return 0; } - pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage); - // root type spells do not dispell the root effect - if(!spellProto || spellProto->Mechanic != MECHANIC_ROOT) - pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage); - if(pVictim->GetTypeId() != TYPEID_PLAYER) { // no xp,health if type 8 /critters/ @@ -891,6 +870,16 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa next = vAuras.begin(); } } + else if ( (se->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) && (!spellProto || se->Id != spellProto->Id) ) + { + uint32 max_dmg = pVictim->getLevel() > 8 ? 25 * pVictim->getLevel() - 150 : 50; + float chance = float(damage) / max_dmg * 100.0f; + if (roll_chance_f(chance)) + { + pVictim->RemoveAurasDueToSpell(i->second->GetId()); + next = vAuras.begin(); + } + } } if (damagetype != NODAMAGE && damage && pVictim->GetTypeId() == TYPEID_PLAYER) |