[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

@ -1397,7 +1397,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
} }
bool bcontinue = true; bool bcontinue = true;
for(uint32 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) || if( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
(spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) || (spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
@ -1449,7 +1449,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
} }
bool bcontinue = true; bool bcontinue = true;
for(uint32 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) ) if( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) )
{ {

View file

@ -457,7 +457,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if(action.cast.castFlags & CAST_AURA_NOT_PRESENT) if(action.cast.castFlags & CAST_AURA_NOT_PRESENT)
{ {
for(uint8 i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
if(target->HasAura(action.cast.spellId, i)) if(target->HasAura(action.cast.spellId, i))
return; return;
} }

View file

@ -389,4 +389,6 @@ enum SpellEffectIndex
EFFECT_INDEX_2 = 2 EFFECT_INDEX_2 = 2
}; };
#define MAX_EFFECT_INDEX 3
#endif #endif

View file

@ -557,7 +557,7 @@ void LoadDBCStores(const std::string& dataPath)
std::set<uint32> spellPaths; std::set<uint32> spellPaths;
for(uint32 i = 1; i < sSpellStore.GetNumRows (); ++i) for(uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i)) if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for(int j=0; j < 3; ++j) for(int j=0; j < MAX_EFFECT_INDEX; ++j)
if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/) if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
spellPaths.insert(sInfo->EffectMiscValue[j]); spellPaths.insert(sInfo->EffectMiscValue[j]);

View file

@ -1394,28 +1394,28 @@ struct SpellEntry
int32 EquippedItemClass; // 68 m_equippedItemClass (value) int32 EquippedItemClass; // 68 m_equippedItemClass (value)
int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask) int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask)
int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask) int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask)
uint32 Effect[3]; // 71-73 m_effect uint32 Effect[MAX_EFFECT_INDEX]; // 71-73 m_effect
int32 EffectDieSides[3]; // 74-76 m_effectDieSides int32 EffectDieSides[MAX_EFFECT_INDEX]; // 74-76 m_effectDieSides
uint32 EffectBaseDice[3]; // 77-79 m_effectBaseDice uint32 EffectBaseDice[MAX_EFFECT_INDEX]; // 77-79 m_effectBaseDice
float EffectDicePerLevel[3]; // 80-82 m_effectDicePerLevel float EffectDicePerLevel[MAX_EFFECT_INDEX]; // 80-82 m_effectDicePerLevel
float EffectRealPointsPerLevel[3]; // 83-85 m_effectRealPointsPerLevel float EffectRealPointsPerLevel[MAX_EFFECT_INDEX]; // 83-85 m_effectRealPointsPerLevel
int32 EffectBasePoints[3]; // 86-88 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints) int32 EffectBasePoints[MAX_EFFECT_INDEX]; // 86-88 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints)
uint32 EffectMechanic[3]; // 89-91 m_effectMechanic uint32 EffectMechanic[MAX_EFFECT_INDEX]; // 89-91 m_effectMechanic
uint32 EffectImplicitTargetA[3]; // 92-94 m_implicitTargetA uint32 EffectImplicitTargetA[MAX_EFFECT_INDEX]; // 92-94 m_implicitTargetA
uint32 EffectImplicitTargetB[3]; // 95-97 m_implicitTargetB uint32 EffectImplicitTargetB[MAX_EFFECT_INDEX]; // 95-97 m_implicitTargetB
uint32 EffectRadiusIndex[3]; // 98-100 m_effectRadiusIndex - spellradius.dbc uint32 EffectRadiusIndex[MAX_EFFECT_INDEX]; // 98-100 m_effectRadiusIndex - spellradius.dbc
uint32 EffectApplyAuraName[3]; // 101-103 m_effectAura uint32 EffectApplyAuraName[MAX_EFFECT_INDEX]; // 101-103 m_effectAura
uint32 EffectAmplitude[3]; // 104-106 m_effectAuraPeriod uint32 EffectAmplitude[MAX_EFFECT_INDEX]; // 104-106 m_effectAuraPeriod
float EffectMultipleValue[3]; // 107-109 m_effectAmplitude float EffectMultipleValue[MAX_EFFECT_INDEX]; // 107-109 m_effectAmplitude
uint32 EffectChainTarget[3]; // 110-112 m_effectChainTargets uint32 EffectChainTarget[MAX_EFFECT_INDEX]; // 110-112 m_effectChainTargets
uint32 EffectItemType[3]; // 113-115 m_effectItemType uint32 EffectItemType[MAX_EFFECT_INDEX]; // 113-115 m_effectItemType
int32 EffectMiscValue[3]; // 116-118 m_effectMiscValue int32 EffectMiscValue[MAX_EFFECT_INDEX]; // 116-118 m_effectMiscValue
int32 EffectMiscValueB[3]; // 119-121 m_effectMiscValueB int32 EffectMiscValueB[MAX_EFFECT_INDEX]; // 119-121 m_effectMiscValueB
uint32 EffectTriggerSpell[3]; // 122-124 m_effectTriggerSpell uint32 EffectTriggerSpell[MAX_EFFECT_INDEX]; // 122-124 m_effectTriggerSpell
float EffectPointsPerComboPoint[3]; // 125-127 m_effectPointsPerCombo float EffectPointsPerComboPoint[MAX_EFFECT_INDEX]; // 125-127 m_effectPointsPerCombo
uint32 EffectSpellClassMaskA[3]; // 128-130 m_effectSpellClassMaskA uint32 EffectSpellClassMaskA[3]; // 128-130 m_effectSpellClassMaskA, effect 0
uint32 EffectSpellClassMaskB[3]; // 131-133 m_effectSpellClassMaskB uint32 EffectSpellClassMaskB[3]; // 131-133 m_effectSpellClassMaskB, effect 1
uint32 EffectSpellClassMaskC[3]; // 134-136 m_effectSpellClassMaskC uint32 EffectSpellClassMaskC[3]; // 134-136 m_effectSpellClassMaskC, effect 2
uint32 SpellVisual[2]; // 137-138 m_spellVisualID uint32 SpellVisual[2]; // 137-138 m_spellVisualID
uint32 SpellIconID; // 139 m_spellIconID uint32 SpellIconID; // 139 m_spellIconID
uint32 activeIconID; // 140 m_activeIconID uint32 activeIconID; // 140 m_activeIconID
@ -1439,7 +1439,7 @@ struct SpellEntry
uint32 DmgClass; // 219 m_defenseType uint32 DmgClass; // 219 m_defenseType
uint32 PreventionType; // 220 m_preventionType uint32 PreventionType; // 220 m_preventionType
//uint32 StanceBarOrder; // 221 m_stanceBarOrder not used //uint32 StanceBarOrder; // 221 m_stanceBarOrder not used
float DmgMultiplier[3]; // 222-224 m_effectChainAmplitude float DmgMultiplier[MAX_EFFECT_INDEX]; // 222-224 m_effectChainAmplitude
//uint32 MinFactionId; // 225 m_minFactionID not used //uint32 MinFactionId; // 225 m_minFactionID not used
//uint32 MinReputation; // 226 m_minReputation not used //uint32 MinReputation; // 226 m_minReputation not used
//uint32 RequiredAuraVision; // 227 m_requiredAuraVision not used //uint32 RequiredAuraVision; // 227 m_requiredAuraVision not used

View file

@ -3594,7 +3594,7 @@ bool ChatHandler::HandleAuraCommand(const char* args)
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID ); SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID );
if(spellInfo) if(spellInfo)
{ {
for(uint32 i = 0;i<3;++i) for(uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
uint8 eff = spellInfo->Effect[i]; uint8 eff = spellInfo->Effect[i];
if (eff>=TOTAL_SPELL_EFFECTS) if (eff>=TOTAL_SPELL_EFFECTS)

View file

@ -792,7 +792,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]); CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
cAura.spell_id = (uint32)val[2*j+0]; cAura.spell_id = (uint32)val[2*j+0];
cAura.effect_idx = (uint32)val[2*j+1]; cAura.effect_idx = (uint32)val[2*j+1];
if ( cAura.effect_idx > 2 ) if (cAura.effect_idx >= MAX_EFFECT_INDEX)
{ {
sLog.outErrorDb("Creature (%s: %u) has wrong effect %u for spell %u in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.effect_idx,cAura.spell_id,table); sLog.outErrorDb("Creature (%s: %u) has wrong effect %u for spell %u in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.effect_idx,cAura.spell_id,table);
continue; continue;
@ -816,7 +816,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
// fill terminator element (after last added) // fill terminator element (after last added)
CreatureDataAddonAura& endAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]); CreatureDataAddonAura& endAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
endAura.spell_id = 0; endAura.spell_id = 0;
endAura.effect_idx = 0; endAura.effect_idx = EFFECT_INDEX_0;
} }
void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment) void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
@ -2138,7 +2138,7 @@ void ObjectMgr::LoadItemRequiredTarget()
if (bounds.first != bounds.second) if (bounds.first != bounds.second)
break; break;
for (int j = 0; j < 3; ++j) for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if (pSpellInfo->EffectImplicitTargetA[j] == TARGET_CHAIN_DAMAGE || if (pSpellInfo->EffectImplicitTargetA[j] == TARGET_CHAIN_DAMAGE ||
pSpellInfo->EffectImplicitTargetB[j] == TARGET_CHAIN_DAMAGE || pSpellInfo->EffectImplicitTargetB[j] == TARGET_CHAIN_DAMAGE ||
@ -3648,7 +3648,7 @@ void ObjectMgr::LoadQuests()
if(!qinfo->ReqCreatureOrGOId[j]) if(!qinfo->ReqCreatureOrGOId[j])
{ {
bool found = false; bool found = false;
for(int k = 0; k < 3; ++k) for(int k = 0; k < MAX_EFFECT_INDEX; ++k)
{ {
if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) || if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) ||
spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT) spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT)
@ -3914,7 +3914,7 @@ void ObjectMgr::LoadQuests()
if(!spellInfo) if(!spellInfo)
continue; continue;
for(int j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if(spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE) if(spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
continue; continue;

View file

@ -1166,7 +1166,7 @@ void Pet::_LoadAuras(uint32 timediff)
continue; continue;
} }
if(effindex >= 3) if(effindex >= MAX_EFFECT_INDEX)
{ {
sLog.outError("Invalid effect index (spellid %u, effindex %u), ignore.",spellid,effindex); sLog.outError("Invalid effect index (spellid %u, effindex %u), ignore.",spellid,effindex);
continue; continue;
@ -1236,7 +1236,7 @@ void Pet::_SaveAuras()
{ {
// skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras. // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
uint8 i; uint8 i;
for (i = 0; i < 3; ++i) for (i = 0; i < MAX_EFFECT_INDEX; ++i)
if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH || if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET ) spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET )

View file

@ -184,7 +184,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
return; return;
} }
for(uint32 i = 0; i < 3;++i) for(int i = 0; i < MAX_EFFECT_INDEX;++i)
{ {
if(spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED) if(spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)
return; return;

View file

@ -3279,7 +3279,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo
RemoveAurasDueToSpell(spell_id); RemoveAurasDueToSpell(spell_id);
// remove pet auras // remove pet auras
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
if(PetAura const* petSpell = sSpellMgr.GetPetAura(spell_id, i)) if(PetAura const* petSpell = sSpellMgr.GetPetAura(spell_id, i))
RemovePetAura(petSpell); RemovePetAura(petSpell);
@ -4256,7 +4256,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{ {
int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE; int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE;
for(int i =0; i < 3; ++i) for(int i =0; i < MAX_EFFECT_INDEX; ++i)
{ {
if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,i)) if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,i))
{ {
@ -7078,7 +7078,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if(form_change) // check aura active state from other form if(form_change) // check aura active state from other form
{ {
bool found = false; bool found = false;
for (int k=0; k < 3; ++k) for (int k=0; k < MAX_EFFECT_INDEX; ++k)
{ {
spellEffectPair spair = spellEffectPair(spellInfo->Id, k); spellEffectPair spair = spellEffectPair(spellInfo->Id, k);
for (AuraMap::const_iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair); ++iter) for (AuraMap::const_iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair); ++iter)
@ -15305,7 +15305,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
remaincharges = 0; remaincharges = 0;
for(uint32 i=0; i<stackcount; ++i) for(uint32 i=0; i < stackcount; ++i)
{ {
Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL); Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL);
if(!damage) if(!damage)
@ -19125,7 +19125,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
// check learned spells state // check learned spells state
bool found = false; bool found = false;
for(int i=0; i < 3; ++i) for(int i=0; i < MAX_EFFECT_INDEX; ++i)
{ {
if(spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i])) if(spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i]))
{ {
@ -19240,7 +19240,7 @@ void Player::SendAurasForTarget(Unit *target)
Unit::VisibleAuraMap const *visibleAuras = target->GetVisibleAuras(); Unit::VisibleAuraMap const *visibleAuras = target->GetVisibleAuras();
for(Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr) for(Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
{ {
for(uint32 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if(Aura *aura = target->GetAura(itr->second, j)) if(Aura *aura = target->GetAura(itr->second, j))
{ {

View file

@ -375,7 +375,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
UpdateOriginalCasterPointer(); UpdateOriginalCasterPointer();
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
m_currentBasePoints[i] = m_spellInfo->EffectBasePoints[i]; m_currentBasePoints[i] = m_spellInfo->EffectBasePoints[i];
m_spellState = SPELL_STATE_NULL; m_spellState = SPELL_STATE_NULL;
@ -410,7 +410,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)) if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED))
{ {
for(int j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if (m_spellInfo->Effect[j] == 0) if (m_spellInfo->Effect[j] == 0)
continue; continue;
@ -467,7 +467,7 @@ void Spell::FillTargetMap()
{ {
// TODO: ADD the correct target FILLS!!!!!! // TODO: ADD the correct target FILLS!!!!!!
for(uint32 i = 0; i < 3; ++i) for(uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
// not call for empty effect. // not call for empty effect.
// Also some spells use not used effect targets for store targets for dummy effect in triggered spells // Also some spells use not used effect targets for store targets for dummy effect in triggered spells
@ -1159,7 +1159,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
// Apply additional spell effects to target // Apply additional spell effects to target
CastPreCastSpells(unit); CastPreCastSpells(unit);
for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) for(int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber)
{ {
if (effectMask & (1 << effectNumber)) if (effectMask & (1 << effectNumber))
{ {
@ -1192,7 +1192,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
if(!go) if(!go)
return; return;
for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) for(int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber)
if (effectMask & (1 << effectNumber)) if (effectMask & (1 << effectNumber))
HandleEffects(NULL, NULL, go, effectNumber); HandleEffects(NULL, NULL, go, effectNumber);
@ -1211,7 +1211,7 @@ void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
if(!target->item || !effectMask) if(!target->item || !effectMask)
return; return;
for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) for(int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber)
if (effectMask & (1 << effectNumber)) if (effectMask & (1 << effectNumber))
HandleEffects(NULL, target->item, NULL, effectNumber); HandleEffects(NULL, target->item, NULL, effectNumber);
} }
@ -1771,7 +1771,7 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
Unit* target = m_targets.getUnitTarget(); Unit* target = m_targets.getUnitTarget();
if(!target) if(!target)
target = m_caster; target = m_caster;
uint32 count = CalculateDamage(2,m_caster); // stored in dummy effect, affected by mods uint32 count = CalculateDamage(EFFECT_INDEX_2,m_caster); // stored in dummy effect, affected by mods
FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, target, radius, count, true, false, true); FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, target, radius, count, true, false, true);
} }
@ -2812,7 +2812,7 @@ void Spell::_handle_immediate_phase()
HandleThreatSpells(m_spellInfo->Id); HandleThreatSpells(m_spellInfo->Id);
m_needSpellLog = IsNeedSendToClient(); m_needSpellLog = IsNeedSendToClient();
for(uint32 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if(m_spellInfo->Effect[j] == 0) if(m_spellInfo->Effect[j] == 0)
continue; continue;
@ -2849,7 +2849,7 @@ void Spell::_handle_immediate_phase()
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
// process ground // process ground
for(uint32 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
// persistent area auras target only the ground // persistent area auras target only the ground
if(m_spellInfo->Effect[j] == SPELL_EFFECT_PERSISTENT_AREA_AURA) if(m_spellInfo->Effect[j] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
@ -4090,7 +4090,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// this case can be triggered if rank not found (too low-level target for first rank) // this case can be triggered if rank not found (too low-level target for first rank)
if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo->Id) && !m_CastItem) if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo->Id) && !m_CastItem)
{ {
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
// check only spell that apply positive auras // check only spell that apply positive auras
if (IsPositiveEffect(m_spellInfo->Id, i) && m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA && if (IsPositiveEffect(m_spellInfo->Id, i) && m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
@ -4135,7 +4135,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
// check pet presents // check pet presents
for(int j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_PET) if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_PET)
{ {
@ -4172,7 +4172,7 @@ SpellCastResult Spell::CheckCast(bool strict)
bool target_hostile_checked = false; bool target_hostile_checked = false;
bool target_friendly = false; bool target_friendly = false;
bool target_friendly_checked = false; bool target_friendly_checked = false;
for(int k = 0; k < 3; ++k) for(int k = 0; k < MAX_EFFECT_INDEX; ++k)
{ {
if (IsExplicitPositiveTarget(m_spellInfo->EffectImplicitTargetA[k])) if (IsExplicitPositiveTarget(m_spellInfo->EffectImplicitTargetA[k]))
{ {
@ -4289,7 +4289,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// Database based targets from spell_target_script // Database based targets from spell_target_script
if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example) if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
{ {
for(uint8 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
(m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) || (m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) ||
@ -4455,7 +4455,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return castResult; return castResult;
} }
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
// for effects of spells that have only one target // for effects of spells that have only one target
switch(m_spellInfo->Effect[i]) switch(m_spellInfo->Effect[i])
@ -4865,7 +4865,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
} }
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
switch(m_spellInfo->EffectApplyAuraName[i]) switch(m_spellInfo->EffectApplyAuraName[i])
{ {
@ -5042,7 +5042,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
target = m_targets.getUnitTarget(); target = m_targets.getUnitTarget();
bool need = false; bool need = false;
for(uint32 i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE ||
m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND ||
@ -5075,7 +5075,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
else else
{ {
bool duelvsplayertar = false; bool duelvsplayertar = false;
for(int j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
//TARGET_DUELVSPLAYER is positive AND negative //TARGET_DUELVSPLAYER is positive AND negative
duelvsplayertar |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER); duelvsplayertar |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER);
@ -5110,7 +5110,7 @@ SpellCastResult Spell::CheckCasterAuras() const
// We use bitmasks so the loop is done only once and not on every aura check below. // We use bitmasks so the loop is done only once and not on every aura check below.
if ( m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY ) if ( m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY )
{ {
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY) if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->EffectMiscValue[i]); school_immune |= uint32(m_spellInfo->EffectMiscValue[i]);
@ -5211,7 +5211,7 @@ bool Spell::CanAutoCast(Unit* target)
{ {
uint64 targetguid = target->GetGUID(); uint64 targetguid = target->GetGUID();
for(uint32 j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
{ {
@ -5447,7 +5447,7 @@ SpellCastResult Spell::CheckItems()
{ {
// such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example // such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
SpellCastResult failReason = SPELL_CAST_OK; SpellCastResult failReason = SPELL_CAST_OK;
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
// skip check, pet not required like checks, and for TARGET_PET m_targets.getUnitTarget() is not the real target but the caster // skip check, pet not required like checks, and for TARGET_PET m_targets.getUnitTarget() is not the real target but the caster
if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_PET) if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_PET)
@ -5610,7 +5610,7 @@ SpellCastResult Spell::CheckItems()
} }
// special checks for spell effects // special checks for spell effects
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
switch (m_spellInfo->Effect[i]) switch (m_spellInfo->Effect[i])
{ {
@ -5892,7 +5892,7 @@ void Spell::DelayedChannel()
Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit) if (unit)
{ {
for (int j = 0; j < 3; ++j) for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
if( ihit->effectMask & (1 << j) ) if( ihit->effectMask & (1 << j) )
unit->DelayAura(m_spellInfo->Id, j, delaytime); unit->DelayAura(m_spellInfo->Id, j, delaytime);
} }
@ -5900,7 +5900,7 @@ void Spell::DelayedChannel()
} }
} }
for(int j = 0; j < 3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
// partially interrupt persistent area auras // partially interrupt persistent area auras
DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id, j); DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id, j);

View file

@ -573,7 +573,7 @@ Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoi
uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff]; uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff];
if(SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId)) if(SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId))
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
if (triggeredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY) if (triggeredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY)
return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, target, caster, castItem); return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, target, caster, castItem);
@ -1117,7 +1117,7 @@ bool Aura::_RemoveAura()
bool lastaura = true; bool lastaura = true;
// find other aura in same slot (current already removed from list) // find other aura in same slot (current already removed from list)
for(uint8 i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i); Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i);
for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr) for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr)
@ -3135,7 +3135,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
if(itr->second->state == PLAYERSPELL_REMOVED) continue; if(itr->second->state == PLAYERSPELL_REMOVED) continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
Rage_val += m_target->CalculateSpellDamage(spellInfo, 0, spellInfo->EffectBasePoints[EFFECT_INDEX_0], m_target) * 10; Rage_val += m_target->CalculateSpellDamage(spellInfo, EFFECT_INDEX_0, spellInfo->EffectBasePoints[EFFECT_INDEX_0], m_target) * 10;
} }
} }
@ -7506,7 +7506,7 @@ void Aura::PeriodicDummyTick()
if (rage == 0) if (rage == 0)
return; return;
int32 mod = (rage < 100) ? rage : 100; int32 mod = (rage < 100) ? rage : 100;
int32 points = m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target); int32 points = m_target->CalculateSpellDamage(spell, EFFECT_INDEX_1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target);
int32 regen = m_target->GetMaxHealth() * (mod * points / 10) / 1000; int32 regen = m_target->GetMaxHealth() * (mod * points / 10) / 1000;
m_target->CastCustomSpell(m_target, 22845, &regen, NULL, NULL, true, NULL, this); m_target->CastCustomSpell(m_target, 22845, &regen, NULL, NULL, true, NULL, this);
m_target->SetPower(POWER_RAGE, rage-mod); m_target->SetPower(POWER_RAGE, rage-mod);
@ -7642,7 +7642,7 @@ void Aura::PeriodicDummyTick()
{ {
// Increases your attack power by $s1 for every $s2 armor value you have. // Increases your attack power by $s1 for every $s2 armor value you have.
// Calculate AP bonus (from 1 efect of this spell) // Calculate AP bonus (from 1 efect of this spell)
int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target); int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, EFFECT_INDEX_1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target);
m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, NULL, true, NULL, this); m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, NULL, true, NULL, this);
return; return;
} }

View file

@ -399,7 +399,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
// Shockwave ${$m3/100*$AP} // Shockwave ${$m3/100*$AP}
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000000)) else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000000))
{ {
int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget); int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, EFFECT_INDEX_2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget);
if (pct > 0) if (pct > 0)
damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100); damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100);
break; break;
@ -718,7 +718,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
{ {
// Add main hand dps * effect[2] amount // Add main hand dps * effect[2] amount
float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
int32 count = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget); int32 count = m_caster->CalculateSpellDamage(m_spellInfo, EFFECT_INDEX_2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget);
damage += count * int32(average * IN_MILISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); damage += count * int32(average * IN_MILISECONDS) / m_caster->GetAttackTime(BASE_ATTACK);
} }
// Shield of Righteousness // Shield of Righteousness
@ -1274,7 +1274,7 @@ void Spell::EffectDummy(uint32 i)
{ {
switch(i) switch(i)
{ {
case 0: case EFFECT_INDEX_0:
{ {
uint32 spellID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_0); uint32 spellID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_0);
uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1); uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1);
@ -1283,7 +1283,7 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastSpell(m_caster, spellID, true, NULL); m_caster->CastSpell(m_caster, spellID, true, NULL);
return; return;
} }
case 1: case EFFECT_INDEX_1:
return; // additional data for dummy[0] return; // additional data for dummy[0]
} }
return; return;
@ -4594,7 +4594,7 @@ void Spell::EffectWeaponDmg(uint32 i)
// multiple weapon dmg effect workaround // multiple weapon dmg effect workaround
// execute only the last weapon damage // execute only the last weapon damage
// and handle all effects at once // and handle all effects at once
for (uint32 j = 0; j < 3; ++j) for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
switch(m_spellInfo->Effect[j]) switch(m_spellInfo->Effect[j])
{ {
@ -4602,7 +4602,7 @@ void Spell::EffectWeaponDmg(uint32 i)
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
if (j < i) // we must calculate only at last weapon effect if (j < int(i)) // we must calculate only at last weapon effect
return; return;
break; break;
} }
@ -4640,7 +4640,7 @@ void Spell::EffectWeaponDmg(uint32 i)
} }
} }
if (stack) if (stack)
spell_bonus += stack * CalculateDamage(2, unitTarget); spell_bonus += stack * CalculateDamage(EFFECT_INDEX_2, unitTarget);
if (!stack || stack < spellInfo->StackAmount) if (!stack || stack < spellInfo->StackAmount)
// Devastate causing Sunder Armor Effect // Devastate causing Sunder Armor Effect
// and no need to cast over max stack amount // and no need to cast over max stack amount
@ -4745,7 +4745,7 @@ void Spell::EffectWeaponDmg(uint32 i)
if (count) if (count)
{ {
// Effect 1(for Blood-Caked Strike)/3(other) damage is bonus // Effect 1(for Blood-Caked Strike)/3(other) damage is bonus
float bonus = count * CalculateDamage(m_spellInfo->SpellIconID == 1736 ? 0 : 2, unitTarget) / 100.0f; float bonus = count * CalculateDamage(m_spellInfo->SpellIconID == 1736 ? EFFECT_INDEX_0 : EFFECT_INDEX_2, unitTarget) / 100.0f;
// Blood Strike, Blood-Caked Strike and Obliterate store bonus*2 // Blood Strike, Blood-Caked Strike and Obliterate store bonus*2
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0002000000400000) || if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0002000000400000) ||
m_spellInfo->SpellIconID == 1736) m_spellInfo->SpellIconID == 1736)
@ -4786,7 +4786,7 @@ void Spell::EffectWeaponDmg(uint32 i)
} }
int32 fixed_bonus = 0; int32 fixed_bonus = 0;
for (int j = 0; j < 3; ++j) for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
switch(m_spellInfo->Effect[j]) switch(m_spellInfo->Effect[j])
{ {

View file

@ -405,7 +405,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
{ {
// except own aura spells // except own aura spells
bool allow = false; bool allow = false;
for(int k = 0; k < 3; ++k) for(int k = 0; k < MAX_EFFECT_INDEX; ++k)
{ {
if (spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS || if (spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS ||
spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS_PET) spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS_PET)

View file

@ -104,7 +104,7 @@ uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo)
if(DotDuration > 30000) if(DotDuration > 30000)
DotDuration = 30000; DotDuration = 30000;
for (int j = 0; j < 3; ++j) for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
@ -198,7 +198,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
{ {
bool food = false; bool food = false;
bool drink = false; bool drink = false;
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
switch(spellInfo->EffectApplyAuraName[i]) switch(spellInfo->EffectApplyAuraName[i])
{ {
@ -550,7 +550,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
if(spellTriggeredProto) if(spellTriggeredProto)
{ {
// non-positive targets of main spell return early // non-positive targets of main spell return early
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
// if non-positive trigger cast targeted to positive target this main cast is non-positive // if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs // this will place this spell auras as debuffs
@ -685,7 +685,7 @@ bool IsPositiveSpell(uint32 spellId)
// spells with atleast one negative effect are considered negative // spells with atleast one negative effect are considered negative
// some self-applied spells have negative effects but in self casting case negative check ignored. // some self-applied spells have negative effects but in self casting case negative check ignored.
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
if (!IsPositiveEffect(spellId, i)) if (!IsPositiveEffect(spellId, i))
return false; return false;
return true; return true;
@ -831,7 +831,7 @@ void SpellMgr::LoadSpellTargetPositions()
} }
bool found = false; bool found = false;
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if( spellInfo->EffectImplicitTargetA[i]==TARGET_TABLE_X_Y_Z_COORDINATES || spellInfo->EffectImplicitTargetB[i]==TARGET_TABLE_X_Y_Z_COORDINATES ) if( spellInfo->EffectImplicitTargetA[i]==TARGET_TABLE_X_Y_Z_COORDINATES || spellInfo->EffectImplicitTargetB[i]==TARGET_TABLE_X_Y_Z_COORDINATES )
{ {
@ -1282,7 +1282,7 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
return false; return false;
// All stance spells. if any better way, change it. // All stance spells. if any better way, change it.
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
switch(spellInfo->SpellFamilyName) switch(spellInfo->SpellFamilyName)
{ {
@ -1758,7 +1758,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
spellInfo_1->SpellIconID != 0 && spellInfo_2->SpellIconID != 0) spellInfo_1->SpellIconID != 0 && spellInfo_2->SpellIconID != 0)
{ {
bool isModifier = false; bool isModifier = false;
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_FLAT_MODIFIER || if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_FLAT_MODIFIER ||
spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER || spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER ||
@ -1781,7 +1781,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return false; return false;
bool dummy_only = true; bool dummy_only = true;
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i] || if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i] ||
spellInfo_1->EffectItemType[i] != spellInfo_2->EffectItemType[i] || spellInfo_1->EffectItemType[i] != spellInfo_2->EffectItemType[i] ||
@ -2089,7 +2089,7 @@ void SpellMgr::LoadSpellLearnSkills()
if(!entry) if(!entry)
continue; continue;
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if(entry->Effect[i]==SPELL_EFFECT_SKILL) if(entry->Effect[i]==SPELL_EFFECT_SKILL)
{ {
@ -2178,7 +2178,7 @@ void SpellMgr::LoadSpellLearnSpells()
if (!entry) if (!entry)
continue; continue;
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if(entry->Effect[i]==SPELL_EFFECT_LEARN_SPELL) if(entry->Effect[i]==SPELL_EFFECT_LEARN_SPELL)
{ {
@ -2261,7 +2261,7 @@ void SpellMgr::LoadSpellScriptTarget()
} }
bool targetfound = false; bool targetfound = false;
for (int i = 0; i < 3; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if( spellProto->EffectImplicitTargetA[i] == TARGET_SCRIPT || if( spellProto->EffectImplicitTargetA[i] == TARGET_SCRIPT ||
spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT || spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT ||
@ -2565,7 +2565,7 @@ void SpellMgr::LoadPetDefaultSpells()
if(!spellEntry) if(!spellEntry)
continue; continue;
for(int k = 0; k < 3; ++k) for(int k = 0; k < MAX_EFFECT_INDEX; ++k)
{ {
if(spellEntry->Effect[k]==SPELL_EFFECT_SUMMON || spellEntry->Effect[k]==SPELL_EFFECT_SUMMON_PET) if(spellEntry->Effect[k]==SPELL_EFFECT_SUMMON || spellEntry->Effect[k]==SPELL_EFFECT_SUMMON_PET)
{ {

View file

@ -130,7 +130,7 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo);
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect) inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
{ {
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
if(SpellEffects(spellInfo->Effect[i])==effect) if(SpellEffects(spellInfo->Effect[i])==effect)
return true; return true;
return false; return false;
@ -138,7 +138,7 @@ inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura) inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura)
{ {
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
if(AuraType(spellInfo->EffectApplyAuraName[i])==aura) if(AuraType(spellInfo->EffectApplyAuraName[i])==aura)
return true; return true;
return false; return false;
@ -146,7 +146,7 @@ inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura)
inline bool IsSpellLastAuraEffect(SpellEntry const *spellInfo, int effecIdx) inline bool IsSpellLastAuraEffect(SpellEntry const *spellInfo, int effecIdx)
{ {
for(int i = effecIdx+1; i < 3; ++i) for(int i = effecIdx+1; i < MAX_EFFECT_INDEX; ++i)
if(spellInfo->EffectApplyAuraName[i]) if(spellInfo->EffectApplyAuraName[i])
return false; return false;
return true; return true;
@ -259,7 +259,7 @@ inline bool IsCasterSourceTarget(uint32 target)
inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo) inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
{ {
for(int i = 0; i < 3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
uint32 targetA = spellInfo->EffectImplicitTargetA[i]; uint32 targetA = spellInfo->EffectImplicitTargetA[i];
if(targetA && !IsCasterSourceTarget(targetA)) if(targetA && !IsCasterSourceTarget(targetA))
@ -401,7 +401,7 @@ inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo)
uint32 mask = 0; uint32 mask = 0;
if (spellInfo->Mechanic) if (spellInfo->Mechanic)
mask |= 1 << (spellInfo->Mechanic - 1); mask |= 1 << (spellInfo->Mechanic - 1);
for (int i=0; i< 3; ++i) for (int i=0; i< MAX_EFFECT_INDEX; ++i)
if (spellInfo->EffectMechanic[i]) if (spellInfo->EffectMechanic[i])
mask |= 1 << (spellInfo->EffectMechanic[i]-1); mask |= 1 << (spellInfo->EffectMechanic[i]-1);
return mask; return mask;

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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9407" #define REVISION_NR "9408"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__