[svn] Add SPELL_ATTR_BREAKABLE_BY_DAMAGE. Remove part of the hacked breakable aura check. Patch provided by thenecromancer.
--HG-- branch : trunk
This commit is contained in:
@@ -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
|
||||
|
||||
+10
-21
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user