Core/Auras:

* Fixed loading aura charges when they would exceed count set in SpellEntry while still remaining a valid value due to spell modifiers (that might not yet be active)
* Fixed refreshing aura charges when recasting the spell

Closes #1803
Closes #1786
Closes #1805
This commit is contained in:
Shauren
2011-06-03 21:30:50 +02:00
parent 87ce4988f4
commit 97a5db68c2
6 changed files with 33 additions and 25 deletions
+13 -4
View File
@@ -3111,7 +3111,7 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
{
ASSERT(casterGUID);
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
@@ -3134,15 +3134,16 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint
// update basepoints with new values - effect amount will be recalculated in ModStackAmount
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!foundAura->m_effects[i])
if (!foundAura->HasEffect(i))
continue;
int bp;
if (baseAmount)
bp = *(baseAmount + i);
else
bp = foundAura->GetSpellProto()->EffectBasePoints[i];
int32* oldBP = const_cast<int32*>(&(foundAura->m_effects[i]->m_baseAmount));
int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
*oldBP = bp;
}
@@ -3153,6 +3154,14 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint
*oldGUID = castItemGUID;
}
uint8 charges = foundAura->GetSpellProto()->procCharges;
if (caster)
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(foundAura->GetId(), SPELLMOD_CHARGES, charges);
// refresh charges
foundAura->SetCharges(charges);
// try to increase stack amount
foundAura->ModStackAmount(1);
return foundAura;
@@ -3805,7 +3814,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
// single target state must be removed before aura creation to preserve existing single target aura
if (aura->IsSingleTarget())
aura->UnregisterSingleTarget();
if (newAura = Aura::TryCreate(aura->GetSpellProto(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID()))
{
// created aura must not be single target aura,, so stealer won't loose it on recast