Show
Ignore:
Timestamp:
11/19/08 13:50:41 (17 years ago)
Author:
yumileroy
Message:

*Update aura stacking check. By QAston.
*Update pet autocast check. By qubix.

Original author: megamage
Date: 2008-11-17 17:59:33-06:00

Files:
1 modified

Legend:

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

    r248 r250  
    38983898        if(!is_triggered_by_spell) 
    38993899        { 
    3900             SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId); 
    3901  
    3902             bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec); 
    3903  
    3904             if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) 
    3905             { 
    3906                 // cannot remove higher rank 
    3907                 if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) 
    3908                     if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) 
     3900            bool isFromSameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); 
     3901            if( spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, isFromSameCaster) ) 
     3902            { 
     3903                //some spells should be not removed by lower rank of them 
     3904                if (!isFromSameCaster 
     3905                    &&(spellProto->Effect[effIndex]==SPELL_AURA_MOD_INCREASE_ENERGY) 
     3906                    &&(spellProto->DurationIndex==21) 
     3907                    &&(spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) 
     3908                    &&(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)) 
    39093909                        return false; 
    39103910 
    3911                 // Its a parent aura (create this aura in ApplyModifier) 
     3911                //Its a parent aura (create this aura in ApplyModifier) 
    39123912                if ((*i).second->IsInUse()) 
    39133913                { 
     
    39213921                else 
    39223922                    next =  m_Auras.begin(); 
    3923             } 
    3924             else if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) 
    3925             { 
    3926                 // Its a parent aura (create this aura in ApplyModifier) 
    3927                 if ((*i).second->IsInUse()) 
    3928                 { 
    3929                     sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); 
    3930                     continue; 
    3931                 } 
    3932                 RemoveAurasDueToSpell(i_spellId); 
    3933  
    3934                 if( m_Auras.empty() ) 
    3935                     break; 
    3936                 else 
    3937                     next =  m_Auras.begin(); 
    3938             } 
    3939             // Potions stack aura by aura (elixirs/flask already checked) 
    3940             else if( spellProto->SpellFamilyName == SPELLFAMILY_POTION && i_spellProto->SpellFamilyName == SPELLFAMILY_POTION ) 
    3941             { 
    3942                 if (IsNoStackAuraDueToAura(spellId, effIndex, i_spellId, i_effIndex)) 
    3943                 { 
    3944                     if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) 
    3945                         return false;                       // cannot remove higher rank 
    3946  
    3947                     // Its a parent aura (create this aura in ApplyModifier) 
    3948                     if ((*i).second->IsInUse()) 
    3949                     { 
    3950                         sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); 
    3951                         continue; 
    3952                     } 
    3953                     RemoveAura(i); 
    3954                     next = i; 
    3955                 } 
    39563923            } 
    39573924        }