[9403] Replace number with enum name where explicitly used in array/other checks

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-17 19:06:09 +01:00
parent 5c05280c44
commit 7c555add76
14 changed files with 128 additions and 128 deletions

View file

@ -1128,13 +1128,13 @@ void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster);
if(bp0)
spell->m_currentBasePoints[0] = *bp0-int32(spellInfo->EffectBaseDice[0]);
spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0-int32(spellInfo->EffectBaseDice[EFFECT_INDEX_0]);
if(bp1)
spell->m_currentBasePoints[1] = *bp1-int32(spellInfo->EffectBaseDice[1]);
spell->m_currentBasePoints[EFFECT_INDEX_1] = *bp1-int32(spellInfo->EffectBaseDice[EFFECT_INDEX_1]);
if(bp2)
spell->m_currentBasePoints[2] = *bp2-int32(spellInfo->EffectBaseDice[2]);
spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2-int32(spellInfo->EffectBaseDice[EFFECT_INDEX_2]);
SpellCastTargets targets;
targets.setUnitTarget( Victim );
@ -1873,7 +1873,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if (itr_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && itr_spellProto->SpellIconID == 501)
{
// chance stored in next dummy effect
chance = itr_spellProto->CalculateSimpleValue(1);
chance = itr_spellProto->CalculateSimpleValue(EFFECT_INDEX_1);
break;
}
}
@ -1956,8 +1956,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
spellProto->Id == 60218) // Essence of Gossamer
{
// Max absorb stored in 1 dummy effect
if (spellProto->EffectBasePoints[1] < currentAbsorb)
currentAbsorb = spellProto->EffectBasePoints[1];
if (spellProto->EffectBasePoints[EFFECT_INDEX_1] < currentAbsorb)
currentAbsorb = spellProto->EffectBasePoints[EFFECT_INDEX_1];
break;
}
break;
@ -2002,7 +2002,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if (spellProto->SpellFamilyFlags & UI64LIT(00000001) && spellProto->Mechanic == MECHANIC_SHIELD)
{
// Glyph of Power Word: Shield
if (Aura *glyph = pVictim->GetAura(55672,0))
if (Aura *glyph = pVictim->GetAura(55672, EFFECT_INDEX_0))
{
int32 heal = int32(glyph->GetModifier()->m_amount *
(RemainingDamage >= currentAbsorb ? currentAbsorb : RemainingDamage) / 100);
@ -2190,7 +2190,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
int32 amount = int32(full_absorb * (*itr)->GetModifier()->m_amount / 100);
// apply normalized part of already accumulated amount in aura
if (Aura* spdAura = pVictim->GetAura(44413,0))
if (Aura* spdAura = pVictim->GetAura(44413, EFFECT_INDEX_0))
amount += spdAura->GetModifier()->m_amount * spdAura->GetAuraDuration() / spdAura->GetAuraMaxDuration();
// limit 5 health percents
@ -5424,7 +5424,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!roll_chance_i(triggerAmount))
return false;
Aura *aur = GetAura(71905, 0);
Aura *aur = GetAura(71905, EFFECT_INDEX_0);
if (aur && uint32(aur->GetStackAmount() + 1) >= aur->GetSpellProto()->StackAmount)
{
RemoveAurasDueToSpell(71905);
@ -5491,9 +5491,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Hot Streak
if (dummySpell->SpellIconID == 2999)
{
if (effIndex!=0)
if (effIndex != EFFECT_INDEX_0)
return true;
Aura *counter = GetAura(triggeredByAura->GetId(), 1);
Aura *counter = GetAura(triggeredByAura->GetId(), EFFECT_INDEX_1);
if (!counter)
return true;
@ -5804,7 +5804,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!procSpell)
return false;
Aura* healingAura = pVictim->GetAura(procSpell->Id,0);
Aura* healingAura = pVictim->GetAura(procSpell->Id, EFFECT_INDEX_0);
if (!healingAura)
return false;
@ -5819,7 +5819,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!procSpell)
return false;
Aura* leachAura = pVictim->GetAura(procSpell->Id,0);
Aura* leachAura = pVictim->GetAura(procSpell->Id, EFFECT_INDEX_0);
if (!leachAura)
return false;
@ -5926,7 +5926,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{
if (SpellEntry const* manaCastEntry = sSpellStore.LookupEntry(60889))
{
int32 mana_percent = manaCastEntry->CalculateSimpleValue(0) * heal_percent;
int32 mana_percent = manaCastEntry->CalculateSimpleValue(EFFECT_INDEX_0) * heal_percent;
CastCustomSpell(this, manaCastEntry, &mana_percent, NULL, NULL, true, castItem, triggeredByAura);
}
}
@ -6012,7 +6012,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!procSpell)
return false;
// Only 0 aura can proc
if (effIndex!=0)
if (effIndex != EFFECT_INDEX_0)
return true;
// Wrath crit
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000001))
@ -6178,7 +6178,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case SPELLFAMILY_PALADIN:
{
// Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage)
if ((dummySpell->SpellFamilyFlags & UI64LIT(0x000000008000000)) && effIndex==0)
if ((dummySpell->SpellFamilyFlags & UI64LIT(0x000000008000000)) && effIndex == EFFECT_INDEX_0)
{
triggered_spell_id = 25742;
float ap = GetTotalAttackPowerValue(BASE_ATTACK);
@ -6297,7 +6297,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Seal of Vengeance (damage calc on apply aura)
case 31801:
{
if(effIndex != 0) // effect 1,2 used by seal unleashing code
if (effIndex != EFFECT_INDEX_0) // effect 1,2 used by seal unleashing code
return false;
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
@ -6399,7 +6399,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Seal of Corruption (damage calc on apply aura)
case 53736:
{
if(effIndex != 0) // effect 1,2 used by seal unleashing code
if (effIndex != EFFECT_INDEX_0) // effect 1,2 used by seal unleashing code
return false;
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
@ -6456,7 +6456,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!triggeredEntry)
return false;
basepoints0 = int32(damage / (GetSpellDuration(triggeredEntry) / triggeredEntry->EffectAmplitude[0]));
basepoints0 = int32(damage / (GetSpellDuration(triggeredEntry) / triggeredEntry->EffectAmplitude[EFFECT_INDEX_0]));
target = this;
break;
}
@ -6553,7 +6553,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return false;
}
int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[1], pVictim);
int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[EFFECT_INDEX_1], pVictim);
// Off-Hand case
if ( castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND )
@ -6848,7 +6848,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (dummySpell->Id == 49028)
{
// 1 dummy aura for dismiss rune blade
if (effIndex!=2)
if (effIndex != EFFECT_INDEX_2)
return false;
// TODO: wite script for this "fights on its own, doing the same attacks"
// NOTE: Trigger here on every attack and spell cast
@ -7130,7 +7130,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
// 27526; - drain mana if possible
case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
// Pct value stored in dummy
basepoints[0] = pVictim->GetCreateHealth() * auraSpellInfo->EffectBasePoints[1] / 100;
basepoints[0] = pVictim->GetCreateHealth() * auraSpellInfo->EffectBasePoints[EFFECT_INDEX_1] / 100;
target = pVictim;
break;
//case 45205: break; // Copy Offhand Weapon
@ -7321,7 +7321,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
else if (auraSpellInfo->Id == 63156 || auraSpellInfo->Id == 63158)
{
// Looking for dummy effect
Aura *aur = GetAura(auraSpellInfo->Id, 1);
Aura *aur = GetAura(auraSpellInfo->Id, EFFECT_INDEX_1);
if (!aur)
return false;
@ -7470,7 +7470,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
}
// percent stored in effect 1 (class scripts) base points
int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints[0] = cost*auraSpellInfo->CalculateSimpleValue(1)/100;
basepoints[0] = cost*auraSpellInfo->CalculateSimpleValue(EFFECT_INDEX_1)/100;
trigger_spell_id = 20272;
target = this;
}
@ -7699,7 +7699,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
// This spell doesn't stack, but refreshes duration. So we receive current bonuses to minus them later.
int32 curBonus = 0;
if (Aura* aur = owner->GetAura(48090,0))
if (Aura* aur = owner->GetAura(48090, EFFECT_INDEX_0))
curBonus = aur->GetModifier()->m_amount;
int32 spellDamage = owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_MAGIC) - curBonus;
if(spellDamage <= 0)
@ -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[0], this);
int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 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();
@ -9579,7 +9579,7 @@ int32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32
{
TakenTotalMod *= 1.2f; // base bonus at HoTs
if (Aura* glyph = GetAura(62971,0)) // Glyph of Nourish
if (Aura* glyph = GetAura(62971, EFFECT_INDEX_0))// Glyph of Nourish
TakenTotalMod *= (glyph->GetModifier()->m_amount * ownHotCount + 100.0f) / 100.0f;
}
}
@ -9953,8 +9953,8 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
case 6428:
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
{
Aura* eff0 = GetAura((*i)->GetId(), 0);
if (!eff0 || (*i)->GetEffIndex() != 1)
Aura* eff0 = GetAura((*i)->GetId(), EFFECT_INDEX_0);
if (!eff0 || (*i)->GetEffIndex() != EFFECT_INDEX_1)
{
sLog.outError("Spell structure of DD (%u) changed.",(*i)->GetId());
continue;