mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
*Handle breaking on damage auras by procflags - original patch by thenecromancer
*Implement Glyph of Fear - by thenecromancer --HG-- branch : trunk
This commit is contained in:
@@ -577,29 +577,6 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
|
||||
void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
|
||||
{
|
||||
// The chance to dispel 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;
|
||||
|
||||
std::queue < std::pair < uint32, uint64 > > remove_list;
|
||||
|
||||
for (AuraList::iterator iter = m_ccAuras.begin(); iter != m_ccAuras.end();++iter)
|
||||
{
|
||||
if((!spell || (*iter)->GetId() != spell) && roll_chance_f(chance))
|
||||
{
|
||||
remove_list.push(std::make_pair((*iter)->GetId(), (*iter)->GetCasterGUID() ) );
|
||||
}
|
||||
}
|
||||
|
||||
for(;remove_list.size();remove_list.pop())
|
||||
{
|
||||
RemoveAura(remove_list.front().first, remove_list.front().second, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
||||
{
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
@@ -646,7 +623,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
{
|
||||
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
|
||||
pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TAKE_DAMAGE, spellProto ? spellProto->Id : 0);
|
||||
pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0);
|
||||
}
|
||||
|
||||
if(!damage)
|
||||
@@ -3879,11 +3855,6 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects)
|
||||
m_interruptableAuras.push_back(Aur);
|
||||
AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
|
||||
}
|
||||
if((aurSpellInfo->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
|
||||
&& !Aur->IsAuraType(SPELL_AURA_MOD_POSSESS))) //only dummy aura is breakable
|
||||
{
|
||||
m_ccAuras.push_back(Aur);
|
||||
}
|
||||
|
||||
if (handleEffects)
|
||||
Aur->HandleEffects(true);
|
||||
@@ -4198,12 +4169,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
||||
UpdateInterruptMask();
|
||||
}
|
||||
|
||||
if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
|
||||
&& !Aur->IsAuraType(SPELL_AURA_MOD_POSSESS))) //only dummy aura is breakable
|
||||
{
|
||||
m_ccAuras.remove(Aur);
|
||||
}
|
||||
|
||||
Aur->SetRemoveMode(mode);
|
||||
|
||||
sLog.outDebug("Aura %u now is remove mode %d", Aur->GetId(), mode);
|
||||
@@ -12809,25 +12774,26 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||
if (procSpell)
|
||||
takeCharges=true;
|
||||
break;
|
||||
// These auras may not have charges - that means they have chance to remove based on dmg
|
||||
// CC Auras which use their amount amount to drop
|
||||
// Are there any more auras which need this?
|
||||
case SPELL_AURA_MOD_CONFUSE:
|
||||
case SPELL_AURA_MOD_FEAR:
|
||||
case SPELL_AURA_MOD_STUN:
|
||||
case SPELL_AURA_MOD_ROOT:
|
||||
if (!useCharges && isVictim && damage && !i->spellProcEvent)
|
||||
if (isVictim && damage)
|
||||
{
|
||||
// The chance to dispel 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))
|
||||
int32 damageLeft = triggeredByAura->GetAmount();
|
||||
// No damage left
|
||||
if (damageLeft < damage )
|
||||
RemoveAura(i->aura);
|
||||
else
|
||||
triggeredByAura->SetAmount(damageLeft-damage);
|
||||
}
|
||||
else
|
||||
takeCharges=true;
|
||||
break;
|
||||
/*case SPELL_AURA_ADD_FLAT_MODIFIER:
|
||||
case SPELL_AURA_ADD_PCT_MODIFIER:
|
||||
//case SPELL_AURA_ADD_FLAT_MODIFIER:
|
||||
//case SPELL_AURA_ADD_PCT_MODIFIER:
|
||||
// HandleSpellModAuraProc
|
||||
break;*/
|
||||
//break;
|
||||
default:
|
||||
// nothing do, just charges counter
|
||||
takeCharges=true;
|
||||
|
||||
Reference in New Issue
Block a user