[9408] Add MAX_EFFECT_INDEX to enum SpellEffectIndex and use it.

This commit is contained in:
VladimirMangos 2010-02-18 23:32:26 +03:00
parent 2a5ce2198c
commit ff8d494ed4
18 changed files with 114 additions and 112 deletions

View file

@ -2744,7 +2744,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
// Chance resist mechanic (select max value from every mechanic spell effect)
int32 resist_mech = 0;
// Get effects mechanic and chance
for(int eff = 0; eff < 3; ++eff)
for(int eff = 0; eff < MAX_EFFECT_INDEX; ++eff)
{
int32 effect_mech = GetEffectMechanic(spell, eff);
if (effect_mech)
@ -2887,7 +2887,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
// Chance resist mechanic (select max value from every mechanic spell effect)
int32 resist_mech = 0;
// Get effects mechanic and chance
for(int eff = 0; eff < 3; ++eff)
for(int eff = 0; eff < MAX_EFFECT_INDEX; ++eff)
{
int32 effect_mech = GetEffectMechanic(spell, eff);
if (effect_mech)
@ -3962,12 +3962,12 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
bool is_triggered_by_spell = false;
// prevent triggering aura of removing aura that triggered it
for(int j = 0; j < 3; ++j)
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
if (i_spellProto->EffectTriggerSpell[j] == spellId)
is_triggered_by_spell = true;
// prevent triggered aura of removing aura that triggering it (triggered effect early some aura of parent spell
for(int j = 0; j < 3; ++j)
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
if (spellProto->EffectTriggerSpell[j] == i_spellId)
is_triggered_by_spell = true;
@ -4301,13 +4301,13 @@ void Unit::RemoveSingleAuraByCasterSpell(uint32 spellId, uint32 effindex, uint64
void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except)
{
for (int i = 0; i < 3; ++i)
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
RemoveAura(spellId,i,except);
}
void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
{
for (int k=0; k < 3; ++k)
for (int k=0; k < MAX_EFFECT_INDEX; ++k)
{
spellEffectPair spair = spellEffectPair(spellId, k);
for (AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
@ -4547,7 +4547,7 @@ Aura* Unit::GetAura(AuraType type, uint32 family, uint64 familyFlag, uint32 fami
bool Unit::HasAura(uint32 spellId) const
{
for (int i = 0; i < 3 ; ++i)
for (int i = 0; i < MAX_EFFECT_INDEX ; ++i)
{
AuraMap::const_iterator iter = m_Auras.find(spellEffectPair(spellId, i));
if (iter != m_Auras.end())
@ -6553,7 +6553,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return false;
}
int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[EFFECT_INDEX_1], pVictim);
int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, EFFECT_INDEX_1, windfurySpellEntry->EffectBasePoints[EFFECT_INDEX_1], pVictim);
// Off-Hand case
if ( castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND )
@ -8829,7 +8829,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
// effect 1 m_amount
int32 maxPercent = (*i)->GetModifier()->m_amount;
// effect 0 m_amount
int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[EFFECT_INDEX_0], this);
int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), EFFECT_INDEX_0, (*i)->GetSpellProto()->EffectBasePoints[EFFECT_INDEX_0], this);
// count affliction effects and calc additional damage in percentage
int32 modPercent = 0;
AuraMap const& victimAuras = pVictim->GetAuras();
@ -9093,7 +9093,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
for(int j = 0; j < 3; ++j)
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{
if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
(spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA &&
@ -9536,7 +9536,7 @@ int32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32
uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
for(int j = 0; j < 3; ++j)
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{
if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH )