*Some cleanup.
--HG-- branch : trunk
This commit is contained in:
+11
-17
@@ -576,7 +576,7 @@ void Unit::RemoveAurasWithFamily(uint32 family, uint32 familyFlag1, uint32 famil
|
||||
|
||||
void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode, uint32 except)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
|
||||
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); =)
|
||||
{
|
||||
if (!except || iter->second->GetId() != except)
|
||||
{
|
||||
@@ -1198,7 +1198,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
||||
critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
|
||||
|
||||
if (critPctDamageMod != 0)
|
||||
damage = int32((damage) * float((100.0f + critPctDamageMod)/100.0f));
|
||||
damage = int32(damage * float((100.0f + critPctDamageMod)/100.0f));
|
||||
|
||||
// Resilience - reduce crit damage
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -1304,7 +1304,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
||||
|
||||
if (!pVictim)
|
||||
return;
|
||||
if(!this->isAlive() || !pVictim->isAlive())
|
||||
if (!isAlive() || !pVictim->isAlive())
|
||||
return;
|
||||
|
||||
// Select HitInfo/procAttacker/procVictim flag based on attack type
|
||||
@@ -1471,7 +1471,6 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1489,7 +1488,6 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
||||
}
|
||||
if (damageInfo->resist)
|
||||
damageInfo->HitInfo |= HITINFO_RESIST;
|
||||
|
||||
}
|
||||
else // Impossible get negative result but....
|
||||
damageInfo->damage = 0;
|
||||
@@ -1497,7 +1495,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
||||
|
||||
void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
||||
{
|
||||
if (damageInfo==0) return;
|
||||
if (!damageInfo)
|
||||
return;
|
||||
Unit *pVictim = damageInfo->target;
|
||||
|
||||
if(!pVictim)
|
||||
@@ -9161,16 +9160,10 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
|
||||
AuraEffectList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
{
|
||||
if(((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto)) &&
|
||||
(*i)->GetSpellProto()->EquippedItemClass == -1 &&
|
||||
// -1 == any item class (not wand then)
|
||||
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 )
|
||||
// 0 == any inventory type (not wand then)
|
||||
{
|
||||
(*i)->GetSpellProto()->EquippedItemClass == -1 && // -1 == any item class (not wand)
|
||||
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0) // 0 == any inventory type (not wand)
|
||||
DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
|
||||
// Add flat bonus from spell damage versus
|
||||
@@ -9182,7 +9175,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
Unit *owner = GetOwner();
|
||||
if (!owner) owner = this;
|
||||
if (!owner)
|
||||
owner = this;
|
||||
AuraEffectList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
|
||||
{
|
||||
@@ -10331,7 +10325,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
|
||||
bool normalized = false;
|
||||
if(spellProto)
|
||||
{
|
||||
for (uint8 i = 0; i<MAX_SPELL_EFFECTS; i++)
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (spellProto->Effect[i] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
|
||||
{
|
||||
@@ -10465,7 +10459,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
|
||||
tmpDamage = (tmpDamage + TakenFlatBenefit)*TakenTotalMod;
|
||||
|
||||
// bonus result can be negative
|
||||
*pdamage = tmpDamage > 0 ? uint32(tmpDamage) : 0;
|
||||
*pdamage = uint32(std::max(tmpDamage, 0.0f));
|
||||
}
|
||||
|
||||
void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
|
||||
|
||||
Reference in New Issue
Block a user