*Fix area auras

--HG--
branch : trunk
This commit is contained in:
QAston
2009-04-06 17:07:58 +02:00
parent dcd0b835aa
commit c6c084cc45
2 changed files with 16 additions and 15 deletions
+13 -12
View File
@@ -414,8 +414,8 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura
else else
m_partAuras[i]=CreateAuraEffect(this, i, NULL , caster); m_partAuras[i]=CreateAuraEffect(this, i, NULL , caster);
// correct flags if aura couldn't be created // correct flags if aura couldn't be created
if (!m_partAuras[i]) //if (!m_partAuras[i])
m_auraFlags &= (~(uint8(1) << i)); //m_auraFlags &= (~(uint8(1) << i));
} }
else else
{ {
@@ -748,7 +748,7 @@ void AreaAuraEffect::Update(uint32 diff)
for(std::list<Unit *>::iterator tIter = targets.begin(); tIter != targets.end(); tIter++) for(std::list<Unit *>::iterator tIter = targets.begin(); tIter != targets.end(); tIter++)
{ {
if((*tIter)->HasAuraEffect(GetId(), GetEffIndex(), GetCasterGUID())) if((*tIter)->HasAuraEffect(GetId(), GetEffIndex(), caster->GetGUID()))
continue; continue;
if(SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter)->getLevel())) if(SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter)->getLevel()))
@@ -788,7 +788,7 @@ void AreaAuraEffect::Update(uint32 diff)
caster->IsFriendlyTo(tmp_target) != needFriendly caster->IsFriendlyTo(tmp_target) != needFriendly
) )
{ {
tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
else if (!caster->IsWithinDistInMap(tmp_target, m_radius)) else if (!caster->IsWithinDistInMap(tmp_target, m_radius))
{ {
@@ -796,10 +796,10 @@ void AreaAuraEffect::Update(uint32 diff)
{ {
m_removeTime -= diff; m_removeTime -= diff;
if (m_removeTime < 0) if (m_removeTime < 0)
tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
else else
tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
else else
{ {
@@ -808,17 +808,17 @@ void AreaAuraEffect::Update(uint32 diff)
if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group
{ {
if(!tmp_target->IsInPartyWith(caster)) if(!tmp_target->IsInPartyWith(caster))
tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
else if( m_areaAuraType == AREA_AURA_RAID) else if( m_areaAuraType == AREA_AURA_RAID)
{ {
if(!tmp_target->IsInRaidWith(caster)) if(!tmp_target->IsInRaidWith(caster))
tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER ) else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER )
{ {
if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() ) if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
} }
} }
@@ -854,7 +854,7 @@ void PersistentAreaAuraEffect::Update(uint32 diff)
AuraEffect::Update(diff); AuraEffect::Update(diff);
if(remove) if(remove)
tmp_target->RemoveAurasDueToSpell(tmp_id, tmp_guid); GetParentAura()->SetAuraDuration(0);
} }
void AuraEffect::ApplyModifier(bool apply, bool Real) void AuraEffect::ApplyModifier(bool apply, bool Real)
@@ -1205,10 +1205,11 @@ void Aura::SetStackAmount(uint8 stackAmount)
// Reapply if amount change // Reapply if amount change
if (amount!=part->GetAmount()) if (amount!=part->GetAmount())
{ {
bool Real = bool (part->m_spellmod);
// Auras which are applying spellmod should have removed spellmods for real // Auras which are applying spellmod should have removed spellmods for real
part->ApplyModifier(false, bool (part->m_spellmod)); part->ApplyModifier(false,Real);
part->SetAmount(amount); part->SetAmount(amount);
part->ApplyModifier(true, bool (part->m_spellmod)); part->ApplyModifier(true, Real);
} }
} }
} }
+3 -3
View File
@@ -5624,7 +5624,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Leader of the Pack // Leader of the Pack
case 24932: case 24932:
{ {
if (triggerAmount == 0) if (triggerAmount <= 0)
return false; return false;
basepoints0 = triggerAmount * GetMaxHealth() / 100; basepoints0 = triggerAmount * GetMaxHealth() / 100;
target = this; target = this;
@@ -13205,13 +13205,13 @@ void Unit::AddAura(uint32 spellId, Unit* target)
Aura * Unit::AddAuraEffect(uint32 spellId, uint8 effIndex, Unit* caster) Aura * Unit::AddAuraEffect(uint32 spellId, uint8 effIndex, Unit* caster)
{ {
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if(!spellInfo) if(!spellInfo || !caster)
return NULL; return NULL;
// can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect // can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect
//assert (!IsPassiveSpell(spellInfo)); //assert (!IsPassiveSpell(spellInfo));
Aura * aur = GetAura(spellId, GetGUID()); Aura * aur = GetAura(spellId, caster->GetGUID());
if (aur) if (aur)
{ {