Show
Ignore:
Timestamp:
11/22/08 00:36:22 (17 years ago)
Author:
yumileroy
Message:

Merged commit 269 (5f0e38da128a).

Original author: gvcoman
Date: 2008-11-21 14:34:05-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/SpellMgr.cpp

    r272 r279  
    100100} 
    101101 
    102 bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) 
     102/*bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) 
    103103{ 
    104104    SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); 
     
    114114 
    115115    return true; 
    116 } 
     116}*/ 
    117117 
    118118int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) 
     
    245245        case SPELL_CURSE: 
    246246        case SPELL_ASPECT: 
     247        case SPELL_POSITIVE_SHOUT: 
     248        case SPELL_JUDGEMENT: 
     249        case SPELL_WARLOCK_CORRUPTION: 
     250            return spellSpec1==spellSpec2; 
     251        default: 
     252            return false; 
     253    } 
     254} 
     255 
     256bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1,uint32 spellSpec2) 
     257{ 
     258    switch(spellSpec1) 
     259    { 
    247260        case SPELL_TRACKER: 
    248261        case SPELL_WARLOCK_ARMOR: 
     
    250263        case SPELL_ELEMENTAL_SHIELD: 
    251264        case SPELL_MAGE_POLYMORPH: 
    252         case SPELL_POSITIVE_SHOUT: 
    253         case SPELL_JUDGEMENT: 
    254         case SPELL_WARLOCK_CORRUPTION: 
    255265            return spellSpec1==spellSpec2; 
    256266        case SPELL_BATTLE_ELIXIR: 
     
    10311041} 
    10321042 
    1033 bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const 
    1034 { 
    1035     if(spellId_1 == spellId_2) // auras due to the same spell 
    1036         return false; 
     1043bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool sameCaster) const 
     1044{ 
     1045    //if(spellId_1 == spellId_2) // auras due to the same spell 
     1046    //    return false; 
    10371047 
    10381048    SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); 
     
    10421052        return false; 
    10431053 
     1054    SpellSpecific spellId_spec_1 = GetSpellSpecific(spellId_1); 
     1055    SpellSpecific spellId_spec_2 = GetSpellSpecific(spellId_2); 
     1056    if (spellId_spec_1 && spellId_spec_2) 
     1057        if (IsSingleFromSpellSpecificPerTarget(spellId_spec_1, spellId_spec_2) 
     1058            ||(IsSingleFromSpellSpecificPerCaster(spellId_spec_1, spellId_spec_2) && sameCaster)) 
     1059            return true; 
     1060 
    10441061    if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName) 
    10451062        return false; 
    10461063 
    1047     if(!spellInfo_1->SpellFamilyName) // generic spells 
     1064    // generic spells 
     1065    if(!spellInfo_1->SpellFamilyName) 
    10481066    { 
    10491067        if(!spellInfo_1->SpellIconID  
     
    10511069            return false; 
    10521070    } 
    1053     else if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) 
    1054         return false; 
     1071 
     1072    // if both elixirs are not battle/guardian/potions/flasks then always stack 
     1073    else if(spellInfo_1->SpellFamilyName == SPELLFAMILY_POTION) 
     1074    { 
     1075        if(spellId_spec_1 || spellId_spec_2) 
     1076            return false; 
     1077    } 
     1078 
     1079    // check for class spells 
     1080    else 
     1081    { 
     1082        if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) 
     1083            return false; 
     1084    } 
    10551085 
    10561086    for(uint32 i = 0; i < 3; ++i) 
     1087    { 
    10571088        if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i] 
    1058             || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) 
    1059             return false; 
     1089            || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i] 
     1090            || spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura 
     1091            return false; // need itemtype check? need an example to add that check 
     1092 
     1093        if(spellInfo_1->EffectApplyAuraName[i] // both spell has the same auras 
     1094            && !sameCaster 
     1095            && spellInfo_1->Effect[i] != SPELL_EFFECT_APPLY_AREA_AURA_PARTY) // not area auras (shaman totem) 
     1096            // a better check may be effect == SPELL_EFFECT_APPLY_AURA 
     1097        { 
     1098            switch(spellInfo_1->EffectApplyAuraName[i]) 
     1099            { 
     1100                // DOT or HOT from different casters will stack 
     1101                case SPELL_AURA_PERIODIC_DAMAGE: 
     1102                case SPELL_AURA_PERIODIC_HEAL: 
     1103                case SPELL_AURA_PERIODIC_TRIGGER_SPELL: 
     1104                case SPELL_AURA_PERIODIC_ENERGIZE: 
     1105                case SPELL_AURA_PERIODIC_MANA_LEECH: 
     1106                case SPELL_AURA_PERIODIC_LEECH: 
     1107                    return false; 
     1108                default: 
     1109                    break; 
     1110            } 
     1111        } 
     1112    } 
    10601113 
    10611114    return true;