Merge commit 'origin/master' into 320

Conflicts:
	src/game/WorldSession.cpp
This commit is contained in:
tomrus88 2009-08-30 15:52:20 +04:00
commit 9c8a0d615e
13 changed files with 162 additions and 22 deletions

View file

@ -1261,6 +1261,30 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
return false;
}
void Aura::ReapplyAffectedPassiveAuras( Unit* target )
{
std::set<uint32> affectedPassives;
for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr)
{
// permanent passive
if (itr->second->IsPassive() && itr->second->IsPermanent() &&
// non deleted and not same aura (any with same spell id)
!itr->second->IsDeleted() && itr->second->GetId() != GetId() &&
// only applied by self and affected by aura
itr->second->GetCasterGUID() == target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto()))
{
affectedPassives.insert(itr->second->GetId());
}
}
for(std::set<uint32>::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr)
{
target->RemoveAurasDueToSpell(*set_itr);
target->CastSpell(m_target, *set_itr, true);
}
}
/*********************************************************/
/*** BASIC AURA FUNCTION ***/
/*********************************************************/
@ -1317,19 +1341,17 @@ void Aura::HandleAddModifier(bool apply, bool Real)
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
// reaplly talents to own passive persistent auras
std::set<uint32> affectedPassives;
// reapply talents to own passive persistent auras
ReapplyAffectedPassiveAuras(m_target);
for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().begin(); itr != m_target->GetAuras().end(); ++itr)
if (itr->second->IsPassive() && itr->second->IsPermanent() &&
itr->second->GetCasterGUID() == m_target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto()))
affectedPassives.insert(itr->second->GetId());
// re-aplly talents and passives applied to pet (it affected by player spellmods)
if(Pet* pet = m_target->GetPet())
ReapplyAffectedPassiveAuras(pet);
for(std::set<uint32>::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr)
{
m_target->RemoveAurasDueToSpell(*set_itr);
m_target->CastSpell(m_target, *set_itr, true);
}
for(int i = 0; i < MAX_TOTEM; ++i)
if(m_target->m_TotemSlot[i])
if(Creature* totem = m_target->GetMap()->GetCreature(m_target->m_TotemSlot[i]))
ReapplyAffectedPassiveAuras(totem);
}
void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/)
{
@ -5701,7 +5723,13 @@ void Aura::HandleSpellSpecificBoosts(bool apply)
}
// Aspect of the Dragonhawk dodge
else if (GetSpellProto()->SpellFamilyFlags2 & 0x00001000)
{
spellId1 = 61848;
// triggered spell have same category as main spell and cooldown
if (apply && m_target->GetTypeId()==TYPEID_PLAYER)
((Player*)m_target)->RemoveSpellCooldown(61848);
}
else
return;
break;