aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2008-10-22 14:58:50 -0500
committermegamage <none@none>2008-10-22 14:58:50 -0500
commit9584faf0c9788b428c2fbdad945d2ac3caf8b875 (patch)
treeb2717fedc313d8b90df0f9f8df351927db831a31 /src
parent4b384751bebeceb5a65518ff4b5ee3c4394f872c (diff)
[svn] Add SPELL_ATTR_BREAKABLE_BY_DAMAGE. Remove part of the hacked breakable aura check. Patch provided by thenecromancer.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/Unit.cpp31
-rw-r--r--src/game/Unit.h2
3 files changed, 11 insertions, 24 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 643a3f85e9b..0a9a31940ff 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -228,7 +228,7 @@ enum ItemQualities
#define SPELL_ATTR_CASTABLE_WHILE_SITTING 0x08000000 // 27 castable while sitting
#define SPELL_ATTR_CANT_USED_IN_COMBAT 0x10000000 // 28 Cannot be used in combat
#define SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY 0x20000000 // 29 unaffected by invulnerability (hmm possible not...)
-#define SPELL_ATTR_UNK30 0x40000000 // 30 breakable by damage?
+#define SPELL_ATTR_BREAKABLE_BY_DAMAGE 0x40000000 // 30 breakable by damage?
#define SPELL_ATTR_CANT_CANCEL 0x80000000 // 31 positive aura can't be canceled
#define SPELL_ATTR_EX_UNK0 0x00000001 // 0
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)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 9c33b5a6c3f..aa843e6213d 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -913,8 +913,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool isFrozen() const;
- void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage);
-
bool isTargetableForAttack() const;
virtual bool IsInWater() const;
virtual bool IsUnderWater() const;