diff options
author | Lopin <davca.hr@seznam.cz> | 2011-06-17 12:00:11 +0200 |
---|---|---|
committer | Lopin <davca.hr@seznam.cz> | 2011-06-17 12:00:11 +0200 |
commit | 0d2c8f7a9669ae100aacd762034e32a74e267abb (patch) | |
tree | 7a97fc33687b0430291659334092b5777d74cbce /src | |
parent | 235e164ba76fa9143112ef29ffa6861979a6effe (diff) |
Core/Spells: Conservator's Grip is now marked as a debuff, Fists of Stone as a buff. Also small coding-style change around
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Spells/SpellMgr.cpp | 80 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellMgr.h | 6 |
2 files changed, 48 insertions, 38 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 656e5ac9ab5..ab8a805d4e8 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -510,7 +510,7 @@ AuraState GetSpellAuraState(SpellEntry const* spellInfo) SpellSpecific GetSpellSpecific(SpellEntry const* spellInfo) { - switch(spellInfo->SpellFamilyName) + switch (spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { @@ -519,9 +519,9 @@ SpellSpecific GetSpellSpecific(SpellEntry const* spellInfo) { bool food = false; bool drink = false; - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - switch(spellInfo->EffectApplyAuraName[i]) + switch (spellInfo->EffectApplyAuraName[i]) { // Food case SPELL_AURA_MOD_REGEN: @@ -655,11 +655,11 @@ SpellSpecific GetSpellSpecific(SpellEntry const* spellInfo) break; } - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA) { - switch(spellInfo->EffectApplyAuraName[i]) + switch (spellInfo->EffectApplyAuraName[i]) { case SPELL_AURA_MOD_CHARM: case SPELL_AURA_MOD_POSSESS_PET: @@ -682,7 +682,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const* spellInfo) // target not allow have more one spell specific from same caster bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1, SpellSpecific spellSpec2) { - switch(spellSpec1) + switch (spellSpec1) { case SPELL_SPECIFIC_SEAL: case SPELL_SPECIFIC_HAND: @@ -700,7 +700,7 @@ bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1, SpellSpecific bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1, SpellSpecific spellSpec2) { - switch(spellSpec1) + switch (spellSpec1) { case SPELL_SPECIFIC_PHASE: case SPELL_SPECIFIC_TRACKER: @@ -733,7 +733,7 @@ bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1, SpellSpecific bool IsPositiveTarget(uint32 targetA, uint32 targetB) { // non-positive targets - switch(targetA) + switch (targetA) { case TARGET_UNIT_NEARBY_ENEMY: case TARGET_UNIT_TARGET_ENEMY: @@ -754,8 +754,9 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB) bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) const { - SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); - if (!spellproto) return false; + SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId); + if (!spellproto) + return false; // not found a single positive spell with this attribute if (spellproto->Attributes & SPELL_ATTR0_NEGATIVE_1) @@ -769,8 +770,10 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con case 34700: // Allergic Reaction case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura + case 62532: // Conservator's Grip return false; case 30877: // Tag Murloc + case 62344: // Fists of Stone return true; default: break; @@ -817,19 +820,20 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con } // Special case: effects which determine positivity of whole spell - for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (spellproto->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH) return true; } - switch(spellproto->Effect[effIndex]) + switch (spellproto->Effect[effIndex]) { case SPELL_EFFECT_DUMMY: // some explicitly required dummy effect sets - switch(spellId) + switch (spellId) { - case 28441: return false; // AB Effect 000 + case 28441: + return false; // AB Effect 000 default: break; } @@ -846,7 +850,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con case SPELL_EFFECT_APPLY_AURA: case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: { - switch(spellproto->EffectApplyAuraName[effIndex]) + switch (spellproto->EffectApplyAuraName[effIndex]) { case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative) case SPELL_AURA_MOD_STAT: @@ -874,12 +878,12 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con if (!deep) { uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex]; - SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId); + SpellEntry const* spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId); if (spellTriggeredProto) { // non-positive targets of main spell return early - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (!spellTriggeredProto->Effect[i]) continue; @@ -925,7 +929,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con case SPELL_AURA_MECHANIC_IMMUNITY: { // non-positive immunities - switch(spellproto->EffectMiscValue[effIndex]) + switch (spellproto->EffectMiscValue[effIndex]) { case MECHANIC_BANDAGE: case MECHANIC_SHIELD: @@ -935,12 +939,13 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con default: break; } - } break; + break; + } case SPELL_AURA_ADD_FLAT_MODIFIER: // mods case SPELL_AURA_ADD_PCT_MODIFIER: { // non-positive mods - switch(spellproto->EffectMiscValue[effIndex]) + switch (spellproto->EffectMiscValue[effIndex]) { case SPELLMOD_COST: // dependent from bas point sign (negative -> positive) if (SpellMgr::CalculateSpellEffectAmount(spellproto, effIndex) > 0) @@ -948,7 +953,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con if (!deep) { bool negative = true; - for (uint8 i=0; i<MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (i != effIndex) if (_isPositiveEffect(spellId, i, true)) @@ -965,7 +970,8 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con default: break; } - } break; + break; + } default: break; } @@ -1004,35 +1010,39 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) { if (!sSpellStore.LookupEntry(spellId)) return false; - switch(effIndex) + switch (effIndex) { default: - case 0: return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF0); - case 1: return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF1); - case 2: return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF2); + case 0: + return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF0); + case 1: + return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF1); + case 2: + return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF2); } } bool SpellMgr::_isPositiveSpell(uint32 spellId, bool deep) const { - SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); - if (!spellproto) return false; + SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId); + if (!spellproto) + return false; // spells with at least one negative effect are considered negative // some self-applied spells have negative effects but in self casting case negative check ignored. - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (!_isPositiveEffect(spellId, i, deep)) return false; return true; } -bool IsSingleTargetSpell(SpellEntry const *spellInfo) +bool IsSingleTargetSpell(SpellEntry const* spellInfo) { // all other single target spells have if it has AttributesEx5 if (spellInfo->AttributesEx5 & SPELL_ATTR5_SINGLE_TARGET_SPELL) return true; - switch(GetSpellSpecific(spellInfo)) + switch (GetSpellSpecific(spellInfo)) { case SPELL_SPECIFIC_JUDGEMENT: return true; @@ -1043,7 +1053,7 @@ bool IsSingleTargetSpell(SpellEntry const *spellInfo) return false; } -bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2) +bool IsSingleTargetSpells(SpellEntry const* spellInfo1, SpellEntry const* spellInfo2) { // TODO - need better check // Equal icon and spellfamily @@ -1054,7 +1064,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI // TODO - need found Judgements rule SpellSpecific spec1 = GetSpellSpecific(spellInfo1); // spell with single target specific types - switch(spec1) + switch (spec1) { case SPELL_SPECIFIC_JUDGEMENT: case SPELL_SPECIFIC_MAGE_POLYMORPH: @@ -1068,7 +1078,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI return false; } -SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form) +SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 form) { // talents that learn spells can have stance requirements that need ignore // (this requirement only for client-side stance show in talent description) @@ -1085,7 +1095,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 return SPELL_CAST_OK; bool actAsShifted = false; - SpellShapeshiftEntry const *shapeInfo = NULL; + SpellShapeshiftEntry const* shapeInfo = NULL; if (form > 0) { shapeInfo = sSpellShapeshiftStore.LookupEntry(form); diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 82aac7ebe14..b5a43868de7 100755 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -337,8 +337,8 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB); bool CanSpellDispelAura(SpellEntry const* dispelSpell, SpellEntry const* aura); bool CanSpellPierceImmuneAura(SpellEntry const* pierceSpell, SpellEntry const* aura); -bool IsSingleTargetSpell(SpellEntry const *spellInfo); -bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2); +bool IsSingleTargetSpell(SpellEntry const* spellInfo); +bool IsSingleTargetSpells(SpellEntry const* spellInfo1, SpellEntry const* spellInfo2); extern bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS]; extern SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS]; @@ -482,7 +482,7 @@ inline bool IsRangedWeaponSpell(SpellEntry const* spellInfo) || (spellInfo->EquippedItemSubClassMask & ITEM_SUBCLASS_MASK_WEAPON_RANGED); } -SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form); +SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 form); inline bool IsChanneledSpell(SpellEntry const* spellInfo) { |